Commit 27124d5d authored by Evan Stade's avatar Evan Stade Committed by Alexandre Julliard

gdiplus: Implemented GdipSetPenColor.

parent 8b2ce0f9
......@@ -542,7 +542,7 @@
@ stub GdipSetPathGradientWrapMode
@ stub GdipSetPathMarker
@ stdcall GdipSetPenBrushFill(ptr ptr)
@ stub GdipSetPenColor
@ stdcall GdipSetPenColor(ptr long)
@ stub GdipSetPenCompoundArray
@ stdcall GdipSetPenCustomEndCap(ptr ptr)
@ stdcall GdipSetPenCustomStartCap(ptr ptr)
......
......@@ -44,7 +44,6 @@ static inline REAL deg2rad(REAL degrees)
struct GpPen{
UINT style;
COLORREF color;
GpUnit unit;
REAL width;
HPEN gdipen;
......
......@@ -394,9 +394,9 @@ static GpStatus draw_polyline(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
&ptcopy[0].X, &ptcopy[0].Y,
pen->customend->inset * pen->width);
draw_cap(hdc, pen->color, pen->endcap, pen->width, pen->customend,
draw_cap(hdc, pen->brush->lb.lbColor, pen->endcap, pen->width, pen->customend,
pt[count - 2].X, pt[count - 2].Y, pt[count - 1].X, pt[count - 1].Y);
draw_cap(hdc, pen->color, pen->startcap, pen->width, pen->customstart,
draw_cap(hdc, pen->brush->lb.lbColor, pen->startcap, pen->width, pen->customstart,
pt[1].X, pt[1].Y, pt[0].X, pt[0].Y);
}
......@@ -512,12 +512,12 @@ static GpStatus draw_polybezier(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
/* the direction of the line cap is parallel to the direction at the
* end of the bezier (which, if it has been shortened, is not the same
* as the direction from pt[count-2] to pt[count-1]) */
draw_cap(hdc, pen->color, pen->endcap, pen->width, pen->customend,
draw_cap(hdc, pen->brush->lb.lbColor, pen->endcap, pen->width, pen->customend,
pt[count - 1].X - (ptcopy[count - 1].X - ptcopy[count - 2].X),
pt[count - 1].Y - (ptcopy[count - 1].Y - ptcopy[count - 2].Y),
pt[count - 1].X, pt[count - 1].Y);
draw_cap(hdc, pen->color, pen->startcap, pen->width, pen->customstart,
draw_cap(hdc, pen->brush->lb.lbColor, pen->startcap, pen->width, pen->customstart,
pt[0].X - (ptcopy[0].X - ptcopy[1].X),
pt[0].Y - (ptcopy[0].Y - ptcopy[1].Y), pt[0].X, pt[0].Y);
}
......@@ -588,7 +588,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
MoveToEx(hdc, curpos.x, curpos.y, NULL);
}
draw_cap(hdc, pen->color, pen->endcap, pen->width, pen->customend,
draw_cap(hdc, pen->brush->lb.lbColor, pen->endcap, pen->width, pen->customend,
pt[count - 1].X - (ptcopy[count - 1].X - ptcopy[count - 2].X),
pt[count - 1].Y - (ptcopy[count - 1].Y - ptcopy[count - 2].Y),
pt[count - 1].X, pt[count - 1].Y);
......@@ -604,7 +604,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
&ptcopy[count - 1].X, &ptcopy[count - 1].Y,
pen->customend->inset * pen->width);
draw_cap(hdc, pen->color, pen->endcap, pen->width, pen->customend,
draw_cap(hdc, pen->brush->lb.lbColor, pen->endcap, pen->width, pen->customend,
pt[count - 2].X, pt[count - 2].Y, pt[count - 1].X,
pt[count - 1].Y);
......@@ -632,7 +632,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
MoveToEx(hdc, curpos.x, curpos.y, NULL);
}
draw_cap(hdc, pen->color, pen->startcap, pen->width, pen->customstart,
draw_cap(hdc, pen->brush->lb.lbColor, pen->startcap, pen->width, pen->customstart,
pt[j - 1].X - (ptcopy[j - 1].X - ptcopy[j].X),
pt[j - 1].Y - (ptcopy[j - 1].Y - ptcopy[j].Y),
pt[j - 1].X, pt[j - 1].Y);
......@@ -648,7 +648,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
&ptcopy[j - 1].X, &ptcopy[j - 1].Y,
pen->customstart->inset * pen->width);
draw_cap(hdc, pen->color, pen->endcap, pen->width, pen->customstart,
draw_cap(hdc, pen->brush->lb.lbColor, pen->endcap, pen->width, pen->customstart,
pt[j].X, pt[j].Y, pt[j - 1].X,
pt[j - 1].Y);
......
......@@ -98,7 +98,6 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
if(!gp_pen) return OutOfMemory;
gp_pen->style = GP_DEFAULT_PENSTYLE;
gp_pen->color = ARGB2COLORREF(color);
gp_pen->width = width;
gp_pen->unit = unit;
gp_pen->endcap = LineCapFlat;
......@@ -147,7 +146,10 @@ GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)
if(!pen || !argb)
return InvalidParameter;
return NotImplemented;
if(pen->brush->bt != BrushTypeSolidColor)
return NotImplemented;
return GdipGetSolidFillColor(((GpSolidFill*)pen->brush), argb);
}
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
......@@ -179,6 +181,17 @@ GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush)
return Ok;
}
GpStatus WINGDIPAPI GdipSetPenColor(GpPen *pen, ARGB argb)
{
if(!pen)
return InvalidParameter;
if(pen->brush->bt != BrushTypeSolidColor)
return NotImplemented;
return GdipSetSolidFillColor(((GpSolidFill*)pen->brush), argb);
}
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap)
{
GpCustomLineCap * cap;
......
......@@ -87,8 +87,7 @@ static void test_brushfill(void)
GdipGetBrushType(brush, &type);
expect(BrushTypeSolidColor, type);
GdipGetPenColor(pen, &color);
todo_wine
expect(0xdeadbeef, color);
expect(0xdeadbeef, color);
GdipDeleteBrush(brush);
/* color controlled by brush */
......@@ -96,8 +95,7 @@ static void test_brushfill(void)
status = GdipSetPenBrushFill(pen, brush);
expect(Ok, status);
GdipGetPenColor(pen, &color);
todo_wine
expect(0xabaddeed, color);
expect(0xabaddeed, color);
GdipDeleteBrush(brush);
color = 0;
......
......@@ -34,6 +34,7 @@ GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen*,GpBrush**);
GpStatus WINGDIPAPI GdipGetPenColor(GpPen*,ARGB*);
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 GdipSetPenDashStyle(GpPen*,GpDashStyle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment