-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eraser erases clears all pixels, including those of uploaded image #47
Comments
Hi @ernOho , When you say "uploaded image" do you mean that you've imported an image onto your canvas (i.e., following these instructions)? If so, the behavior you're witnessing is expected. When you import an image it becomes part of the canvas and the pixels of that image are treated no differently that pixels you paint yourself. So if you erase it, it gets erased. :) It sounds like what you're trying to achieve is to have a background image that you want to paint on top of, but that does not get modified by the paint tools. You can achieve this by drawing your background image onto a Swing/JFX component, then placing a JMonet Canvas component on top of it (make sure the canvas color is transparent). Does that help? |
Hey @defano, On a normal FX Canvas it works, however, I'm struggling to implement it with the JMonetCanvas. After drawing and erasing (image gets covered by canvas) Am I missing anything or implementing these wrongly? Keeping the canvas transparent is the issue I'm having. Many thanks for your feedback so far. Am currently also working on issue #46. |
Hi @defano, Many thanks and kind regards |
💩 I suspect you're right. Sorry about that. If I get some time I'll look into what it might take to provide a JFX-native |
Hi,
Then I add a listener to my JFXPaintCanvasNode, which basically enables me to take the selected section of the canvas, create a clipped image from the original image and use this clipped image to replace the selected image in the canvas (not sure why, but I had to use .setDirty() and .redrawSelection(true) to make it work better)
With my createClippedImg() Method defined as follows:
As I don't use the Selection tool classs anywhere else, I did edit it to fit my needs. So after the text has been 'erased', I don't want to be able to move the selected box. I commented out the relevant code from the handling method in the SelectionTool class.
I would imagine writing a similar SelectionTool class for the eraser could solve this issue? Thank you for your speedy responses. |
Don't kill me... :) After reading through your code, it occurred to me that there might be an easier way to achieve what you're looking to do. You can simply Something like:
Will that work? |
Haha don't worry. I appreciate the help! That works very nicely. But I think your solution actually solves this issue. Funny how easy it was xD. |
Hi,
I've noticed the standard settings of the eraser clears everything, including the pixels of the uploaded image(see example of image with red airbrush and grey cleared lines). Are there options to disable the eraser to clear the pixels of the image (and just painted lines)? Or is this still a ToDo?
Thank you and kind regards
The text was updated successfully, but these errors were encountered: