diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index aea3a721e97..81e59402fbd 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -549,7 +549,7 @@ @ stub GdipSetPenDashArray @ stub GdipSetPenDashCap197819 @ stub GdipSetPenDashOffset -@ stub GdipSetPenDashStyle +@ stdcall GdipSetPenDashStyle(ptr long) @ stdcall GdipSetPenEndCap(ptr long) @ stdcall GdipSetPenLineCap197819(ptr long long long) @ stdcall GdipSetPenLineJoin(ptr long) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index b0a9dd19a2d..299806b613f 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -23,7 +23,7 @@ #include "windef.h" #include "gdiplus.h" -#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_ENDCAP_FLAT | PS_JOIN_MITER) +#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER) #define MAX_ARC_PTS (13) COLORREF ARGB2COLORREF(ARGB color); @@ -51,6 +51,7 @@ struct GpPen{ GpDashCap dashcap; GpLineJoin join; REAL miterlimit; + GpDashStyle dash; }; struct GpGraphics{ diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c index 1b37e135737..53559bdb505 100644 --- a/dlls/gdiplus/pen.c +++ b/dlls/gdiplus/pen.c @@ -27,6 +27,28 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); +static DWORD gdip_to_gdi_dash(GpDashStyle dash) +{ + switch(dash){ + case DashStyleSolid: + return PS_SOLID; + case DashStyleDash: + return PS_DASH; + case DashStyleDot: + return PS_DOT; + case DashStyleDashDot: + return PS_DASHDOT; + case DashStyleDashDotDot: + return PS_DASHDOTDOT; + case DashStyleCustom: + FIXME("DashStyleCustom not implemented\n"); + return PS_SOLID; + default: + ERR("Not a member of GpDashStyle enumeration\n"); + return 0; + } +} + static DWORD gdip_to_gdi_join(GpLineJoin join) { switch(join){ @@ -91,6 +113,28 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen) return Ok; } +GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash) +{ + LOGBRUSH lb; + + if(!pen) + return InvalidParameter; + + DeleteObject(pen->gdipen); + pen->dash = dash; + pen->style &= ~(PS_ALTERNATE | PS_SOLID | PS_DASH | PS_DOT | PS_DASHDOT | + PS_DASHDOTDOT | PS_NULL | PS_USERSTYLE | PS_INSIDEFRAME); + pen->style |= gdip_to_gdi_dash(dash); + + lb.lbStyle = BS_SOLID; + lb.lbColor = pen->color; + lb.lbHatch = 0; + + pen->gdipen = ExtCreatePen(pen->style, (INT) pen->width, &lb, 0, NULL); + + return Ok; +} + GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap) { if(!pen) return InvalidParameter; diff --git a/include/gdiplusenums.h b/include/gdiplusenums.h index 7bf5eb6c1d0..4f5b193fcc4 100644 --- a/include/gdiplusenums.h +++ b/include/gdiplusenums.h @@ -141,6 +141,16 @@ enum DashCap DashCapTriangle = 3 }; +enum DashStyle +{ + DashStyleSolid, + DashStyleDash, + DashStyleDot, + DashStyleDashDot, + DashStyleDashDotDot, + DashStyleCustom +}; + #ifndef __cplusplus typedef enum Unit Unit; @@ -155,6 +165,7 @@ typedef enum CompositingQuality CompositingQuality; typedef enum InterpolationMode InterpolationMode; typedef enum PixelOffsetMode PixelOffsetMode; typedef enum DashCap DashCap; +typedef enum DashStyle DashStyle; #endif /* end of c typedefs */ diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index fa569523e6f..35a60584d52 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -29,6 +29,7 @@ extern "C" { GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**); GpStatus WINGDIPAPI GdipDeletePen(GpPen*); +GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen*,GpDashStyle); GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap); GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen*,GpLineCap,GpLineCap,GpDashCap); GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen*,GpLineJoin); diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h index e847e0e50bd..7cb18880b03 100644 --- a/include/gdiplusgpstubs.h +++ b/include/gdiplusgpstubs.h @@ -51,5 +51,6 @@ typedef LineCap GpLineCap; typedef RectF GpRectF; typedef LineJoin GpLineJoin; typedef DashCap GpDashCap; +typedef DashStyle GpDashStyle; #endif