From d020474cb55acaee8812cb2f3b90fdee6319b4ae Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 3 Jul 2008 03:04:50 +0400 Subject: [PATCH] gdiplus: Implemented GdipDrawBeziers. --- dlls/gdiplus/gdiplus.spec | 4 ++-- dlls/gdiplus/graphics.c | 48 +++++++++++++++++++++++++++++++++++++++ include/gdiplusflat.h | 2 ++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index d108b4e04f0..17c1b4c3175 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -156,8 +156,8 @@ @ stdcall GdipDrawArcI(ptr ptr long long long long long long) @ stdcall GdipDrawBezier(ptr ptr long long long long long long long long) @ stdcall GdipDrawBezierI(ptr ptr long long long long long long long long) -@ stub GdipDrawBeziers -@ stub GdipDrawBeziersI +@ stdcall GdipDrawBeziers(ptr ptr ptr long) +@ stdcall GdipDrawBeziersI(ptr ptr ptr long) @ stub GdipDrawCachedBitmap @ stub GdipDrawClosedCurve2 @ stub GdipDrawClosedCurve2I diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index c274b2e00fb..6c9aa15318d 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -997,6 +997,54 @@ GpStatus WINGDIPAPI GdipDrawBezierI(GpGraphics *graphics, GpPen *pen, INT x1, return retval; } +GpStatus WINGDIPAPI GdipDrawBeziers(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPointF *points, INT count) +{ + INT i; + GpStatus ret; + + if(!graphics || !pen || !points || (count <= 0)) + return InvalidParameter; + + for(i = 0; i < floor(count / 4); i++){ + ret = GdipDrawBezier(graphics, pen, + points[4*i].X, points[4*i].Y, + points[4*i + 1].X, points[4*i + 1].Y, + points[4*i + 2].X, points[4*i + 2].Y, + points[4*i + 3].X, points[4*i + 3].Y); + if(ret != Ok) + return ret; + } + + return Ok; +} + +GpStatus WINGDIPAPI GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPoint *points, INT count) +{ + GpPointF *pts; + GpStatus ret; + INT i; + + if(!graphics || !pen || !points || (count <= 0)) + return InvalidParameter; + + pts = GdipAlloc(sizeof(GpPointF) * count); + if(!pts) + return OutOfMemory; + + for(i = 0; i < count; i++){ + pts[i].X = (REAL)points[i].X; + pts[i].Y = (REAL)points[i].Y; + } + + ret = GdipDrawBeziers(graphics,pen,pts,count); + + GdipFree(pts); + + return ret; +} + GpStatus WINGDIPAPI GdipDrawCurve(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count) { diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 9799296534c..fdcdeda0e67 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -78,6 +78,8 @@ GpStatus WINGDIPAPI GdipDrawArc(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL GpStatus WINGDIPAPI GdipDrawArcI(GpGraphics*,GpPen*,INT,INT,INT,INT,REAL,REAL); GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipDrawBezierI(GpGraphics*,GpPen*,INT,INT,INT,INT,INT,INT,INT,INT); +GpStatus WINGDIPAPI GdipDrawBeziers(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT); +GpStatus WINGDIPAPI GdipDrawBeziersI(GpGraphics*,GpPen*,GDIPCONST GpPoint*,INT); GpStatus WINGDIPAPI GdipDrawCurve(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT); GpStatus WINGDIPAPI GdipDrawCurveI(GpGraphics*,GpPen*,GDIPCONST GpPoint*,INT); GpStatus WINGDIPAPI GdipDrawCurve2(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT,REAL);