gdiplus: Added custom line cap setters.

This commit is contained in:
Evan Stade 2007-07-19 18:22:43 -07:00 committed by Alexandre Julliard
parent 628237f334
commit 8f865f42ee
4 changed files with 49 additions and 2 deletions

View File

@ -544,8 +544,8 @@
@ stub GdipSetPenBrushFill @ stub GdipSetPenBrushFill
@ stub GdipSetPenColor @ stub GdipSetPenColor
@ stub GdipSetPenCompoundArray @ stub GdipSetPenCompoundArray
@ stub GdipSetPenCustomEndCap @ stdcall GdipSetPenCustomEndCap(ptr ptr)
@ stub GdipSetPenCustomStartCap @ stdcall GdipSetPenCustomStartCap(ptr ptr)
@ stub GdipSetPenDashArray @ stub GdipSetPenDashArray
@ stub GdipSetPenDashCap197819 @ stub GdipSetPenDashCap197819
@ stub GdipSetPenDashOffset @ stub GdipSetPenDashOffset

View File

@ -49,6 +49,8 @@ struct GpPen{
GpLineCap endcap; GpLineCap endcap;
GpLineCap startcap; GpLineCap startcap;
GpDashCap dashcap; GpDashCap dashcap;
GpCustomLineCap *customstart;
GpCustomLineCap *customend;
GpLineJoin join; GpLineJoin join;
REAL miterlimit; REAL miterlimit;
GpDashStyle dash; GpDashStyle dash;

View File

@ -130,6 +130,9 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
{ {
if(!pen) return InvalidParameter; if(!pen) return InvalidParameter;
DeleteObject(pen->gdipen); DeleteObject(pen->gdipen);
GdipDeleteCustomLineCap(pen->customstart);
GdipDeleteCustomLineCap(pen->customend);
GdipFree(pen); GdipFree(pen);
return Ok; return Ok;
@ -145,6 +148,38 @@ GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
return Ok; 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) GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
{ {
LOGBRUSH lb; LOGBRUSH lb;
@ -171,6 +206,9 @@ GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
{ {
if(!pen) return InvalidParameter; 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; pen->endcap = cap;
return Ok; return Ok;
@ -183,6 +221,11 @@ GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen *pen, GpLineCap start,
if(!pen) if(!pen)
return InvalidParameter; return InvalidParameter;
GdipDeleteCustomLineCap(pen->customend);
GdipDeleteCustomLineCap(pen->customstart);
pen->customend = NULL;
pen->customstart = NULL;
pen->startcap = start; pen->startcap = start;
pen->endcap = end; pen->endcap = end;
pen->dashcap = dash; pen->dashcap = dash;

View File

@ -31,6 +31,8 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen*,GpPen**);
GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**); GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**);
GpStatus WINGDIPAPI GdipDeletePen(GpPen*); GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen*,GpDashStyle*); GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen*,GpDashStyle*);
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen*,GpCustomLineCap*);
GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen*,GpCustomLineCap*);
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen*,GpDashStyle); GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen*,GpDashStyle);
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap); GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap);
GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen*,GpLineCap,GpLineCap,GpDashCap); GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen*,GpLineCap,GpLineCap,GpDashCap);