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

gdiplus: Implemented GdipSetPenColor.

parent 8b2ce0f9
...@@ -542,7 +542,7 @@ ...@@ -542,7 +542,7 @@
@ stub GdipSetPathGradientWrapMode @ stub GdipSetPathGradientWrapMode
@ stub GdipSetPathMarker @ stub GdipSetPathMarker
@ stdcall GdipSetPenBrushFill(ptr ptr) @ stdcall GdipSetPenBrushFill(ptr ptr)
@ stub GdipSetPenColor @ stdcall GdipSetPenColor(ptr long)
@ stub GdipSetPenCompoundArray @ stub GdipSetPenCompoundArray
@ stdcall GdipSetPenCustomEndCap(ptr ptr) @ stdcall GdipSetPenCustomEndCap(ptr ptr)
@ stdcall GdipSetPenCustomStartCap(ptr ptr) @ stdcall GdipSetPenCustomStartCap(ptr ptr)
......
...@@ -44,7 +44,6 @@ static inline REAL deg2rad(REAL degrees) ...@@ -44,7 +44,6 @@ static inline REAL deg2rad(REAL degrees)
struct GpPen{ struct GpPen{
UINT style; UINT style;
COLORREF color;
GpUnit unit; GpUnit unit;
REAL width; REAL width;
HPEN gdipen; HPEN gdipen;
......
...@@ -394,9 +394,9 @@ static GpStatus draw_polyline(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt, ...@@ -394,9 +394,9 @@ static GpStatus draw_polyline(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
&ptcopy[0].X, &ptcopy[0].Y, &ptcopy[0].X, &ptcopy[0].Y,
pen->customend->inset * pen->width); 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); 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); 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, ...@@ -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 /* 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 * 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]) */ * 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].X - (ptcopy[count - 1].X - ptcopy[count - 2].X),
pt[count - 1].Y - (ptcopy[count - 1].Y - ptcopy[count - 2].Y), pt[count - 1].Y - (ptcopy[count - 1].Y - ptcopy[count - 2].Y),
pt[count - 1].X, pt[count - 1].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].X - (ptcopy[0].X - ptcopy[1].X),
pt[0].Y - (ptcopy[0].Y - ptcopy[1].Y), pt[0].X, pt[0].Y); 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, ...@@ -588,7 +588,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
MoveToEx(hdc, curpos.x, curpos.y, NULL); 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].X - (ptcopy[count - 1].X - ptcopy[count - 2].X),
pt[count - 1].Y - (ptcopy[count - 1].Y - ptcopy[count - 2].Y), pt[count - 1].Y - (ptcopy[count - 1].Y - ptcopy[count - 2].Y),
pt[count - 1].X, pt[count - 1].Y); pt[count - 1].X, pt[count - 1].Y);
...@@ -604,7 +604,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt, ...@@ -604,7 +604,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
&ptcopy[count - 1].X, &ptcopy[count - 1].Y, &ptcopy[count - 1].X, &ptcopy[count - 1].Y,
pen->customend->inset * pen->width); 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 - 2].X, pt[count - 2].Y, pt[count - 1].X,
pt[count - 1].Y); pt[count - 1].Y);
...@@ -632,7 +632,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt, ...@@ -632,7 +632,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
MoveToEx(hdc, curpos.x, curpos.y, NULL); 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].X - (ptcopy[j - 1].X - ptcopy[j].X),
pt[j - 1].Y - (ptcopy[j - 1].Y - ptcopy[j].Y), pt[j - 1].Y - (ptcopy[j - 1].Y - ptcopy[j].Y),
pt[j - 1].X, pt[j - 1].Y); pt[j - 1].X, pt[j - 1].Y);
...@@ -648,7 +648,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt, ...@@ -648,7 +648,7 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
&ptcopy[j - 1].X, &ptcopy[j - 1].Y, &ptcopy[j - 1].X, &ptcopy[j - 1].Y,
pen->customstart->inset * pen->width); 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].X, pt[j].Y, pt[j - 1].X,
pt[j - 1].Y); pt[j - 1].Y);
......
...@@ -98,7 +98,6 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit, ...@@ -98,7 +98,6 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
if(!gp_pen) return OutOfMemory; if(!gp_pen) return OutOfMemory;
gp_pen->style = GP_DEFAULT_PENSTYLE; gp_pen->style = GP_DEFAULT_PENSTYLE;
gp_pen->color = ARGB2COLORREF(color);
gp_pen->width = width; gp_pen->width = width;
gp_pen->unit = unit; gp_pen->unit = unit;
gp_pen->endcap = LineCapFlat; gp_pen->endcap = LineCapFlat;
...@@ -147,7 +146,10 @@ GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb) ...@@ -147,7 +146,10 @@ GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)
if(!pen || !argb) if(!pen || !argb)
return InvalidParameter; return InvalidParameter;
if(pen->brush->bt != BrushTypeSolidColor)
return NotImplemented; return NotImplemented;
return GdipGetSolidFillColor(((GpSolidFill*)pen->brush), argb);
} }
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash) GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
...@@ -179,6 +181,17 @@ GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush) ...@@ -179,6 +181,17 @@ GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush)
return Ok; 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) GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap)
{ {
GpCustomLineCap * cap; GpCustomLineCap * cap;
......
...@@ -87,7 +87,6 @@ static void test_brushfill(void) ...@@ -87,7 +87,6 @@ static void test_brushfill(void)
GdipGetBrushType(brush, &type); GdipGetBrushType(brush, &type);
expect(BrushTypeSolidColor, type); expect(BrushTypeSolidColor, type);
GdipGetPenColor(pen, &color); GdipGetPenColor(pen, &color);
todo_wine
expect(0xdeadbeef, color); expect(0xdeadbeef, color);
GdipDeleteBrush(brush); GdipDeleteBrush(brush);
...@@ -96,7 +95,6 @@ static void test_brushfill(void) ...@@ -96,7 +95,6 @@ static void test_brushfill(void)
status = GdipSetPenBrushFill(pen, brush); status = GdipSetPenBrushFill(pen, brush);
expect(Ok, status); expect(Ok, status);
GdipGetPenColor(pen, &color); GdipGetPenColor(pen, &color);
todo_wine
expect(0xabaddeed, color); expect(0xabaddeed, color);
GdipDeleteBrush(brush); GdipDeleteBrush(brush);
color = 0; color = 0;
......
...@@ -34,6 +34,7 @@ GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen*,GpBrush**); ...@@ -34,6 +34,7 @@ GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen*,GpBrush**);
GpStatus WINGDIPAPI GdipGetPenColor(GpPen*,ARGB*); GpStatus WINGDIPAPI GdipGetPenColor(GpPen*,ARGB*);
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen*,GpDashStyle*); GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen*,GpDashStyle*);
GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen*,GpBrush*); GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen*,GpBrush*);
GpStatus WINGDIPAPI GdipSetPenColor(GpPen*,ARGB);
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen*,GpCustomLineCap*); GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen*,GpCustomLineCap*);
GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen*,GpCustomLineCap*); GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen*,GpCustomLineCap*);
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen*,GpDashStyle); 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