aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Image from Canvas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Image from Canvas" Watch "Image from Canvas" New topic
Author

Image from Canvas

manu g
Greenhorn

Joined: Mar 18, 2001
Posts: 5
i have drawn an image in canvas,now i want to make it as an image so that i be able to extract the pixel information from it,how can i make an Image object from the information in canvas
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words (single letters are not permited), separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Manu,
The way I would do it is use the createImage( x, y ) method in Component to create a "back buffer" image ( normally used in double buffering ) that you do all the drawing to in your paint method. Then, at the end of the paint method, you simply do a g.drawImage( buffer, 0, 0, this ) to draw to the screen. You would also have a reference to the image being shown on the screen.

HTH,
-Nate
[This message has been edited by Nathan Pruett (edited April 12, 2001).]


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image from Canvas