WPF 2d vector-graphics library - wpf

I'm looking for a WPF library for 2d vector graphics.
Required features
API for:
drawing shapes
editing shapes
highlighting shapes
Optional features:
possibility to save image to a binary file and to load image from such file (format doesn't matter)
own editor which has UI for creating and editing shapes and which can be integrated in an application (WPF control or external application)
Both free and commercial libraries are acceptable.
P.S. In the last resort WinFroms libraries are acceptable.

You might could use some of the classes from this cool geometry tool.
http://livegeometry.codeplex.com/
or this:
http://wpfholepatterns.codeplex.com/

Related

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,

Preferred Vector Image format for use in 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.

3d Models in WPF

My question is simply
How can I get a file with .3ds or .obj extension loaded in a wpf project?
How can I drag and drop that 3d model with the mouse?
(I'm doing a 3d chess project)
Blend has support for loading an obj file and converting it to xaml. Unfortunately, there is no support for 3DS in the box - getting 3DS files requires 3rd party software such as Reader3ds.
You'll need to write your own hit testing, and handle this yourself.

WPF 3D Model Drawing Tools

Are there any applications out there for 3D modeling that would output the finished product to an array of points (X,Y,Z) that you could then import to a WPF 3D Model?
ie:
<MeshGeometry3D Positions="0,0,0 10,0,0 0,10,0 10,10,0 0,0,10 10,0,10 0,10,10 10,10,10"
TriangleIndices="0,2,1 1,2,3 0,4,2 2,4,6 0,1,4 1,5,4 1,7,5 1,3,7 4,5,6 7,6,5 2,6,3 3,6,7" />
A simple google search for "WPF exporter", an I found:
Viewer3ds - 3ds to xaml converter
Viewer3ds is a WPF application that can read 3ds files and convert them into xaml. It is using the Ab3d.Reader3ds library that imports 3ds files at runtime.
This might be what you need because almost all 3D authoring application are able to export to .3ds format.
Edit:
You could also try Blender and XAML Exporter for Blender to create your 3D assets.
you can use google sketchup, and the exporter I wrote.
http://itaibh.blogspot.com/2009/09/google-sketchup-xaml-exporter.html
Viewer3ds is a converter rather than a modeling tool. If you are looking for free tools, Blender is a very powerful 3D modeling application (albeit with a high learning curve for the UI and workflow) which can export .xaml files with the help of this Blender plugin.
If free is less of a concern to you, then you can use other applications such as Maya or 3ds Max, also with plugins : http://max2xaml.codeplex.com/
All tools mentioned above have the ability to define normals, smoothing groups, materials, etc., everything that WPF supports (and much more, of course).

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