[GDI+ implementation: 7/8] GdipDrawBezier

Evan Stade estade at gmail.com
Tue Jun 12 13:00:03 CDT 2007


Hi,

Changelog:
*Implemented GdipDrawBezier

 dlls/gdiplus/gdiplus.spec |    2 +-
 dlls/gdiplus/graphics.c   |   19 ++++++++++++++
 include/gdiplusflat.h     |    2 ++
 include/gdiplustypes.h    |   60 ++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 81 insertions(+), 2 deletions(-)

-Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index b7fb180..40a8c19 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -144,7 +144,7 @@
 @ stub GdipDisposeImageAttributes
 @ stdcall GdipDrawArc(ptr ptr long long long long long long)
 @ 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 4745d20..bd968ad 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -207,3 +207,22 @@ GpStatus WINGDIPAPI GdipDrawArc(GpGraphi
 
     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;
+}
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 8a3a0ee..c7cbfa7 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -36,6 +36,8 @@ GpStatus WINGDIPAPI GdipDrawRectangleI(G
 GpStatus WINGDIPAPI GdipFillPie(GpGraphics*,GpBrush*,REAL,REAL,REAL,REAL,REAL,REAL);
 GpStatus WINGDIPAPI GdipDrawPie(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL);
 GpStatus WINGDIPAPI GdipDrawArc(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL);
+GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,
+    REAL,REAL,REAL);
 
 GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB,GpSolidFill**);
 GpStatus WINGDIPAPI GdipGetBrushType(GpBrush*,GpBrushType*);
diff --git a/include/gdiplustypes.h b/include/gdiplustypes.h
index 006fe09..f4b389d 100644
--- a/include/gdiplustypes.h
+++ b/include/gdiplustypes.h
@@ -45,7 +45,65 @@ enum Status{
     PropertyNotSupported        = 20
 };
 
-#ifndef __cplusplus
+#ifdef __cplusplus
+
+class Point
+{
+public:
+   Point()
+   {
+       X = Y = 0;
+   }
+
+   Point(IN const Point &point)
+   {
+       X = point.X;
+       Y = point.Y;
+   }
+
+   Point(IN const Size &size)
+   {
+       X = size.Width;
+       Y = size.Height;
+   }
+
+   Point(IN INT x,
+         IN INT y)
+   {
+       X = x;
+       Y = y;
+   }
+
+   Point operator+(IN const Point& point) const
+   {
+       return Point(X + point.X,
+                    Y + point.Y);
+   }
+
+   Point operator-(IN const Point& point) const
+   {
+       return Point(X - point.X,
+                    Y - point.Y);
+   }
+
+   BOOL Equals(IN const Point& point)
+   {
+       return (X == point.X) && (Y == point.Y);
+   }
+
+public:
+
+    INT X;
+    INT Y;
+};
+
+#else /* end of c++ typedefs */
+
+typedef struct Point
+{
+    INT X;
+    INT Y;
+} Point;
 
 typedef enum Status Status;
 
-- 
1.4.1


More information about the wine-patches mailing list