Hello everybody!
I need to know how many white(or other colors) pixels are in Graphics,
but i didnt found way :(. I see that there is solution for Image, but
this cant help me.
I have one more question - (may be is silly) How to copy Image to
Graphics and Graphics to Image?
Thanks for your attention.
Ingo R. Homann - 23 Aug 2006 12:03 GMT
Hi,
> Hello everybody!
> I need to know how many white(or other colors) pixels are in Graphics,
> but i didnt found way :(. I see that there is solution for Image, but
> this cant help me.
> I have one more question - (may be is silly) How to copy Image to
> Graphics
g.drawImage();
> and Graphics to Image?
AFAIK impossible. The solution is to create an Image, to get its
Graphics and to paint on this graphics.
Hth,
Ingo
Josh Falter - 24 Aug 2006 14:20 GMT
Disclaimer: There may be a slick way to do the counting of white
pixels, but off the top of my head I know that java.awt.Robot has a
getPixelColor(x,y) function that you could use if you got desperate.
Oliver Wong - 24 Aug 2006 18:31 GMT
> Hello everybody!
> I need to know how many white(or other colors) pixels are in Graphics,
> but i didnt found way :(. I see that there is solution for Image, but
> this cant help me.
> I have one more question - (may be is silly) How to copy Image to
> Graphics and Graphics to Image?
Think of the Graphics object as a pen, and the Image object as a sheet
of paper. You use the Graphics object to draw on the Image, just like you
use a pen to draw on a paper. However, the Graphic object itself does not
store the picture your drew, just like the pen doesn't store the picture.
The picture is stored on the paper, or the Image object.
- Oliver