[Mono-bugs] [Bug 80971][Nor] Changed - Texture brush does not paint anything

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Feb 27 09:15:40 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by sebastien at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80971

--- shadow/80971	2007-02-26 22:05:18.000000000 -0500
+++ shadow/80971.tmp.28449	2007-02-27 09:15:40.000000000 -0500
@@ -3,15 +3,15 @@
 Version: 1.2
 OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
 Severity: Unknown
-Priority: Wishlist
-Component: Sys.Drawing.
-AssignedTo: mono-bugs at ximian.com                            
+Priority: Normal
+Component: libgdiplus
+AssignedTo: sebastien at ximian.com                            
 ReportedBy: mitcheloc at gmail.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
 Summary: Texture brush does not paint anything
@@ -40,6 +40,105 @@
 
 
 ------- Additional Comments From sebastien at ximian.com  2007-02-26 22:05 -------
 <mitcheloc> oooh, it looks so pretty running mono on windows, no
 painting bugs! :)
 <spouliot> mitcheloc: then it's a libgdiplus bug
+
+------- Additional Comments From sebastien at ximian.com  2007-02-27 09:15 -------
+As a temporary workaround using a bitmap of the "right" size (instead
+of the overloaded TextureBrush) seems to work correctly on Mono.
+
+Here's a simpler version of the sample... (still need the original
+skin.jpg)
+
+using System;
+using System.Drawing;
+
+using System.Windows.Forms;
+
+
+
+namespace MonoBug
+
+{
+     public class Form1 : Form
+
+     {
+
+          public Form1()
+
+          {
+
+               this.SuspendLayout();
+
+               this.ClientSize = new System.Drawing.Size(389, 302);
+
+               this.Name = "Form1";
+
+               this.Text = "Form1";
+
+               this.ResumeLayout(false);
+
+          }
+
+
+         protected override void Dispose(bool disposing)
+
+          {
+
+               base.Dispose(disposing);
+
+          }
+
+
+
+          protected override void OnPaint(PaintEventArgs e)
+
+          {
+
+               string LocalBasePath       =
+System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
+
+               LocalBasePath       = LocalBasePath.Substring(0,
+LocalBasePath.LastIndexOf("\\") + 1);
+
+               LocalBasePath       = LocalBasePath.Substring(0,
+LocalBasePath.LastIndexOf("/") + 1);
+// original
+
+//               Image        skin   = Image.FromFile(LocalBasePath +
+"skin.jpg");
+//               TextureBrush tb     = new TextureBrush(skin, new
+Rectangle(73, 0, 1, 27));
+
+// using bitmap + clone
+		Bitmap bmp = new Bitmap (LocalBasePath + "skin.jpg");
+		Bitmap skin = bmp.Clone (new Rectangle(73, 0, 1, 27), bmp.PixelFormat);
+             TextureBrush tb     = new TextureBrush(skin);
+
+
+
+               e.Graphics.FillRectangle(tb, new Rectangle(0, 0, Width,
+27));
+
+               base.OnPaint(e);
+
+          }
+
+
+          [STAThread]
+
+          static void Main()
+
+          {
+
+               Application.EnableVisualStyles();
+
+               Application.Run(new Form1());
+
+          }
+
+     }
+
+}
+


More information about the mono-bugs mailing list