Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Erase / Image / Canvas??

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic