Evan Stade : gdiplus: Added solid-color path gradient brush implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 2 06:23:11 CDT 2007


Module: wine
Branch: master
Commit: f18cdef727d34d4428d2cef01b151e555f5be25a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f18cdef727d34d4428d2cef01b151e555f5be25a

Author: Evan Stade <estade at gmail.com>
Date:   Wed Aug  1 17:56:02 2007 -0700

gdiplus: Added solid-color path gradient brush implementation.

---

 dlls/gdiplus/brush.c           |   26 ++++++++++++++++++++++++++
 dlls/gdiplus/gdiplus.spec      |    2 +-
 dlls/gdiplus/gdiplus_private.h |    5 +++++
 include/gdiplusflat.h          |    2 ++
 include/gdiplusgpstubs.h       |    4 +++-
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index ce01ccb..da432fd 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -23,6 +23,9 @@
 
 #include "gdiplus.h"
 #include "gdiplus_private.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
 
 GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
 {
@@ -45,6 +48,29 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
     return Ok;
 }
 
+/* FIXME: path gradient brushes not truly supported (drawn as solid brushes) */
+GpStatus WINGDIPAPI GdipCreatePathGradientFromPath(GDIPCONST GpPath* path,
+    GpPathGradient **grad)
+{
+    COLORREF col = ARGB2COLORREF(0xffffffff);
+
+    if(!path || !grad)
+        return InvalidParameter;
+
+    *grad = GdipAlloc(sizeof(GpPathGradient));
+    if (!*grad) return OutOfMemory;
+
+    (*grad)->brush.lb.lbStyle = BS_SOLID;
+    (*grad)->brush.lb.lbColor = col;
+    (*grad)->brush.lb.lbHatch = 0;
+
+    (*grad)->brush.gdibrush = CreateSolidBrush(col);
+    (*grad)->brush.bt = BrushTypeSolidColor;
+    (*grad)->centercolor = 0xffffffff;
+
+    return Ok;
+}
+
 GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
 {
     COLORREF col = ARGB2COLORREF(color);
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 871a9c4..8dcc155 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -117,7 +117,7 @@
 @ stub GdipCreatePath2I
 @ stdcall GdipCreatePath(long ptr)
 @ stub GdipCreatePathGradient
-@ stub GdipCreatePathGradientFromPath
+@ stdcall GdipCreatePathGradientFromPath(ptr ptr)
 @ stub GdipCreatePathGradientI
 @ stdcall GdipCreatePathIter(ptr ptr)
 @ stdcall GdipCreatePen1(long long long ptr)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 168f6ff..1a868cf 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -92,6 +92,11 @@ struct GpSolidFill{
     ARGB color;
 };
 
+struct GpPathGradient{
+    GpBrush brush;
+    ARGB centercolor;
+};
+
 struct GpPath{
     GpFillMode fill;
     GpPathData pathdata;
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 25b9b1b..c04fef6 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -88,6 +88,8 @@ GpStatus WINGDIPAPI GdipSetSmoothingMode(GpGraphics*,SmoothingMode);
 GpStatus WINGDIPAPI GdipSetWorldTransform(GpGraphics*,GpMatrix*);
 
 GpStatus WINGDIPAPI GdipCloneBrush(GpBrush*,GpBrush**);
+GpStatus WINGDIPAPI GdipCreatePathGradientFromPath(GDIPCONST GpPath*,
+    GpPathGradient**);
 GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB,GpSolidFill**);
 GpStatus WINGDIPAPI GdipGetBrushType(GpBrush*,GpBrushType*);
 GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush*);
diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h
index fec691a..6ca0073 100644
--- a/include/gdiplusgpstubs.h
+++ b/include/gdiplusgpstubs.h
@@ -24,7 +24,7 @@
 class GpGraphics {};
 class GpGraphics {};
 class GpBrush {};
-class GpSolidFill {};
+class GpSolidFill : public GpBrush {};
 class GpPath {};
 class GpMatrix {};
 class GpPathIterator {};
@@ -33,6 +33,7 @@ class GpImage {};
 class GpMetafile : public GpImage {};
 class GpImageAttributes {};
 class GpBitmap : public GpImage {};
+class GpPathGradient : public GpBrush {};
 
 #else /* end of c++ declarations */
 
@@ -48,6 +49,7 @@ typedef struct GpImage GpImage;
 typedef struct GpMetafile GpMetafile;
 typedef struct GpImageAttributes GpImageAttributes;
 typedef struct GpBitmap GpBitmap;
+typedef struct GpPathGradient GpPathGradient;
 
 #endif /* end of c declarations */
 




More information about the wine-cvs mailing list