Preferred Vector Image format for use in WPF? - wpf

As per the title, what's the preferred image format (or formats) for use in WPF?
My company will hire a designer to design some logos, images, toolbar icons, etc. for use in a WPF application. I was going to ask for Vector Graphics as they are supposed to stretch, shrink, etc without loosing clarity;
However, reading this post
Does WPF support reading/writing WMF/EMF files natively?
and others has got me worried; IT DOES NOT SEEM LIKE A SIMPLE TASK?! isn't this what WPF is supposed to handle natively in its sleep ?! stretch, rotate, throw flames, make toast, etc...

The preferred vector image format is XAML. There are a lot of ways for a designer to generate those graphics. Adoble Illustrator for example can use the XAML exporter. The open source tool Inkscape can export to XAML directly, a designer can also draw XAML using Microsoft Expression Design and Microsoft Expression Blend. Literally all vector graphics tool support SVG and there are a lot of ways to convert SVG to XAML.
Don't bother with WMF/EMF it will just look ugly since windows can not render them antialiased.

Related

Icons in WPF when to use image and when to use Xaml?

I am Working on a WPF based project where the design team have created the design in blend with some images like Edit, delete, checkbox etc. where i am prefring to use xaml insteed of images
Although i am sure that if the images are prety complex they should be used as images. but the simple im icon images can be used as xaml path designs. So i am looking for the recomandations. When to use Images in WPF design and When to use xaml for design.
If your application is going to be used in different screen resolutions then using Vector Graphics is recommended as they will scale nicely and all your images will look sharp regardless of the resolution of the screen. (There is a downside as well because your application needs to do the extra rendering of the xaml images to display them)
If you are using the images just to display the toolbar images (which are pretty much small and fixed size then you can get away by using png files as they will take less resources and easy to manage)

Need recommendations for Image Editing Library

I am trying to create a WPF based application which will allows users to edit photos and provide features like:
Increase/Decrease Brightness
Crop
Retro looks
and lot more.
I am also looking forward to provide more fancy features like : Framing an image, print to a Tshirt, but these are low on priority.
Any open source libraries for that?
P.S -> This is a POC project, even if i miss some features it will be fine.
I would suggest you to use BitmapEffects available in WPF, the BitmapEffects make use Shading language; at present very few effects available in .net Fx. But it is quite easy create your own shaders to adjust the birghtness, gamma, colour saturation, and they can be data bound too. The great thing about shaders is you apply them to videos as well.
Shazzam Tool is on of the best tool to create shadders, it lets you try the effect on your images and generate the C# or VB.Net binding code to use in WPF/Silverlight.
I guess you have to write code to do the image cropping, or quick Google search would help.
Opensource shader effects available here in codeplex.
For a low-level library that allows GDI like operations on bitmaps please see the WriteableBitmapEx library. This is open source and as a disclaimer, I have made a minor contribution to it.
WriteableBitmapEx has functions for drawing shapes, lines, ellipses, applying filters (via matrices, e.g. convolution blur etc), rotation, resize and cropping. You would have to write your own code to apply framing but this could be done by rendering to a separate bitmap and using the Blit function.
Above all its very fast and portable, to WP7 and Silverlight!
Best regards,

Which Silverlight Rich Text Box to use

SL4 now contains a Microsoft implementation of a RichTextBox. This is awesome but doesn't support bullets, numbering, super script or subscript.
There are also a bunch of other RichTextBox implementations out there from the control providers.
When is the best time to use the Microsoft one and when should I go to the market? What is the best control for the different use cases for a Rich Text control?
BTW, I'm not looking for subjective stuff. I'm interested in functionality, performance, extensibility, download size etc
performance? Forget about Microsoft`s RichTextBox. The WPF RichTextBox is a speed mess because its a FlowDocument. Silverlight is not different.

What are good places to find free XAML images?

As I started using WPF at higher DPI resolutions, I got into troubles with scaling of toolbar images. XAML images solve that problem.
However I find it very hard to find free toolbar/ribbon XAML images that you can use in your own projects. What I found is usually not free and one probably needs more than few collections to get all needed images.
Where do you find your toolbar/ribbon .xaml images?
Check out the following link
Hidden features of WPF and XAML?
There is a list of converters that can take many formats of images and convert them to xaml for you.
Personally, I wind up using InkScape to create my XAML a lot. Even with my meager drawing skills, it's fairly easy to use and very effective.
As a note, though, I tend to work with the image in the native format and then save as XAML. Working with a file in XAML format seems to be somewhat unstable.

Does WPF support reading/writing WMF/EMF files natively?

Can Windows Presentation Foundation read/write WMF/EMF files without having to use WinForms Interop or Win32.
If it does not, what is the reason?
A quick search on MSDN reveals a thread containing a post by Peggi Goodwin, a PM at Microsoft:
WPF does not support the EMF and WMF image formats. These formats are more susceptible to security vulnerabilities than other image formats, so we do not intend to support them.
I did it !!!
I'm using ComponentOne's WPF chart in my real code but to keep the example simple I just did a button. But it DOES work on Complex wpf widgets. Fonts, Transparency, AntiAlias etc. everything works. And I can paste into Word and change labels on charts etc.
Basically I decimate the XAML to XPS then import it back into XAML.
Then I used an open source project that converts XAML to WMF called XAMLToys.
XAMLToys would fail 99% of the time because you cannot serial complex XAML objects
http://softronix.com/download/WpfToWmfClipboard.zip
Big kudos to these two projects
http://xamltoys.codeplex.com/
http://khason.net/blog/converting-fixeddocument-xpsdocument-too-to-flowdocument/

Resources