[Mono-bugs] [Bug 504792] DrawImage works incorrectly with CompositingMode.SourceCopy
    bugzilla_noreply at novell.com 
    bugzilla_noreply at novell.com
       
    Tue May 19 10:09:37 EDT 2009
    
    
  
http://bugzilla.novell.com/show_bug.cgi?id=504792
User alexander.shulgin at yessoftware.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=504792#c3
--- Comment #3 from Alex Shulgin <alexander.shulgin at yessoftware.com>  2009-05-19 08:09:36 MDT ---
Created an attachment (id=293037)
 --> (http://bugzilla.novell.com/attachment.cgi?id=293037)
The results of running new sample code on Windows and Linux (see corresp.
directories).
Improved sample code (you can use image.png from attachment):
using System;
using System.Drawing;
namespace Sample
{
    public class Program
    {
        public static void Main()
        {
            Bitmap canvas = new Bitmap(100, 100);
            Bitmap block = new Bitmap(50, 50);
            using (Graphics g = Graphics.FromImage(block))
            {
                g.Clear(Color.Red);
            }
            Image img = Image.FromFile("image.png");
            using (Graphics g = Graphics.FromImage(canvas))
            {
                g.CompositingMode =
System.Drawing.Drawing2D.CompositingMode.SourceCopy;
                g.Clear(Color.White);
                g.DrawImage(block, 20, 20);
                canvas.Save("block.png");
                g.Clear(Color.White);
                g.DrawImage(img, 20, 20, 60, 70);
                canvas.Save("rect.png");
                g.Clear(Color.White);
                Point[] pts = { new Point(20, 20), new Point(80, 30), new
Point(20, 70) };
                g.DrawImage(img, pts);
                canvas.Save("points.png");
                g.Clear(Color.White);
                g.DrawImage(img, new Rectangle(20, 20, 60, 60),
                            new Rectangle(10, 10, img.Width - 20, img.Height -
20),
                            GraphicsUnit.Pixel);
                canvas.Save("rectrect.png");
            }
        }
    }
}
-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
    
    
More information about the mono-bugs
mailing list