[Mono-bugs] [Bug 57323][Blo] New - Cannot draw one image onto another using Graphics.DrawImage

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 21 Apr 2004 04:46:03 -0400 (EDT)


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 eto@shaw.ca.

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

--- shadow/57323	2004-04-21 04:46:03.000000000 -0400
+++ shadow/57323.tmp.25660	2004-04-21 04:46:03.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 57323
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: gentoo, kernel 2.6.5
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: Sys.Drawing.
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: eto@shaw.ca               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Cannot draw one image onto another using Graphics.DrawImage
+
+Description of Problem: 
+Cannot draw one image onto another using Graphics.DrawImage 
+ 
+Steps to reproduce the problem: 
+1. Create a new Bitmap and draw something on it 
+2. Create another blank Bitmap, and use Graphics.FromImage()  
+3. use Graphics.DrawImage to draw the first bitmap onto the second bitmap 
+ 
+Actual Results: 
+CRITICAL **: file image.c: line 152 (GdipDrawImageRect): assertion 
+`image->surface != NULL' failed 
+ 
+Expected Results: 
+First bitmap is drawn on the second bitmap 
+ 
+How often does this happen?  
+every time 
+ 
+Additional Information: 
+A 'workaround' is to use Graphics.FromImage() to get a Graphics object on 
+the first bitmap as well, but this should not be needed. (found this out 
+by looking at the code).  Apparently, the cairo surface for an image is 
+only created when a graphics object is associated with it.  However, you 
+should be able to draw an image that isn't associated with a graphics 
+object onto any graphics object. 
+ 
+Here's the source snippet: 
+ 
+Bitmap source = new Bitmap(100, 100, PixelFormat.Format32bppArgb); 
+// draw to source bitmap directly using LockBits(), or other method 
+Bitmap dest = new Bitmap(500, 500, PixelFormat.Format32bppArgb); 
+Graphics g = Graphics.FromImage(dest); 
+g.DrawImage(source, new Rectangle(10,10,50,50)); // draw half the size