[Mono-bugs] [Bug 430577] New: DrawImage does not draw correctly when the start position is not (0, 0)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Sep 29 06:42:06 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=430577


           Summary: DrawImage does not draw correctly when the start
                    position is not (0,0)
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: libgdiplus
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: atsushi at ximian.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User


Created an attachment (id=242197)
 --> (https://bugzilla.novell.com/attachment.cgi?id=242197)
test results (png)

When an image is written to a rectangle by DrawImage(), it does not draw
correctly when the start position is not (0,0).

Repro:

using System;
using System.Drawing;
using System.Windows.Forms;

class Test : Form
{
 public static void Main()
 {
     Application.Run(new Test { ClientSize = new Size(128, 128) });
 }

 protected override void OnPaint(PaintEventArgs e)
 {
   var dst = new Rectangle(20, 20, 50, 50);
   var px = GraphicsUnit.Pixel;
   var bmp = new Bitmap(32, 32);
   var g = Graphics.FromImage(bmp);
   g.Clear(Color.Black);
   e.Graphics.DrawImage(bmp, dst, new Rectangle(0, 0, 100, 100), px);
   g.Clear(Color.Red);
   e.Graphics.DrawImage(bmp, dst, new Rectangle(-16, -16, 100, 100), px);
   g.Clear(Color.Blue);
   e.Graphics.DrawImage(bmp, dst, new Rectangle(16, 16, 100, 100), px);
   g.Dispose();
   bmp.Dispose();
 }
} 

Attached repro output.


-- 
Configure bugmail: https://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