[2/3] gdiplus: GdipDrawPolygon/GdipDrawPolygonI
Nikolay Sivov
bunglehead at gmail.com
Sun Apr 20 12:27:20 CDT 2008
Changelog:
- GdipDrawPolygon/GdipDrawPolygonI implemented.
---
dlls/gdiplus/gdiplus.spec | 4 ++--
dlls/gdiplus/graphics.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
include/gdiplusflat.h | 2 ++
3 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index f2426b1..c4f7523 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -192,8 +192,8 @@
@ stdcall GdipDrawPath(ptr ptr ptr)
@ stdcall GdipDrawPie(ptr ptr long long long long long long)
@ stub GdipDrawPieI
-@ stub GdipDrawPolygon
-@ stub GdipDrawPolygonI
+@ stdcall GdipDrawPolygon(ptr ptr ptr long)
+@ stdcall GdipDrawPolygonI(ptr ptr ptr long)
@ stub GdipDrawRectangle
@ stdcall GdipDrawRectangleI(ptr ptr long long long long)
@ stdcall GdipDrawRectangles(ptr ptr ptr long)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 7356234..9ead0df 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -2122,3 +2122,47 @@ GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpGraphics *graph
return NotImplemented;
}
+
+GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics *graphics,GpPen *pen,GDIPCONST GpPointF *points,
+ INT count)
+{
+ INT save_state;
+ POINT *pti;
+
+ if(!graphics || !pen || count<=0)
+ return InvalidParameter;
+
+ pti = GdipAlloc(sizeof(POINT) * count);
+
+ save_state = prepare_dc(graphics, pen);
+ SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH));
+
+ transform_and_round_points(graphics, pti, (GpPointF*)points, count);
+ Polygon(graphics->hdc, pti, count);
+
+ restore_dc(graphics, save_state);
+ GdipFree(pti);
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipDrawPolygonI(GpGraphics *graphics,GpPen *pen,GDIPCONST GpPoint *points,
+ INT count)
+{
+ GpStatus ret;
+ GpPointF *ptf;
+ INT i;
+
+ if(count<=0) return InvalidParameter;
+ ptf = GdipAlloc(sizeof(GpPointF) * count);
+
+ for(i = 0;i < count; i++){
+ ptf[i].X = (REAL)points[i].X;
+ ptf[i].Y = (REAL)points[i].Y;
+ }
+
+ ret = GdipDrawPolygon(graphics,pen,ptf,count);
+ GdipFree(ptf);
+
+ return ret;
+}
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 215864a..3d5a6d4 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -94,6 +94,8 @@ GpStatus WINGDIPAPI GdipDrawLinesI(GpGraphics*,GpPen*,GDIPCONST GpPoint*,INT);
GpStatus WINGDIPAPI GdipDrawPath(GpGraphics*,GpPen*,GpPath*);
GpStatus WINGDIPAPI GdipDrawPie(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL);
GpStatus WINGDIPAPI GdipDrawPieI(GpGraphics*,GpPen*,INT,INT,INT,INT,REAL,REAL);
+GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics*,GpPen*,GDIPCONST GpPointF*, INT);
+GpStatus WINGDIPAPI GdipDrawPolygonI(GpGraphics*,GpPen*,GDIPCONST GpPoint*, INT);
GpStatus WINGDIPAPI GdipDrawRectangle(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL);
GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics*,GpPen*,INT,INT,INT,INT);
GpStatus WINGDIPAPI GdipDrawRectangles(GpGraphics*,GpPen*,GDIPCONST GpRectF*,INT);
--
1.4.4.4
More information about the wine-patches
mailing list