diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 1d8e4240133..755a70d3e50 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -544,8 +544,8 @@ @ stub GdipSetPenBrushFill @ stub GdipSetPenColor @ stub GdipSetPenCompoundArray -@ stub GdipSetPenCustomEndCap -@ stub GdipSetPenCustomStartCap +@ stdcall GdipSetPenCustomEndCap(ptr ptr) +@ stdcall GdipSetPenCustomStartCap(ptr ptr) @ stub GdipSetPenDashArray @ stub GdipSetPenDashCap197819 @ stub GdipSetPenDashOffset diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 5350a19a4ad..206d86cdea3 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -49,6 +49,8 @@ struct GpPen{ GpLineCap endcap; GpLineCap startcap; GpDashCap dashcap; + GpCustomLineCap *customstart; + GpCustomLineCap *customend; GpLineJoin join; REAL miterlimit; GpDashStyle dash; diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c index 52ee8e21ff6..9601f8c695b 100644 --- a/dlls/gdiplus/pen.c +++ b/dlls/gdiplus/pen.c @@ -130,6 +130,9 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen) { if(!pen) return InvalidParameter; DeleteObject(pen->gdipen); + + GdipDeleteCustomLineCap(pen->customstart); + GdipDeleteCustomLineCap(pen->customend); GdipFree(pen); return Ok; @@ -145,6 +148,38 @@ GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash) return Ok; } +GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap) +{ + GpCustomLineCap * cap; + GpStatus ret; + + if(!pen || !customCap) return InvalidParameter; + + if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){ + GdipDeleteCustomLineCap(pen->customend); + pen->endcap = LineCapCustom; + pen->customend = cap; + } + + return ret; +} + +GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* customCap) +{ + GpCustomLineCap * cap; + GpStatus ret; + + if(!pen || !customCap) return InvalidParameter; + + if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){ + GdipDeleteCustomLineCap(pen->customstart); + pen->startcap = LineCapCustom; + pen->customstart = cap; + } + + return ret; +} + GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash) { LOGBRUSH lb; @@ -171,6 +206,9 @@ GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap) { if(!pen) return InvalidParameter; + /* The old custom cap gets deleted even if the new style is LineCapCustom. */ + GdipDeleteCustomLineCap(pen->customend); + pen->customend = NULL; pen->endcap = cap; return Ok; @@ -183,6 +221,11 @@ GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen *pen, GpLineCap start, if(!pen) return InvalidParameter; + GdipDeleteCustomLineCap(pen->customend); + GdipDeleteCustomLineCap(pen->customstart); + pen->customend = NULL; + pen->customstart = NULL; + pen->startcap = start; pen->endcap = end; pen->dashcap = dash; diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 901e03bdb79..365e81a0661 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -31,6 +31,8 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen*,GpPen**); GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**); GpStatus WINGDIPAPI GdipDeletePen(GpPen*); GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen*,GpDashStyle*); +GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen*,GpCustomLineCap*); +GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen*,GpCustomLineCap*); GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen*,GpDashStyle); GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap); GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen*,GpLineCap,GpLineCap,GpDashCap);