gdiplus: Added GdipSetPenDashArray/GdipGetPenDashArray.

oldstable
Evan Stade 2007-07-25 19:15:38 -07:00 committed by Alexandre Julliard
parent a4f238a117
commit 51bd0af43e
4 changed files with 50 additions and 2 deletions

View File

@ -338,7 +338,7 @@
@ stub GdipGetPenCompoundCount
@ stub GdipGetPenCustomEndCap
@ stub GdipGetPenCustomStartCap
@ stub GdipGetPenDashArray
@ stdcall GdipGetPenDashArray(ptr ptr long)
@ stub GdipGetPenDashCap197819
@ stub GdipGetPenDashCount
@ stub GdipGetPenDashOffset
@ -546,7 +546,7 @@
@ stub GdipSetPenCompoundArray
@ stdcall GdipSetPenCustomEndCap(ptr ptr)
@ stdcall GdipSetPenCustomStartCap(ptr ptr)
@ stub GdipSetPenDashArray
@ stdcall GdipSetPenDashArray(ptr ptr long)
@ stub GdipSetPenDashCap197819
@ stub GdipSetPenDashOffset
@ stdcall GdipSetPenDashStyle(ptr long)

View File

@ -54,6 +54,8 @@ struct GpPen{
GpLineJoin join;
REAL miterlimit;
GpDashStyle dash;
REAL *dashes;
INT numdashes;
GpBrush *brush;
};

View File

@ -123,6 +123,7 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
GdipDeleteBrush(pen->brush);
GdipDeleteCustomLineCap(pen->customstart);
GdipDeleteCustomLineCap(pen->customend);
GdipFree(pen->dashes);
GdipFree(pen);
return Ok;
@ -147,6 +148,20 @@ GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)
return GdipGetSolidFillColor(((GpSolidFill*)pen->brush), argb);
}
GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count)
{
if(!pen || !dash || count > pen->numdashes)
return InvalidParameter;
/* note: if you pass a negative value for count, it crashes native gdiplus. */
if(count < 0)
return GenericError;
memcpy(dash, pen->dashes, count * sizeof(REAL));
return Ok;
}
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
{
if(!pen || !dash)
@ -209,11 +224,40 @@ GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* custom
return ret;
}
GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
INT count)
{
if(!pen || !dash)
return InvalidParameter;
GdipFree(pen->dashes);
pen->dashes = NULL;
if(count > 0)
pen->dashes = GdipAlloc(count * sizeof(REAL));
if(!pen->dashes){
pen->numdashes = 0;
return OutOfMemory;
}
pen->dash = DashStyleCustom;
memcpy(pen->dashes, dash, count * sizeof(REAL));
pen->numdashes = count;
return Ok;
}
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
{
if(!pen)
return InvalidParameter;
if(dash != DashStyleCustom){
GdipFree(pen->dashes);
pen->dashes = NULL;
pen->numdashes = 0;
}
pen->dash = dash;
pen->style &= ~(PS_ALTERNATE | PS_SOLID | PS_DASH | PS_DOT | PS_DASHDOT |
PS_DASHDOTDOT | PS_NULL | PS_USERSTYLE | PS_INSIDEFRAME);

View File

@ -32,11 +32,13 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**);
GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen*,GpBrush**);
GpStatus WINGDIPAPI GdipGetPenColor(GpPen*,ARGB*);
GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen*,REAL*,INT);
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen*,GpDashStyle*);
GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen*,GpBrush*);
GpStatus WINGDIPAPI GdipSetPenColor(GpPen*,ARGB);
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen*,GpCustomLineCap*);
GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen*,GpCustomLineCap*);
GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen*,GDIPCONST REAL*,INT);
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen*,GpDashStyle);
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap);
GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen*,GpLineCap,GpLineCap,GpDashCap);