Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GraphicsContext - How to clear the image

 
Sukumar Gaade
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on a Java FX 2.x application. I am using GraphicsContext to capture the signature image drawn.




User has the ability to clear the signature drawn



To clear the image I am using gc.clearRect(0, 0, gc.getCanvas().getWidth(), gc.getCanvas().getHeight()). As per java doc this Clears a portion of the canvas with a transparent color value. So this is visually clearing the image by making it transparent but it isn't really clearing the image so when I save the form its still saving the image. How can we clear the image so that it doesn't save the image ?

Please let me know if i am not clear putting my question so that i can elaborate with screenshots.

Regards,
csr
 
Sukumar Gaade
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anyone please help me out!
 
John Damien Smith
Ranch Hand
Posts: 299
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> when I save the form its still saving the image

It is unclear what this means and you supply no code for this function, so I don't think the question as it is is really answerable.

----

The clearSignature method is weird, you clear the canvas, draw some stuff, then clear the canvas again.
Drawing commands to the canvas are queued and replayed once you relinquish control of the JavaFX application thread. You aren't doing that here, so the entire method could be replaced with a single clearRect call and it would do the same thing.

----

> Could anyone please help me out

StackOverflow under the JavaFX tag gets more traffic than the JavaRanch JavaFX forum, so you could try cross-posting to there.
If you do so, try to improve the question so that it is clearer what you need and the code you supplied makes sense.

> if i am not clear putting my question so that i can elaborate with screenshots

Screenshots are not needed, you can supply if you like, but a clearer question and description of the issue, together with minimal code that replicates the issue (and can be executed using copy and paste) is better.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic