static GF_Err gdip_set_brush_color(GF_STENCIL _this, GF_Color c) { GPSTEN(); CHECK_RET(GF_STENCIL_SOLID); if (!_sten->pSolid) GdipCreateSolidFill(c, &_sten->pSolid); else GdipSetSolidFillColor(_sten->pSolid, c); return GF_OK; }
GpStatus WINGDIPAPI GdipSetPenColor(GpPen *pen, ARGB argb) { TRACE("(%p, %x)\n", pen, argb); if(!pen) return InvalidParameter; if(pen->brush->bt != BrushTypeSolidColor) return NotImplemented; return GdipSetSolidFillColor(((GpSolidFill*)pen->brush), argb); }
static void test_brushfill(void) { GpStatus status; GpPen *pen; GpBrush *brush, *brush2; GpBrushType type; ARGB color = 0; /* default solid */ GdipCreatePen1(0xdeadbeef, 4.5, UnitWorld, &pen); status = GdipGetPenBrushFill(pen, &brush); expect(Ok, status); GdipGetBrushType(brush, &type); expect(BrushTypeSolidColor, type); GdipGetPenColor(pen, &color); expect(0xdeadbeef, color); GdipDeleteBrush(brush); /* color controlled by brush */ GdipCreateSolidFill(0xabaddeed, (GpSolidFill**)&brush); status = GdipSetPenBrushFill(pen, brush); expect(Ok, status); GdipGetPenColor(pen, &color); expect(0xabaddeed, color); GdipDeleteBrush(brush); color = 0; /* get returns a clone, not a reference */ GdipGetPenBrushFill(pen, &brush); GdipSetSolidFillColor((GpSolidFill*)brush, 0xbeadfeed); GdipGetPenBrushFill(pen, &brush2); ok(brush != brush2, "Expected to get a clone, not a copy of the reference\n"); GdipGetSolidFillColor((GpSolidFill*)brush2, &color); expect(0xabaddeed, color); GdipDeleteBrush(brush); GdipDeleteBrush(brush2); /* brush cannot be NULL */ status = GdipSetPenBrushFill(pen, NULL); expect(InvalidParameter, status); GdipDeletePen(pen); }