You can get the source code for my WPF Photo Print utility here and on CodePlex. Some interesting bits are:
- All transformations are applied to Drawing objects. Take a look in the ‘Transformations’ folder and you’ll notice creating new ones is just a case of overriding GetDrawing.
- The crop selection uses an Adorner (based on an MSDN sample) combined with an OpacityMask (see Preview.xaml) and plenty of data binding.
- Although it’s designed for photo printing, the transformations could be applied to any base drawing. Just derive something from Transformable; it should (could) even work for video
- Currently it only prints the results, but it’d be a piece of cake to draw to a RenderTargetBitmap and save to a file (in any DPI you choose).
Hope you find it useful (I’ve already printed plenty of photos with it — it’s great!
)
7 responses so far ↓
WPF Photo Print (.NET 3.5 SP1) « Chris Cavanagh’s Blog // August 22, 2008 at 1:24 am |
[...] July 29, 2008 · 5 Comments UPDATE: Source code now available here. [...]
Dew Drop - August 22, 2008 | Alvin Ashcraft's Morning Dew // August 22, 2008 at 7:30 am |
[...] WPF Photo Print – Source Code (Chris Cavanagh) [...]
Silverlight Cream for August 23, 2008 -- #354 // September 2, 2008 at 11:40 am |
[...] Dynamically loading ListView Templates again, and DZ and Mandelbrot. From SilverlightCream.com: WPF Photo Print – Source code Not Silverlight, but it’s WPF code… so that’s close
… Chris Cavanagh posted the code to his [...]
Luca // October 8, 2008 at 4:57 am |
Hi Chris ! Have any idea how to save image in original image resolution ??
Chris Cavanagh // October 8, 2008 at 9:36 am |
Luca – Basically you just need to create (and draw to) a RenderTargetBitmap of the appropriate size. I’ll get a sample / update uploaded as soon as I can (I’ve been meaning to do some tweaks but have been busy / procrastinating
).
toddpi314 // January 25, 2009 at 12:44 pm |
tight, I will check out the source.
Just wondering, was this project ported or did you start from scratch?
Chris Cavanagh // January 25, 2009 at 9:31 pm |
toddpi314 – It wasn’t a port — I just needed a simple photo crop/rotate utility that didn’t need files importing into a library. WPF made writing this pretty easy