Perspective transform with WPF

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-31 04:29:05

问题


WPF allows to specify linear affine transform on graphical objects. With this you can do translation, rotation, scaling, skewing, or a combination of that. You can specify a 2x3 matrix.

What I want to do is a perspective transform in 2D space, which requires a 3x3 matrix, and is known from Photoshop or GIMP, where you can drag all 4 corners of an image independently.

I tried to use the 3D features of WPF, set up a Viewport3D, an OrthographicCamera and placed the (2D) objects onto the xy-plane.

But I'm wondering if there is no easier way to accomplish the perspective transform in WPF?

I'm asking also because I'd like to do the perspective transform on text: in 2D I can use a TextBlock, in 3D it gets more compliacted, I'd have to create a Brush out of a Geometry out of a FormattedText.


回答1:


As you can read here there are some 3rd party libraries that implement Silverlight's PlaneProjection for WPF.

Otherwise you will be forced to code it yourself. (Perhaps Microsoft will add the PlaneProjection in a future version of .NET)



来源:https://stackoverflow.com/questions/10715586/perspective-transform-with-wpf

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