Looking for details on the PixelOffsetMode Enumera

2019-07-22 06:08发布

问题:

The possible values of PixelOffsetMode are:

Invalid  
Default  
HighSpeed  
HighQuality  
None  
Half  

I'm guessing that HighQuality = Half, HighSpeed = None and Default = HighSpeed.

If this is true then, like the SmoothingMode, I can offer just two simple options.

Does anyone know if this is correct and, if so, where on earth did you find the information?

回答1:

If this is true then, like the SmoothingMode, I can offer just two simple options.

Your assumption seems to be correct.

According to this excellent page/blog about Graphics.DrawImage:

Those docs make it clear; there are really only two options, and the Remarks section describes quite nicely what each does. The real options: None and Half. The rest are just aliases for those two. I’ll make it even simpler: None=Bad, Half=Good. The default value is Bad.

The GDI+ MSDN actively explains that there are actually only two options:

PixelOffsetModeNone Indicates that pixel centers have integer coordinates.

PixelOffsetModeHalf Indicates that pixel centers have coordinates that are half way between integer values.

Invalid is never to be used, and the other values simply link through to the ones mentioned above.

So in summary, although the enumeration has different values:

None == Default == HighSpeed, yielding a lower quality but faster operation, pixels usually do NOT represent the color value of their integer location (i.e. their corner)

Half == HighQuality , yielding better results (less artifacting) but in a costlier operation, after all pixels usually represent the value of their center.



回答2:

PixelOffsetMode is defined as:

public enum PixelOffsetMode
{
    Invalid = -1,
    Default = 0,
    HighSpeed = 1,
    HighQuality = 2,
    None = 3
    Half = 4,
}

A great way to see these values (and other similar things) is to use .NET Reflector.