图像缩放 [英] Image Zooming

查看:70
本文介绍了图像缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢WPF缩放的简单程度(转换任何控件的转换能力).但是,我想将其用于图像,并且需要像素化,即不进行混合/平滑处理.

因此,如果我一直都在拍摄黑白格仔的图像,那么随着我放大的越来越远,我希望能够一直放大到黑色(或白色像素).

I love how simple the WPF zooming is (transform ability to zoom any control). However, I wanted to use it for an image and I require the pix-elation, i.e. no blending/smoothing.

So if I have an image of checkered Black and White pixels all through out, as I zoom further and further in I want to be able to zoom all of the way into a Black (or White Pixel).

Is this possible?

推荐答案

这是一个很好的问题,而且-我认为-关于如何显示像素图形的好主意-我的5! > 幸运的是,我知道确切的答案.

我看到它的唯一方法是将每个像素建模为矩形对象(如果需要正方形像素,则实际上是正方形).使用已经使用过的相同缩放功能,这将自动为您提供所需的效果.

要从WPF位图中提取有关像素的数据(我假设您已经获得了一个),请使用
This is an excellent question and -- I think -- a great idea of how to present pixel graphics -- my 5!
Fortunately, I know the exact answer.

The only way I can see it to model each pixel as a rectangle object (actually a square if you want square pixels). This will automatically give you the desired effect using same very zooming you already use.

To extract data about pixels from a WPF bitmap (I assume you already obtain one) use
System.Windows.Media.Imaging.BitmapImage

及其方法CopyPixels.

如果您需要更新图片(如果这是一种编辑器),则可能需要将正方形"数据打包回真实位图.然后使用

and its method CopyPixels.

If you need to update picture (if this is a kind of editor), you may need to pack your "square" data back to real bitmap. Then use

System.Windows.Media.Imaging.WriteableBitmap



请随时提出任何其他问题(如果您认为有问题,请在投票前这样做:))

谢谢.



Please feel free to ask any further questions (and certainly do that if you think something is wrong, before you vote :) )

Thank you.


这篇关于图像缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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