Java Demos

Started by
0 comments, last by Kosh 24 years, 1 month ago
Hi everyone, I am trying to program a little 2d application in java, just something that plots pixels to a screen. I want to recreate my good ol days with the spinning cubes, but I am unsure about how I should plot pixels in an efficient manner, I know about the Point2D class, but I would like to know, is there a better way of doing this. If you know anything that can help me please do tell me thanks Kosh
if understanding it made and born with time, then time, is understandings greatest enemy.....
Advertisement
If you are using an applet, just override the Paint() function. It will pass a Graphics object to the function which you can use to draw with. I know there is something for drawing a single pixel (which is SLOW) but you can simulate that with a DrawLine() function with the same beginning and end points.

If you need to draw points efficiently, there is a special type of Image which takes an array of bytes and create an image of it. If you pass the same array of the same size over and over again, I think it won''t continually create new Images, but reuse the first one.

This topic is closed to new replies.

Advertisement