如何将VisualElement渲染为基于矢量的图像? [英] How to render a VisualElement to a Vector Based Image?

查看:181
本文介绍了如何将VisualElement渲染为基于矢量的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个图表控件,
我需要实现图表快照功能捕获基于矢量的图像高质量的曲线和文本,任何所需的大小。

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.

赞赏。

推荐答案

如果您必须以矢量格式保存图像,可以使用跟踪。 Potrace 是一个开源位图到矢量跟踪库(但认为位图跟踪不完善)。还认为wpf与 XAML (一种向量图形标记语言)紧密相关,因此您可能希望< a href =http://weblogs.asp.net/rrobbins/archive/2007/11/11/how-to-convert-raster-graphics-to-xaml.aspx =nofollow>将光栅图形转换为XAML (虽然Charles Petzold 您无法在XAML中嵌入位图文件

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)

如果您需要绘制矢量图像,可以使用 Shape 元素,为椭圆,多边形和矩形等形状元素提供基类;并将形状添加为 Panel 儿童。如果您正在处理数千个形状,我建议使用 DrawingVisual 类,可用于在屏幕上渲染矢量图形的可视对象及其RenderOpen方法。

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.

要缩放,必须使用转换,特别是 ScaleTrasnform ,并将转换应用于您的面板或您的形状。

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

希望有帮助。

这篇关于如何将VisualElement渲染为基于矢量的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆