Can I make a Windows Paint with this? :)

Jun 2, 2010 at 2:25 PM
I was wondering that, and I want to port it to WPF would that be difficult? the main problem I'm facing with an app I'm developing is that I want to fill an area split by a line like any paint bucket out there in any drawing tool, but I wonder if using WriteableBitmap I'll be able to select a shape draw shapes easily and move them around uhm, have someone ever done this? thanks!
Coordinator
Jun 2, 2010 at 6:07 PM
Edited Jun 2, 2010 at 6:12 PM

Yep, it's possible to write a small paint app. I don't have an explicit bucket fill method implemented and I don't plan do to that, but all the common shapes now have Fill equivalents. A scanline (or flood fill) is pretty straight forward: http://en.wikipedia.org/wiki/Flood_fill

Check out this sample and uncheck the "Growing Plant Demo" checkbox to draw control points with your mouse and move them: http://dl.dropbox.com/u/2681028/CodeplexData/WriteableBitmapEx/CurveSample/WriteableBitmapExCurveSampleTestPage.html
It's the curve sample. The code is part of this project's repository.

A WPF port shouldn't be a problem either. Only the width and height properties have some other names and there are some other minor differences. Actually the WPF WriteableBitmap has some more methods that would make it easier. But why don't you just write a Silverlight paint app? WPF is dead! ;)

Jun 2, 2010 at 6:21 PM

Thanks teichgraf! I will implement the flood fill algorithm and the sample is wonderful I did not check that before :) thanks!, and yes haha I would like to use Silverlight but I need the Ribbon UI but will take a look at the Silverlight Ribbon offerings out there :)

Jun 2, 2010 at 8:26 PM

keoz-
If Silverlight works for you, go for it. If you think WPF is a better fit for what you are doing, go for it. WPF is not dead.

Thanks, Rob Relyea
WPF/Silverlight Teams
http://robrelyea.com/blog

 

Jun 2, 2010 at 8:37 PM

Yeah Rob I think so too :) thanks, besides I think I will need some interfacing with local files and devices so maybe port the library would be the option

Coordinator
Jun 4, 2010 at 9:24 PM
Edited Jun 4, 2010 at 9:28 PM
Don't listen to what Rob says, WPF is dead. ;) Seriously, I was just making a joke. Like Rob said, use what fits your needs best. And as I already wrote, it should be no problem to port this lib to WPF. Good luck and make sure to keep me updated on your progress.
Jun 4, 2010 at 9:27 PM

Lol ok teichgraf thanks and sure thing I will post results about it and hopefully make a contribution to your library as example or something :)