[GDI+: 7/7] implemented GdipDrawImage

Evan Stade estade at gmail.com
Wed Jun 13 18:41:53 CDT 2007


Hi,

changelog:
*implemented GdipDrawImage

 dlls/gdiplus/gdiplus.spec |    2 +-
 dlls/gdiplus/graphics.c   |   28 ++++++++++++++++++++++++++++
 include/gdiplusflat.h     |    1 +
 3 files changed, 30 insertions(+), 1 deletions(-)

-Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index bb78e1d..b6712ca 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -162,7 +162,7 @@
 @ stub GdipDrawDriverString
 @ stub GdipDrawEllipse
 @ stub GdipDrawEllipseI
-@ stub GdipDrawImage
+@ stdcall GdipDrawImage(ptr ptr long long)
 @ stub GdipDrawImageI
 @ stub GdipDrawImagePointRect
 @ stub GdipDrawImagePointRectI
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 6f3c09a..f59456e 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -240,6 +240,34 @@ GpStatus WINGDIPAPI GdipDrawCurve2(GpGra
     return Ok;
 }
 
+GpStatus WINGDIPAPI GdipDrawImageI(GpGraphics *graphics, GpImage *image, INT x,
+    INT y)
+{
+    HDC temp_hdc;
+
+    if(!graphics || !image)
+        return InvalidParameter;
+
+    temp_hdc = CreateCompatibleDC(graphics->hdc);
+
+    /* FIXME: use GetLastError for more error details */
+    if(!temp_hdc)
+        return GenericError;
+
+    SelectObject(temp_hdc, image->bmp);
+
+    BitBlt(graphics->hdc,
+            x, y,
+            image->bmi.bmiHeader.biWidth, image->bmi.bmiHeader.biHeight,
+            temp_hdc,
+            0, 0,
+            SRCCOPY);
+
+    DeleteObject(temp_hdc);
+
+    return Ok;
+}
+
 GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1,
     INT y1, INT x2, INT y2)
 {
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index bddfa44..1cba4ec 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -37,6 +37,7 @@ GpStatus WINGDIPAPI GdipDrawArc(GpGraphi
 GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,
     REAL,REAL,REAL);
 GpStatus WINGDIPAPI GdipDrawCurve2(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT,REAL);
+GpStatus WINGDIPAPI GdipDrawImageI(GpGraphics*,GpImage*,INT x,INT y);
 GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics*,GpPen*,INT,INT,INT,INT);
 GpStatus WINGDIPAPI GdipDrawPie(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL);
 GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics*,GpPen*,INT,INT,INT,INT);
-- 
1.4.1


More information about the wine-patches mailing list