J
Jack Nielsen
Hi !
I'm new to C# and want to start by making a starfield with stars coming from
the middle and ou while getting brighter.
First of all, how to I make a single pixel ? And secondly, how to do this
fast without any flicker at all ?
I made alot of this stuff in assembler in C64 and C Amiga, with the speed of
computers today it should be possible to have alot of stars without any
flicker at all
I have searched the web alot and one example I found on how to make a pixel
seems kinda silly and slow, see this
Drawing a single pixel in C#
I am writing a control that needs to display a grid (similar to the VS.NET
IDE) as the background. Now in the "old days" you could call the function
SetPixel to draw a single pixel on a device context. However, the .NET
Graphics object does not have such an API, so how do you do it without
resorting to P/Invoke? I found a solution on the web and here it is...
// Create a 1 x 1 bitmap and set the color
Bitmap pt = new Bitmap(1, 1);
pt.SetPixel(0, 0, Color.Gray);
// Draw bitmap on Graphics surface
e.Graphics.DrawImageUnscaled(pt, x, y);
It's pretty simple, but it took me a few minutes of experimentation before
looking to the web for an answer. To quote Star Trek, "Engineers love to
change things."
How can this be make better !
Also if anyone know of graphic demos made with c# please share the link !
Hope some of you can guide me in the right direction ( Using VS2005 )
Thanx
Jack
I'm new to C# and want to start by making a starfield with stars coming from
the middle and ou while getting brighter.
First of all, how to I make a single pixel ? And secondly, how to do this
fast without any flicker at all ?
I made alot of this stuff in assembler in C64 and C Amiga, with the speed of
computers today it should be possible to have alot of stars without any
flicker at all
I have searched the web alot and one example I found on how to make a pixel
seems kinda silly and slow, see this
Drawing a single pixel in C#
I am writing a control that needs to display a grid (similar to the VS.NET
IDE) as the background. Now in the "old days" you could call the function
SetPixel to draw a single pixel on a device context. However, the .NET
Graphics object does not have such an API, so how do you do it without
resorting to P/Invoke? I found a solution on the web and here it is...
// Create a 1 x 1 bitmap and set the color
Bitmap pt = new Bitmap(1, 1);
pt.SetPixel(0, 0, Color.Gray);
// Draw bitmap on Graphics surface
e.Graphics.DrawImageUnscaled(pt, x, y);
It's pretty simple, but it took me a few minutes of experimentation before
looking to the web for an answer. To quote Star Trek, "Engineers love to
change things."
How can this be make better !
Also if anyone know of graphic demos made with c# please share the link !
Hope some of you can guide me in the right direction ( Using VS2005 )
Thanx
Jack