header bg
 

Sl.ayer's layer

It looks like you're writing a blog...

“Scratch”, WriteableBitmap Sample

by Sl.ayer 21. December 2009 04:37

Screen I have a new addition to my samples gallery. This sample was inspired by a question I answered on the silverlight.net community forums. The idea of creating a “scratchable” surface intrigued me, so I decided to make a full-blown sample utilizing WritabeBitmap.

It took me about 8 hours from start to finish to implement the sample. Most of it I spent fussing over the application’s look-and-feel and getting the brushes to work properly. Some of my failed experiments with brushes produced very interesting, almost impressionistic-looking, results.

The ideas I considered for development, but not included in the sample: changing brush shape depending on stroke’s velocity; rotating brush based on the angle of the stroke; and multi-touch support.

Comments (6) -

Marcus
Marcus
12/27/2009 1:00:12 PM #

Wey, looks very nice!

I didn't take a look at the code by now, but this seems very interesting. Would it be easily possible to "reveal" the picture using some kind of animation like approach?

I want the image to be revealed automatically but without any user interaction (apart from maybe hitting a "Reveal!" button).

Admin
Admin
12/28/2009 3:54:34 AM #

Yes, code can be modified to control brush programmatically. With addition of dependency properties it should even be possible to move brush using animations.

Mark
Mark
1/5/2010 1:32:24 AM #

Really great scratch example!  I tried downloading the source, but could not get it to compile.  For one thing, it looks like the file 'BlitWriteableBitmap.cs' is missing.  The only other compile error I received was: Source file 'C:\xxx\Scratch\Scratch\Properties\AssemblyInfo.cs' could not be opened ('Unspecified error ')

If ''BlitWriteableBitmap.cs' is a seperate file that you included, do you need to set the "Copy to output directory" setting?Would you mind emailing me the source or re-posting?

Admin
Admin
1/5/2010 6:48:03 AM #

I was experimenting with blit from BlitWritableBitmap.cs, but in the end I didn't use it, so I removed it from the projsect. I guess something got broken in the process. I will upload new source once I fugired whats wrong.

Mark
Mark
1/6/2010 12:58:50 AM #

Sounds great... I'll be looking for the new source upload.  Thanks again...

Admin
Admin
1/6/2010 1:20:58 AM #

Updated source is up.

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading






header bg