This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Erase / Image / Canvas??

 
Dustfire
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4404
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dustfire
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic