Module: wine Branch: master Commit: 14802872b876581fc895f5310e120f83b88b58dd URL: http://source.winehq.org/git/wine.git/?a=commit;h=14802872b876581fc895f5310e...
Author: Evan Stade estade@gmail.com Date: Thu Jun 21 16:15:17 2007 -0700
gdiplus: Implemented GdipCreatePath and GdipDeletePath.
---
dlls/gdiplus/Makefile.in | 1 + dlls/gdiplus/gdiplus.spec | 4 +- dlls/gdiplus/gdiplus_private.h | 7 ++++ dlls/gdiplus/graphicspath.c | 69 ++++++++++++++++++++++++++++++++++++++++ include/gdiplusenums.h | 7 ++++ include/gdiplusflat.h | 3 ++ include/gdiplusgpstubs.h | 4 ++ include/gdiplustypes.h | 40 +++++++++++++++++++++++ 8 files changed, 133 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in index b2bd0c4..1194fc0 100644 --- a/dlls/gdiplus/Makefile.in +++ b/dlls/gdiplus/Makefile.in @@ -10,6 +10,7 @@ C_SRCS = \ brush.c \ gdiplus.c \ graphics.c \ + graphicspath.c \ pen.c
@MAKE_DLL_RULES@ diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index db9dd46..5ca2b0f 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -106,7 +106,7 @@ @ stub GdipCreateMetafileFromWmfFile @ stub GdipCreatePath2 @ stub GdipCreatePath2I -@ stub GdipCreatePath +@ stdcall GdipCreatePath(long ptr) @ stub GdipCreatePathGradient @ stub GdipCreatePathGradientFromPath @ stub GdipCreatePathGradientI @@ -134,7 +134,7 @@ @ stub GdipDeleteFontFamily @ stdcall GdipDeleteGraphics(ptr) @ stub GdipDeleteMatrix -@ stub GdipDeletePath +@ stdcall GdipDeletePath(ptr) @ stub GdipDeletePathIter @ stdcall GdipDeletePen(ptr) @ stub GdipDeletePrivateFontCollection diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 6cb2e43..e221044 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -49,4 +49,11 @@ struct GpSolidFill{ GpBrush brush; };
+struct GpPath{ + GpFillMode fill; + GpGraphics* graphics; + GpPathData pathdata; + BOOL newfigure; /* whether the next drawing action starts a new figure */ +}; + #endif diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c new file mode 100644 index 0000000..13a14cf --- /dev/null +++ b/dlls/gdiplus/graphicspath.c @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +#include <stdarg.h> +#include <math.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "gdiplus.h" +#include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); + +GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path) +{ + HDC hdc; + GpStatus ret; + + if(!path) + return InvalidParameter; + + *path = GdipAlloc(sizeof(GpSolidFill)); + if(!*path) return OutOfMemory; + + hdc = GetDC(0); + + (*path)->fill = fill; + (*path)->newfigure = TRUE; + + ret = GdipCreateFromHDC(hdc, &((*path)->graphics)); + + if(ret != Ok){ + ReleaseDC(0, hdc); + GdipFree(*path); + } + + return ret; +} + +GpStatus WINGDIPAPI GdipDeletePath(GpPath *path) +{ + if(!path || !(path->graphics)) + return InvalidParameter; + + ReleaseDC(0, path->graphics->hdc); + GdipDeleteGraphics(path->graphics); + GdipFree(path); + + return Ok; +} diff --git a/include/gdiplusenums.h b/include/gdiplusenums.h index d3cc5d2..c6b5f15 100644 --- a/include/gdiplusenums.h +++ b/include/gdiplusenums.h @@ -39,10 +39,17 @@ enum BrushType BrushTypeLinearGradient = 4 };
+enum FillMode +{ + FillModeAlternate = 0, + FillModeWinding = 1 +}; + #ifndef __cplusplus
typedef enum Unit Unit; typedef enum BrushType BrushType; +typedef enum FillMode FillMode;
#endif /* end of c typedefs */
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 93905fd..78db330 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -47,6 +47,9 @@ GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB,GpSolidFill**); GpStatus WINGDIPAPI GdipGetBrushType(GpBrush*,GpBrushType*); GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush*);
+GpStatus WINGDIPAPI GdipCreatePath(GpFillMode,GpPath**); +GpStatus WINGDIPAPI GdipDeletePath(GpPath*); + #ifdef __cplusplus } #endif diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h index 727ca06..6e283d8 100644 --- a/include/gdiplusgpstubs.h +++ b/include/gdiplusgpstubs.h @@ -25,6 +25,7 @@ class GpGraphics {}; class GpGraphics {}; class GpBrush {}; class GpSolidFill {}; +class GpPath {};
#else /* end of c++ declarations */
@@ -32,6 +33,7 @@ typedef struct GpGraphics GpGraphics; typedef struct GpPen GpPen; typedef struct GpBrush GpBrush; typedef struct GpSolidFill GpSolidFill; +typedef struct GpPath GpPath;
#endif /* end of c declarations */
@@ -39,5 +41,7 @@ typedef Status GpStatus; typedef Unit GpUnit; typedef BrushType GpBrushType; typedef PointF GpPointF; +typedef FillMode GpFillMode; +typedef PathData GpPathData;
#endif diff --git a/include/gdiplustypes.h b/include/gdiplustypes.h index 38fdf58..5810412 100644 --- a/include/gdiplustypes.h +++ b/include/gdiplustypes.h @@ -89,6 +89,39 @@ public: REAL Y; };
+class PathData +{ +public: + PathData() + { + Count = 0; + Points = NULL; + Types = NULL; + } + + ~PathData() + { + if (Points != NULL) + { + delete Points; + } + + if (Types != NULL) + { + delete Types; + } + } + +private: + PathData(const PathData &); + PathData& operator=(const PathData &); + +public: + INT Count; + PointF* Points; + BYTE* Types; +}; + #else /* end of c++ typedefs */
typedef struct PointF @@ -97,6 +130,13 @@ typedef struct PointF REAL Y; } PointF;
+typedef struct PathData +{ + INT Count; + PointF* Points; + BYTE* Types; +} PathData; + typedef enum Status Status;
#endif /* end of c typedefs */