Evan Stade : gdiplus: Added GdipSetPenLineJoin.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 13 08:30:14 CDT 2007


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

Author: Evan Stade <estade at gmail.com>
Date:   Thu Jul 12 19:42:47 2007 -0700

gdiplus: Added GdipSetPenLineJoin.

---

 dlls/gdiplus/gdiplus_private.h |    2 ++
 dlls/gdiplus/pen.c             |   40 ++++++++++++++++++++++++++++++++++++++++
 include/gdiplusenums.h         |    9 +++++++++
 include/gdiplusflat.h          |    1 +
 include/gdiplusgpstubs.h       |    1 +
 5 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 7b7ec62..1a2d67c 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -47,6 +47,8 @@ struct GpPen{
     REAL width;
     HPEN gdipen;
     GpLineCap endcap;
+    GpLineJoin join;
+    REAL miterlimit;
 };
 
 struct GpGraphics{
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 52515d5..a4894d3 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -27,6 +27,22 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
 
+static DWORD gdip_to_gdi_join(GpLineJoin join)
+{
+    switch(join){
+        case LineJoinRound:
+            return PS_JOIN_ROUND;
+        case LineJoinBevel:
+            return PS_JOIN_BEVEL;
+        case LineJoinMiter:
+        case LineJoinMiterClipped:
+            return PS_JOIN_MITER;
+        default:
+            ERR("Not a member of GpLineJoin enumeration\n");
+            return 0;
+    }
+}
+
 GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
     GpPen **pen)
 {
@@ -44,6 +60,8 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
     gp_pen->width = width;
     gp_pen->unit = unit;
     gp_pen->endcap = LineCapFlat;
+    gp_pen->join = LineJoinMiter;
+    gp_pen->miterlimit = 10.0;
 
     /* FIXME: Currently only solid lines supported. */
     lb.lbStyle = BS_SOLID;
@@ -81,3 +99,25 @@ GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
 
     return Ok;
 }
+
+/* FIXME: Miter line joins behave a bit differently than they do in windows.
+ * Both kinds of miter joins clip if the angle is less than 11 degrees. */
+GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen *pen, GpLineJoin join)
+{
+    LOGBRUSH lb;
+
+    if(!pen)    return InvalidParameter;
+
+    DeleteObject(pen->gdipen);
+    pen->join = join;
+    pen->style &= ~(PS_JOIN_ROUND | PS_JOIN_BEVEL | PS_JOIN_MITER);
+    pen->style |= gdip_to_gdi_join(join);
+
+    lb.lbStyle = BS_SOLID;
+    lb.lbColor = pen->color;
+    lb.lbHatch = 0;
+
+    pen->gdipen = ExtCreatePen(pen->style, (INT) pen->width, &lb, 0, NULL);
+
+    return Ok;
+}
diff --git a/include/gdiplusenums.h b/include/gdiplusenums.h
index 1d00188..629a741 100644
--- a/include/gdiplusenums.h
+++ b/include/gdiplusenums.h
@@ -73,6 +73,14 @@ enum PathPointType{
     PathPointTypeBezier3        = 3
 };
 
+enum LineJoin
+{
+    LineJoinMiter           = 0,
+    LineJoinBevel           = 1,
+    LineJoinRound           = 2,
+    LineJoinMiterClipped    = 3
+};
+
 #ifndef __cplusplus
 
 typedef enum Unit Unit;
@@ -80,6 +88,7 @@ typedef enum BrushType BrushType;
 typedef enum FillMode FillMode;
 typedef enum LineCap LineCap;
 typedef enum PathPointType PathPointType;
+typedef enum LineJoin LineJoin;
 
 #endif /* end of c typedefs */
 
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 4e5e95f..5e275c9 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -30,6 +30,7 @@ extern "C" {
 GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**);
 GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
 GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap);
+GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen*,GpLineJoin);
 
 GpStatus WINGDIPAPI GdipCreateFromHDC(HDC,GpGraphics**);
 GpStatus WINGDIPAPI GdipCreateFromHWND(HWND,GpGraphics**);
diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h
index 5c02268..b3962aa 100644
--- a/include/gdiplusgpstubs.h
+++ b/include/gdiplusgpstubs.h
@@ -47,5 +47,6 @@ typedef FillMode GpFillMode;
 typedef PathData GpPathData;
 typedef LineCap GpLineCap;
 typedef RectF GpRectF;
+typedef LineJoin GpLineJoin;
 
 #endif




More information about the wine-cvs mailing list