mono / libgdiplus

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

Add unit test for GdipDrawImageRectRectI #674

Open qmfrederik opened 3 years ago

qmfrederik commented 3 years ago

This adds a unit test for GdipDrawImageRectRectI. It will resize a white rectangle and draw it on top of a black image, and asserts that the result is (more or less) white.

qmfrederik commented 3 years ago

I created this test because some of my code started failing when being used with libgdiplus 6.0.4 (which is the default on Ubuntu 20.04 and later).

The libgdiplus 6.0 behavior differs from what GDI+ does (and libgdiplus < 6.0) when you use PixelFormat32bppARGB. I didn't dig deeper into that, as the images which I'm drawing don't have alpha channels and the fix was to just use the RGB pixel format instead of ARGB.

But I did came up with this unit test, and thought it'd be a good addition to the test suite, anyway ;-).