File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Erase / Image / Canvas?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Erase / Image / Canvas??" Watch "Erase / Image / Canvas??" New topic
Author

Erase / Image / Canvas??

Dustfire
Greenhorn

Joined: Apr 13, 2001
Posts: 2
Hi;
I want to create an applet which loads an image as background and
have an option to draw anything on the image (image is not changeing , think that there is a sub layer containing the image and an upper transparent layer which is holding the drawings)
And One important thing is I want to be able to erase any part of the drawing without touching any pixel of the image on the sub layer...
So you can think as:
1. A Sub Layer containing an Background image
2. A Transparent Layer on the Sub Layer which gives you the drawing options... And an eraser function which can erase the drawings without eraseing the background image....
Is that possible? how?? Its very important.. I couldnt find any answers...
Thanks..
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

Dustfire,
I'm not sure if you can do that or not. The closest I have come to doing anything like that is in html I had a transparent annimated gif with a .jpg behind it.
I hate to say this but, your name does not comply with the Javaranch naming guidelines which can be found at http://www.javaranch.com/name.jsp
please register again with a valid name.

SCJP
Visit my download page
Dustfire
Greenhorn

Joined: Apr 13, 2001
Posts: 2
Hi;
Sorry for my nick.. I will change it.. But I solved the problem Maybe you are interested in such a case...
Well First You need to Set the background with
g.drawimage(Image img,int x, int y, this);
For drawing the image you want as background...
And for the drawing part you can use any method of the
Graphics.... g.DrawOval etc...
The Tricky part for the Erasing and Not touching the background is Like Repainting the Background on the Pixels which erase should be done.. So you take a Portion of the real image and replace the part on canvas which should be erased with that portion of the image...
Graphics g = getGraphics();
g.drawImage(image,x,y,x_final,y_final,x_img_portion,y_img_p,x_img_final,y_img_final,Color,this);

Here we go ) If you need more info I can send the source code of the applet..
Have a nice day..
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Erase / Image / Canvas??
 
Similar Threads
Can't clear glassPane
How to draw a layer with some annotations over a big picture?
Question about repainting
Can I implement a transparent eraser in Java GUI?
drawing on a JPanel without erasing the underlying drawings