[GDI+ implementation: 2/8] GdipDrawRectangleI

Evan Stade estade at gmail.com
Tue Jun 12 12:51:20 CDT 2007


On 6/12/07, Evan Stade <estade at gmail.com> wrote:
> Hi,
>
> Changelog:
> *implemented GdipDrawRectangleI
>
>  dlls/gdiplus/gdiplus.spec |    2 +-
>  dlls/gdiplus/graphics.c   |   32 ++++++++++++++++++++++++++++++++
>  2 files changed, 33 insertions(+), 1 deletions(-)
>
> -Evan Stade
>

attached
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index f19a26d..dfb4e63 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -184,7 +184,7 @@
 @ stub GdipDrawPolygon
 @ stub GdipDrawPolygonI
 @ stub GdipDrawRectangle
-@ stub GdipDrawRectangleI
+@ stdcall GdipDrawRectangleI(ptr ptr long long long long)
 @ stub GdipDrawRectangles
 @ stub GdipDrawRectanglesI
 @ stub GdipDrawString
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 642fde2..d2a4317 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -81,3 +81,35 @@ GpStatus WINGDIPAPI GdipDrawLineI(GpGrap
 
     return Ok;
 }
+
+GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x, 
+    INT y, INT width, INT height)
+{
+    LOGBRUSH lb;
+    HPEN hpen;
+    HGDIOBJ old_obj;
+
+    if(!pen || !graphics)
+        return InvalidParameter;
+
+    lb.lbStyle = BS_SOLID;
+    lb.lbColor = pen->color;
+    lb.lbHatch = 0;
+
+    hpen = ExtCreatePen(PS_GEOMETRIC | PS_ENDCAP_SQUARE, (INT) pen->width, 
+        &lb, 0, NULL);
+
+    old_obj = SelectObject(graphics->hdc, hpen);
+
+    /* assume pen aligment centered */
+    MoveToEx(graphics->hdc, x, y, NULL);
+    LineTo(graphics->hdc, x+width, y);
+    LineTo(graphics->hdc, x+width, y+height);
+    LineTo(graphics->hdc, x, y+height);
+    LineTo(graphics->hdc, x, y);
+
+    SelectObject(graphics->hdc, old_obj);
+    DeleteObject(hpen);
+
+    return Ok;
+}
-- 
1.4.1


More information about the wine-patches mailing list