WPF==垃圾
我编写的项目中,经常需要将一幅图片进行缩放,同时保留细节以备观察,
换句话说,就像在“画笔”中缩放一样。
在Winform中,这不是问题,关闭绘图质量选项中的插样就可以了。
但转移到WPF后,使用ScaleTransform放大后,细节就会丢失,
WPF自动帮你插值(模糊)处理了,我整整找了三天,就是没办法关闭它,
google上也看到很多这个问题的求助,但没一个人有解决办法。
垃圾的WPF!
==================上文写于2008-01-17,.net 3.0========
今天试了一下.net 3.5 sp1,M$终于解决了这个问题:
3.5 SP 性能改进之一:
New “Nearest Neighbor” BitmapScaling Mode
We added NearestNeighbor interpolation mode to the BitmapScalingMode enumeration. This should provide further performance benefits over LowQuality mode when using the software rasterizer and more importantly, it provides missing functionality to scenarios such zoom-in while editing a bitmap in a “Paint” program. Without this feature WPF would produce blurry results.
用法:RenderOptions.SetBitmapScalingMode(this.image1, BitmapScalingMode.NearestNeighbor);
浙公网安备 33010602011771号