WPF 相当于 GDI 的 ColorMatrix
我注意到 WPF 具有 System.Windows.Media(.Imaging) 命名空间,其中包含许多与 System.Drawing(.Imagine) 相同的功能,但我没有看到与 GDI+ 中的 ColorMatrix 等效的功能。实际上,我实际上没有看到一般进行颜色转换的方法。有吗?我很高兴使用 GDI+,但只是好奇。
I noticed that WPF has the System.Windows.Media(.Imaging) namespaces that contain a lot of the same functionality as System.Drawing(.Imagine), but I don't see an equivalent to the ColorMatrix in GDI+. I actually don't see a way of doing color transformations in general. Does one exist? I'm happy using GDI+ but was just curious.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WPF 允许您编写自定义像素着色器。它们比 ColorMatrix 更通用,您可以将 ColorMatrix 复制为像素着色器,而且它们在 GPU 上执行。 Shazzam 附带了一些示例并简化了编写它们的过程。
请注意:WPF 比图像编辑更适合创建用户界面,除了 System.Windows.Media.Imaging 类似于 WriteableBitmap 和 RenderTargetBitmap。如果您需要位图图像编辑功能,gdi+ 和 Direct2D 可能更合适。
WPF allows you to write custom pixel shaders. These are more versatile than a ColorMatrix which you could replicate as a pixel shader, plus they are executed on the GPU. Shazzam ships with some samples and simplifies the process of writing them.
Just to note: WPF is more suited for creating user interfaces than image editing, there's not much more than the members of System.Windows.Media.Imaging like WriteableBitmap and RenderTargetBitmap. If you are after bitmap image editing features gdi+ and Direct2D might be more appropriate.
也许 http://msdn2.microsoft.com/ en-us/library/system.windows.media.imaging.formatconvertedbitmap.aspx?
编辑: http://msdn.microsoft.com /en-us/library/system.windows.media.effects.pixelshader.aspx,但我认为这不是最好的答案,因为你必须了解 HLSL。
Maybe http://msdn2.microsoft.com/en-us/library/system.windows.media.imaging.formatconvertedbitmap.aspx?
Edit: http://msdn.microsoft.com/en-us/library/system.windows.media.effects.pixelshader.aspx, but i think it is not best answer because you must know about HLSL.