[Mono-list] Weirdness with System.Drawing on Mono/Linux

JamesWright james.wright at jigsawdezign.com
Thu Aug 11 12:36:27 EDT 2011


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-tp3736377p3736377.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list