Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I wrote up a quick little PNG to ICO converter a while back ( https://iconverticons.com ) that uses the .NET Graphics API to do the image resizing and compositing.

One of my users of the recently ran into an issue where they noticed some of the downscaled images had a semi-transparent edge along the left side. I traced this back to the PixelOffsetMode of the Graphics object I was doing the compositing in.

What I have tried:

Changing the PixelOffsetMode to PixelOffsetMode.HighQuality seems to have resolved the compositing issue, but I can't seem to find good documentation on what the default PixelOffsetMode is supposed to be. It seems counterintuitive for the default option to be "Half", but that's my best guess. Any ideas?
Posted
Updated 12-Apr-16 7:21am

1 solution

Looking into the code (Reference Source[^]) I found it to be 0, which translates to Default...which same as None...
See what does in means: PixelOffsetMode enumeration (Windows)[^]
 
Share this answer
 
Comments
Richard Deeming 12-Apr-16 13:49pm    
It's not quite that simple. The code calls SafeNativeMethods.Gdip.GdipGetPixelOffsetMode, which has the mode variable as an out parameter, so the value 0 is never used.

Unfortunately, the documentation for the native GetPixelOffsetMode function is just as useless as the documentation for the PixelOffsetMode property - there's no mention of what the default value is.
Kornfeld Eliyahu Peter 12-Apr-16 15:40pm    
1. I followed the code into the GDI+ code too (using mono), and there you can see it initialized to default...https://github.com/mono/libgdiplus/blob/master/src/graphics.c - line 126
2. Even with Microsoft, an enum value not called 'Default' for nothing...
Richard Deeming 12-Apr-16 15:43pm    
Good find. :)
kingrobot 12-Apr-16 16:13pm    
So I guess I should follow up with... since the default value is ... "default" - what is the default behavior? Empirically, it doesn't seem to be "None"
Kornfeld Eliyahu Peter 12-Apr-16 16:19pm    
I never observer the behavior, but Microsoft states, that Default is the same as None...
You should follow the method, you used for the actual rendering (probably into the mono implementation) to see what the difference between the modes de facto...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900