Click here to Skip to main content
13,152,063 members (36,005 online)
Rate this:
Please Sign up or sign in to 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 27-Jun-12 1:58am
Updated 27-Jun-12 3:09am
Sergey Alexandrovich Kryukov 27-Jun-12 12:49pm
What, is your MSDN broken?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I have no experience in metro, but erasing in a raster environment is nothing more than painting with background color.
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.
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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 27 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100