mono / libgdiplus

C-based implementation of the GDI+ API
http://www.mono-project.com/
MIT License
334 stars 171 forks source link

Fix comparison for color keying when applying image attributes #641

Closed filipnavara closed 4 years ago

filipnavara commented 4 years ago

Fixes https://github.com/mono/mono/issues/8514

sancheolz commented 4 years ago

Thank you. Looks better. Now the icons have a white background. In Windows background transparent Here is an example toolbar from windows winToolbar Here mono master & libgdiplus master monoMasterGDI Here mono master & libgdiplus master with this patch monoPatchedGDI Here res file with fifth icon in the last screenshot Plans.zip I get it from the resource with the following code

                    Bitmap bmp =
                    new Bitmap(
                        Assembly.GetExecutingAssembly().GetManifestResourceStream(
                            "MyProject.Images.Plans.bmp"));
                var rect = new Rectangle(0, 0, bmp.Height, bmp.Height);
                return bmp.Clone(rect, bmp.PixelFormat);

It has Color depth = 4 The fourth icon in the last screenshot has a color depth = 8 both bmp format icons

filipnavara commented 4 years ago

@sancheolz It could be related to the FIXME in the code: https://github.com/mono/libgdiplus/blob/8411dce64028204a84d16dc001e6c057fa5ffb3d/src/imageattributes.c#L341-L344 or entirely different issue altogether.

These code paths definitely needs more testing and test coverage. This particular PR fixes just a regression from PR #567.