Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is PixelOffsetMode?

Tags:

c#

.net

image

MSDN doesn't explain it for someone who doesn't already know what it is. 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. (MSDN)

mean?

like image 589
ispiro Avatar asked Feb 10 '15 20:02

ispiro


1 Answers

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):

enter image description here

NOTE: .net framework also has setting for actual smoothing (SmoothingMode) which basically means - how we smooth, not how we calculate distance internally

like image 86
Iłya Bursov Avatar answered Nov 15 '22 04:11

Iłya Bursov