[Mono-list] Weirdness with System.Drawing on Mono/Linux
Stifu
stifu at free.fr
Thu Aug 11 12:44:29 EDT 2011
It sounds like CompositingMode.SourceCopy not only turns off alpha blending,
but also transparency, with Mono. It's most likely a bug.
I could be wrong, but I don't think anyone in the Mono team really maintains
System.Drawing or GDI+ anymore. So if this bug matters to you, I suggest you
try to fix it yourself in Mono and submit a patch.
JamesWright wrote:
>
> I'm simply clearing an image to White and drawing a scaled image, which
> works fine until I use CompositingMode.SourceCopy (which should be faster
> as it turns off alpha-blending).
>
> e.g.
> Bitmap bitmap = new Bitmap(800, 600);
> using (Graphics graphics = Graphics.FromImage(bitmap ))
> {
> graphics.CompositingMode = CompositingMode.SourceCopy;
> graphics.InterpolationMode = InterpolationMode.Default;
> graphics.Clear(Color.White);
> graphics.DrawImage(sourceImage, 0, 0, 400, 400);
> }
>
> On Windows/.NET I get the image scaled down with a white background,
> however with Linux/Mono I get a black background with the image scaled
> down. I think the DrawImage() call is overwriting the entire background so
> the initial Clear() is useless?
>
> mono-addon-core-2.10.2-5.1.i386.rpm
> mono-addon-libgdiplus0-2.10-6.2.i386.rpm
>
> Is this a known problem, or is my code incorrect? For now I've commented
> out the 'graphics.CompositingMode = CompositingMode.SourceCopy;' line
> which works around the issue.
>
>
> Thanks,
> James
>
--
View this message in context: http://mono.1490590.n4.nabble.com/Weirdness-with-System-Drawing-on-Mono-Linux-tp3736377p3736401.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list