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
--------------------------------------------------------------------------------
Jeg beskyttes af den gratis SPAMfighter til privatbrugere.
Den har indtil videre sparet mig for at få 12297 spam-mails
Betalende brugere får ikke denne besked i deres e-mails.
Hent en gratis SPAMfighter her. 2 2950
"Jack Nielsen" <no_spam ja**********@get2net.dkwrote in message
news:OS**************@TK2MSFTNGP02.phx.gbl...
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 ?
Fill a 1*1 pixel Rectangle.
e.Graphics.FillRectangle(Brushes.White, 0, 0, 1, 1);
Double Buffer for flickerless painting.
Aren't stars supposed to flicker ;-)
Take a look at Bob Powells GDI+ FAQ, where you should find the answers to
these as well as some of your follow up questions: http://www.bobpowell.net/faqmain.htm
--
Mick Doherty http://dotnetrix.co.uk/nothing.html
Are there any plans that GDI will be hardware acc. ?
Jack
"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]skrev i
en meddelelse news:OE**************@TK2MSFTNGP06.phx.gbl...
"Jack Nielsen" <no_spam ja**********@get2net.dkwrote in message
news:OS**************@TK2MSFTNGP02.phx.gbl...
>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 ?
Fill a 1*1 pixel Rectangle.
e.Graphics.FillRectangle(Brushes.White, 0, 0, 1, 1);
Double Buffer for flickerless painting.
Aren't stars supposed to flicker ;-)
Take a look at Bob Powells GDI+ FAQ, where you should find the answers to
these as well as some of your follow up questions: http://www.bobpowell.net/faqmain.htm
--
Mick Doherty http://dotnetrix.co.uk/nothing.html
--------------------------------------------------------------------------------
Jeg beskyttes af den gratis SPAMfighter til privatbrugere.
Den har indtil videre sparet mig for at få 12319 spam-mails
Betalende brugere får ikke denne besked i deres e-mails.
Hent en gratis SPAMfighter her. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gary Frank |
last post by:
What are the ramifications if I were to instantiate an object tens of
thousands of times and add them to an array? Or hundreds of thousands of
times? Do you know if the act of instantiating a...
|
by: Matt |
last post by:
Hi All,
I have a little piece of code that is giving me the shits. I have an
arraylist colelction which is putting dynmaic objects into it, and the
objects are being accessed dynamically too. My...
|
by: Matheas Manssen |
last post by:
Hi,
When run the following class with midp 2.0, the midlet hangs. I think it
happens in the flushGraphics() method. Does anybody know the solution?
Best regards,
Matheas Manssen
import...
|
by: kudos |
last post by:
import Tkinter
import random
root = Tkinter.Tk()
w = Tkinter.Canvas(root, width=400, height=300, background="#000000")
w.create_text(200,150,text="Happy Christmas 2006",font="Arial...
|
by: edwire |
last post by:
I'm trying to update the form's text box city, state from the user input using onblur, focus. So far 3 days and zero results!
here is my code:
phpcode: newcityState.php
<?php
/**
*...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |