Click here to Skip to main content
15,888,271 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hi, I am developing a paint like application in metro style. I want to apply a eraser functionality. So how can I make such a tool for erasing the content from canvas like we do in MS paint ?

I don't want to clear whole canvas, wherever I click or drag the pointer, the path traveled by the pointer should be erased.
Posted
Updated 27-Jun-12 3:09am
v3
Comments
Sergey Alexandrovich Kryukov 27-Jun-12 12:49pm    
What, is your MSDN broken?
--SA

1 solution

I have no experience in metro, but erasing in a raster environment is nothing more than painting with background color.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 27-Jun-12 12:48pm    
Sorry, Zoltán; I had to vote 1. Why would you answer about something you have no idea about?
This is not always true even for raster graphics; for example, erasing could be setting zeros in alpha channel.
As to Metro application, most typical graphics is putting shapes in some container like Panel. So erasing would be removing objects from their container.
--SA
Zoltán Zörgő 27-Jun-12 14:38pm    
Feel free to give point as you like. You might have right, but I also might have right. I never said this are not options. You know Occam's razor? Taking in consideration statement like "MS paint", "path should be erased".. and so on, will never conclude to removing objects from their container - only if you consider canvas as a container of it's pixels. Yes, you can do fancy things... but not always the most complex one is the answer. Using these starting information, I still believe, that changing a pixel color to background is the most possible solution. Oh and I never said, that the background cannot be transparent, or translucent, or whatever... And by the way, since a you can make metro style app in html5, the canvas concept in metro should be really close to html5 canvas element. Never mind... I have no idea about... sorry...
Sergey Alexandrovich Kryukov 29-Jun-12 18:43pm    
Vector graphics is conceptually different. Still there are pixels (usually), but they are abstracted out. Of course I'm familiar with Occam's razor, but I'm not trying to break this principle here.
Thank you for understanding.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900