简体   繁体   English

什么是像素偏移模式?

[英]What is PixelOffsetMode?

MSDN doesn't explain it for someone who doesn't already know what it is. MSDN不会为不知道它是什么的人解释它。 I've searched, but only found that it sets the quality of rendering.我搜索过,但只发现它设置了渲染质量。 But in what way?但以什么方式? What, for example, does例如,做什么

Specifies that pixels are offset by -.5 units, both horizontally and vertically, for high speed antialiasing.指定像素在水平和垂直方向偏移 -.5 个单位,以实现高速抗锯齿。 ( MSDN ) ( 微软)

mean?意思?

During painting you're using double values to present your logical graphic objects, for example lines, circles, etc.在绘画过程中,您使用双值来呈现逻辑图形对象,例如线条、圆形等。

But during rendering, framework should convert your logical doubles into physical integer pixels.但是在渲染过程中,框架应该将您的逻辑双精度转换为物理整数像素。

During this process framework uses some kind of rounding, smoothing ( anti-aliasing )在此过程中,框架使用了某种舍入、平滑(抗锯齿

So, during anti-aliasing you can have different algorithms which will provide different results;因此,在抗锯齿期间,您可以使用不同的算法来提供不同的结果; Usually all they need to calculate "distance" between logical pixel and its physical coordinates, so different modes of this setting affects precision of this distance.通常他们只需要计算逻辑像素与其物理坐标之间的“距离”,因此此设置的不同模式会影响此距离的精度。

Here is nice example of different modes (basically different shades of gray - different distance):这是不同模式的好例子(基本上不同的灰色阴影 - 不同的距离):

在此处输入图片说明

NOTE: .net framework also has setting for actual smoothing ( SmoothingMode ) which basically means - how we smooth, not how we calculate distance internally注意:.net 框架也有实际平滑的设置( SmoothingMode ),这基本上意味着 - 我们如何平滑,而不是我们如何在内部计算距离

When rendering images, PixelOffsetMode specifies where the respective center points of the pixels end up:渲染图像时,PixelOffsetMode 指定像素各自的中心点结束的位置:

  • PixelOffsetMode.Half means coordinate (0.5, 0.5) aligns with the middle (=half) of the top left pixel, or to put it more clearly: (0, 0) is the top left of the top left pixel. PixelOffsetMode.Half 表示坐标 (0.5, 0.5) 与左上角像素的中间 (=half) 对齐,或者更清楚地说:(0, 0) 是左上角像素的左上角。
  • PixelOffsetMode.None means coordinate (0.5, 0.5) aligns with the top left corner of the top left pixel. PixelOffsetMode.None 表示坐标 (0.5, 0.5) 与左上角像素的左上角对齐。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM