gdiplus: Implemented GdipSetSolidFillColor/GdipGetSolidFillColor.

This commit is contained in:
Evan Stade 2007-07-23 20:24:24 -07:00 committed by Alexandre Julliard
parent 777d661fd2
commit 8b2ce0f94b
3 changed files with 23 additions and 10 deletions

View File

@ -26,12 +26,18 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
if(!brush || !clone)
return InvalidParameter;
*clone = GdipAlloc(sizeof(GpBrush));
if (!*clone) return OutOfMemory;
switch(brush->bt){
case BrushTypeSolidColor:
*clone = GdipAlloc(sizeof(GpSolidFill));
if (!*clone) return OutOfMemory;
memcpy(*clone, brush, sizeof(GpBrush));
memcpy(*clone, brush, sizeof(GpSolidFill));
(*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
(*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
break;
default:
return NotImplemented;
}
return Ok;
}
@ -51,7 +57,7 @@ GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
(*sf)->brush.gdibrush = CreateSolidBrush(col);
(*sf)->brush.bt = BrushTypeSolidColor;
(*sf)->brush.color = col;
(*sf)->color = color;
return Ok;
}
@ -80,7 +86,9 @@ GpStatus WINGDIPAPI GdipGetSolidFillColor(GpSolidFill *sf, ARGB *argb)
if(!sf || !argb)
return InvalidParameter;
return NotImplemented;
*argb = sf->color;
return Ok;
}
GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
@ -88,5 +96,11 @@ GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
if(!sf)
return InvalidParameter;
return NotImplemented;
sf->color = argb;
sf->brush.lb.lbColor = ARGB2COLORREF(argb);
DeleteObject(sf->brush.gdibrush);
sf->brush.gdibrush = CreateSolidBrush(sf->brush.lb.lbColor);
return Ok;
}

View File

@ -71,12 +71,12 @@ struct GpGraphics{
struct GpBrush{
HBRUSH gdibrush;
GpBrushType bt;
COLORREF color;
LOGBRUSH lb;
};
struct GpSolidFill{
GpBrush brush;
ARGB color;
};
struct GpPath{

View File

@ -107,8 +107,7 @@ static void test_brushfill(void)
GdipGetPenBrushFill(pen, &brush2);
ok(brush != brush2, "Expected to get a clone, not a copy of the reference\n");
GdipGetSolidFillColor((GpSolidFill*)brush2, &color);
todo_wine
expect(0xabaddeed, color);
expect(0xabaddeed, color);
GdipDeleteBrush(brush);
GdipDeleteBrush(brush2);