2 * Copyright (C) 2007 Google (Evan Stade)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "gdiplus_private.h"
24 GpStatus WINGDIPAPI
GdipCloneBrush(GpBrush
*brush
, GpBrush
**clone
)
27 return InvalidParameter
;
30 case BrushTypeSolidColor
:
31 *clone
= GdipAlloc(sizeof(GpSolidFill
));
32 if (!*clone
) return OutOfMemory
;
34 memcpy(*clone
, brush
, sizeof(GpSolidFill
));
36 (*clone
)->gdibrush
= CreateBrushIndirect(&(*clone
)->lb
);
39 return NotImplemented
;
45 GpStatus WINGDIPAPI
GdipCreateSolidFill(ARGB color
, GpSolidFill
**sf
)
47 COLORREF col
= ARGB2COLORREF(color
);
49 if(!sf
) return InvalidParameter
;
51 *sf
= GdipAlloc(sizeof(GpSolidFill
));
52 if (!*sf
) return OutOfMemory
;
54 (*sf
)->brush
.lb
.lbStyle
= BS_SOLID
;
55 (*sf
)->brush
.lb
.lbColor
= col
;
56 (*sf
)->brush
.lb
.lbHatch
= 0;
58 (*sf
)->brush
.gdibrush
= CreateSolidBrush(col
);
59 (*sf
)->brush
.bt
= BrushTypeSolidColor
;
65 GpStatus WINGDIPAPI
GdipGetBrushType(GpBrush
*brush
, GpBrushType
*type
)
67 if(!brush
|| !type
) return InvalidParameter
;
74 GpStatus WINGDIPAPI
GdipDeleteBrush(GpBrush
*brush
)
76 if(!brush
) return InvalidParameter
;
78 DeleteObject(brush
->gdibrush
);
84 GpStatus WINGDIPAPI
GdipGetSolidFillColor(GpSolidFill
*sf
, ARGB
*argb
)
87 return InvalidParameter
;
94 GpStatus WINGDIPAPI
GdipSetSolidFillColor(GpSolidFill
*sf
, ARGB argb
)
97 return InvalidParameter
;
100 sf
->brush
.lb
.lbColor
= ARGB2COLORREF(argb
);
102 DeleteObject(sf
->brush
.gdibrush
);
103 sf
->brush
.gdibrush
= CreateSolidBrush(sf
->brush
.lb
.lbColor
);