-
Notifications
You must be signed in to change notification settings - Fork 3
/
brush.go
45 lines (36 loc) · 876 Bytes
/
brush.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package gdiplus
type Brush struct {
nativeBrush *GpBrush
}
type SolidBrush struct {
Brush
}
func (b *Brush) Dispose() {
GdipDeleteBrush(b.nativeBrush)
}
func (b *Brush) GetBrushType() (brushType BrushType) {
GdipGetBrushType(b.nativeBrush, (*GpBrushType)(&brushType))
return
}
func (b *Brush) Clone() *Brush {
clone := &Brush{}
GdipCloneBrush(b.nativeBrush, &clone.nativeBrush)
return clone
}
func NewSolidBrush(color *Color) *SolidBrush {
b := &SolidBrush{}
var solidFill *GpSolidFill
GdipCreateSolidFill(color.GetValue(), &solidFill)
b.nativeBrush = &solidFill.GpBrush
return b
}
func (b *SolidBrush) AsBrush() *Brush {
return &b.Brush
}
func (b *SolidBrush) SetColor(color *Color) {
GdipSetSolidFillColor(b.nativeBrush, color.GetValue())
}
func (b *SolidBrush) GetColor() (color Color) {
GdipGetSolidFillColor(b.nativeBrush, &color.Argb)
return
}