Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

Count pixels

Thread view: 
TheC0der - 23 Aug 2006 11:15 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?
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.