How to render a VisualElement to a Vector Based Image?

一笑奈何 提交于 2019-12-05 07:24:02

问题


I am working on a Chart Control, I need to implement the Chart Snapshot feature for capturing a vector based image in high quality of Curves and Texts, in any requested size.

Can anyone suggest me any solution or a pointer to resolve this problem.

Any kind of help in deeply appreciated.


回答1:


If you have to save your image in a vector format you can using tracing. Potrace is an open source bitmap-to-vector tracer library (but considers that bitmap tracing is imperfect). Also considers that wpf is linked closely with XAML, a vector graphics markup languages, so you may want convert raster graphics to XAML (though Charles Petzold you can't embed a bitmap in a XAML file)

If you need to draw a vector image you can use the Shape element that provides a base class for shape elements, such as Ellipse, Polygon, and Rectangle; and add the shape as Panel child. If you are dealing with thousands of shape I suggest to use the DrawingVisual class, a visual object that can be used to render vector graphics on the screen, and its RenderOpen method.

To zoom you have to work with transformations, in particular ScaleTrasnform and apply the transformation to your panel or to your shapes.

Hope this help.




回答2:


You can take a look at XamlToy but I have not already try it. http://xamltoys.codeplex.com/



来源:https://stackoverflow.com/questions/10160740/how-to-render-a-visualelement-to-a-vector-based-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!