gdiplus: GdipDrawBezier [try4]

Evan Stade estade at gmail.com
Fri Jun 15 23:27:38 CDT 2007


Hi,

[try4]: last time I forgot to include the update to the spec file

changelog:
*implemented GdipDrawBezier

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

-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index c7a4dc1..483c3f4 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -144,7 +144,7 @@
 @ stub GdipDisposeImageAttributes
 @ stub GdipDrawArc
 @ stub GdipDrawArcI
-@ stub GdipDrawBezier
+@ stdcall GdipDrawBezier(ptr ptr long long long long long long long long)
 @ stub GdipDrawBezierI
 @ stub GdipDrawBeziers
 @ stub GdipDrawBeziersI
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 674bede..b45293f 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -27,6 +27,11 @@
 #include "gdiplus_private.h"
 #include "wine/debug.h"
 
+static inline INT roundr(REAL x)
+{
+    return (INT) floor(x+0.5);
+}
+
 GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
 {
     if(hdc == NULL)
@@ -66,6 +71,25 @@ GpStatus WINGDIPAPI GdipDeleteGraphics(G
     return Ok;
 }
 
+GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics *graphics, GpPen *pen, REAL x1,
+    REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4)
+{
+    HGDIOBJ old_pen;
+    POINT pt[4] = {{roundr(x1), roundr(y1)}, {roundr(x2), roundr(y2)},
+                   {roundr(x3), roundr(y3)}, {roundr(x4), roundr(y4)}};
+
+    if(!graphics || !pen)
+        return InvalidParameter;
+
+    old_pen = SelectObject(graphics->hdc, pen->gdipen);
+
+    PolyBezier(graphics->hdc, pt, 4);
+
+    SelectObject(graphics->hdc, old_pen);
+
+    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 7ccae0f..3220cb2 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -31,6 +31,8 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen*
 GpStatus WINGDIPAPI GdipCreateFromHDC(HDC,GpGraphics**);
 GpStatus WINGDIPAPI GdipCreateFromHWND(HWND,GpGraphics**);
 GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *);
+GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,
+    REAL,REAL,REAL);
 GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics*,GpPen*,INT,INT,INT,INT);
 GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics*,GpPen*,INT,INT,INT,INT);
 GpStatus WINGDIPAPI GdipFillPie(GpGraphics*,GpBrush*,REAL,REAL,REAL,REAL,REAL,REAL);
-- 
1.4.3.4


More information about the wine-patches mailing list