Results 1 to 3 of 3
Thread: setPixel in java?
- 09-09-2010, 11:24 AM #1
setPixel in java?
Hi again! :)
I'm working on rewriting my paint program, and I am supposed to draw it without using the defailt .drawLine and .drawSquare methods.
The problem is not in the calculations, nor in the coding of them, but more in how you can set a pixel to a color in java?
I've tried googling it, but I couldn't really find how to do it.
How do you draw pixel by pixel without using the default methods? I asume the drawLine etc. functions use some sort of setPixel. What is it? :)
Thank you for reading,
- CemiCarpe Diem
Each day's a gift and not a given right
- 09-09-2010, 03:54 PM #2
Strange assignment, not allowing you to use the Graphics class method.
Have you looked in the API doc at all the setPixel methods available? There are lots of them in different classes. Go to the S-Index and use the browser's Search
- 09-09-2010, 06:40 PM #3
You could try using a BufferedImage (using offscreen drawing), then place it on the stage.
Off Screen Paint: create Graphics from BufferedImage : Buffer Paint*«*2D Graphics*«*Java Tutorial
BufferedImage - setRGB(int, int, int) (Java 2 Platform SE v1.4.2)