Clear, DrawImage functions
authorAlexandre Pigolkine <pigolkine@mono-cvs.ximian.com>
Sat, 23 Aug 2003 23:40:43 +0000 (23:40 -0000)
committerAlexandre Pigolkine <pigolkine@mono-cvs.ximian.com>
Sat, 23 Aug 2003 23:40:43 +0000 (23:40 -0000)
svn path=/trunk/mcs/; revision=17538

mcs/class/System.Drawing/System.Drawing/impl/wine/ChangeLog
mcs/class/System.Drawing/System.Drawing/impl/wine/Graphics.cs

index 69506880ff7cb9ef2cca9265b824bf8ec0201b6e..5d64c7e1d603336ed260899a47aba9094547aa17 100644 (file)
@@ -1,3 +1,6 @@
+2003-08-24 Alexandre Pigolkine
+       * Graphics.cs                   Clear, DrawImage functions
+
 2003-08-23 Alexandre Pigolkine
        * Bitmap.cs                     set ImageFormat and PixelFormat in contstuctors
        * win32Enums.cs         
index 06552ba142d05c14e3d90ef86b1af1df639a4909..96e83e7f4fa1b2e1a79a11d739bd77aaef6422f5 100644 (file)
@@ -104,7 +104,18 @@ namespace System.Drawing
                        [MonoTODO]
                        void IGraphics.Clear (Color color)
                        {
-                               throw new NotImplementedException ();
+                               Size sz = new Size(0, 0);
+                               switch(type_) {
+                                       case GraphicsType.fromHwnd:
+                                               //FIXME: get window size
+                                               break;
+                                       case GraphicsType.fromHdc:
+                                               break;
+                                       case GraphicsType.fromImage:
+                                               sz = ((IImage)initializedFromImage_).Size;
+                                               break;
+                               }
+                               FillRectangle (new SolidBrush (color), 0, 0, sz.Width, sz.Height);
                        }
 
                        [MonoTODO]
@@ -370,7 +381,20 @@ namespace System.Drawing
                        [MonoTODO]
                        void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
                        {
-                               throw new NotImplementedException ();
+                               Image wineImage = ConvertImage(image);
+                               Graphics imageGraphics = wineImage.selectedIntoGraphics_;
+                               if( imageGraphics == null) {
+                                       IntPtr tempDC = Win32.CreateCompatibleDC (hdc_);
+                                       IntPtr oldBmp = Win32.SelectObject (tempDC, wineImage.nativeObject_);
+                                       Win32.StretchBlt(hdc_, destRect.X, destRect.Y, destRect.Width, destRect.Height, 
+                                               tempDC, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, PatBltTypes.SRCCOPY);
+                                       Win32.SelectObject (tempDC, oldBmp);
+                                       Win32.DeleteDC (tempDC);
+                               }
+                               else {
+                                       Win32.StretchBlt(hdc_, destRect.X, destRect.Y, destRect.Width, destRect.Height, 
+                                               imageGraphics.hdc_, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, PatBltTypes.SRCCOPY);
+                               }
                        }
 
                        [MonoTODO]