forked from shahfarhadreza/go-gdiplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pen.go
208 lines (162 loc) · 4.94 KB
/
pen.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
package gdiplus
type Pen struct {
nativePen *GpPen
}
func NewPen(color *Color, width float32) *Pen {
p := &Pen{}
GdipCreatePen1(color.GetValue(), width, UnitWorld, &p.nativePen)
return p
}
func NewPenFromBrush(brush *Brush, width float32) *Pen {
p := &Pen{}
GdipCreatePen2(brush.nativeBrush, width, UnitWorld, &p.nativePen)
return p
}
func (p *Pen) Dispose() {
GdipDeletePen(p.nativePen)
}
func (p *Pen) Clone() *Pen {
clone := &Pen{}
GdipClonePen(p.nativePen, &clone.nativePen)
return clone
}
func (p *Pen) SetWidth(width float32) {
GdipSetPenWidth(p.nativePen, width)
}
func (p *Pen) GetWidth() (width float32) {
GdipGetPenWidth(p.nativePen, &width)
return
}
func (p *Pen) SetLineCap(startCap, endCap LineCap, dashCap DashCap) {
GdipSetPenLineCap197819(p.nativePen, GpLineCap(startCap), GpLineCap(endCap), GpDashCap(dashCap))
}
func (p *Pen) SetStartCap(startCap LineCap) {
GdipSetPenStartCap(p.nativePen, GpLineCap(startCap))
}
func (p *Pen) SetEndCap(endCap LineCap) {
GdipSetPenEndCap(p.nativePen, GpLineCap(endCap))
}
func (p *Pen) SetDashCap(dashCap DashCap) {
GdipSetPenDashCap197819(p.nativePen, GpDashCap(dashCap))
}
func (p *Pen) GetStartCap() (startCap LineCap) {
GdipGetPenStartCap(p.nativePen, (*GpLineCap)(&startCap))
return
}
func (p *Pen) GetEndCap() (endCap LineCap) {
GdipGetPenEndCap(p.nativePen, (*GpLineCap)(&endCap))
return
}
func (p *Pen) GetDashCap() (dashCap DashCap) {
GdipGetPenDashCap197819(p.nativePen, (*GpDashCap)(&dashCap))
return
}
func (p *Pen) SetLineJoin(lineJoin LineJoin) {
GdipSetPenLineJoin(p.nativePen, GpLineJoin(lineJoin))
}
func (p *Pen) GetLineJoin() (lineJoin LineJoin) {
GdipGetPenLineJoin(p.nativePen, (*GpLineJoin)(&lineJoin))
return
}
func (p *Pen) SetCustomStartCap(customCap *GpCustomLineCap) {
GdipSetPenCustomStartCap(p.nativePen, customCap)
}
func (p *Pen) GetCustomStartCap() (customCap *GpCustomLineCap) {
GdipGetPenCustomStartCap(p.nativePen, &customCap)
return
}
func (p *Pen) SetCustomEndCap(customCap *GpCustomLineCap) {
GdipSetPenCustomEndCap(p.nativePen, customCap)
}
func (p *Pen) GetCustomEndCap() (customCap *GpCustomLineCap) {
GdipGetPenCustomEndCap(p.nativePen, &customCap)
return
}
func (p *Pen) SetMiterLimit(miterLimit float32) {
GdipSetPenMiterLimit(p.nativePen, miterLimit)
}
func (p *Pen) GetMiterLimit() (miterLimit float32) {
GdipGetPenMiterLimit(p.nativePen, &miterLimit)
return
}
func (p *Pen) SetMode(penMode PenAlignment) {
GdipSetPenMode(p.nativePen, GpPenAlignment(penMode))
}
func (p *Pen) GetMode() (penMode PenAlignment) {
GdipGetPenMode(p.nativePen, (*GpPenAlignment)(&penMode))
return
}
func (p *Pen) SetTransform(matrix *GpMatrix) {
GdipSetPenTransform(p.nativePen, matrix)
}
func (p *Pen) GetTransform(matrix *GpMatrix) {
GdipGetPenTransform(p.nativePen, matrix)
}
func (p *Pen) ResetTransform() {
GdipResetPenTransform(p.nativePen)
}
func (p *Pen) MultiplyTransform(matrix *GpMatrix, order MatrixOrder) {
GdipMultiplyPenTransform(p.nativePen, matrix, GpMatrixOrder(order))
}
func (p *Pen) TranslateTransform(dx, dy float32, order MatrixOrder) {
GdipTranslatePenTransform(p.nativePen, dx, dy, GpMatrixOrder(order))
}
func (p *Pen) ScaleTransform(sx, sy float32, order MatrixOrder) {
GdipScalePenTransform(p.nativePen, sx, sy, GpMatrixOrder(order))
}
func (p *Pen) RotateTransform(angle float32, order MatrixOrder) {
GdipRotatePenTransform(p.nativePen, angle, GpMatrixOrder(order))
}
func (p *Pen) SetColor(color *Color) {
GdipSetPenColor(p.nativePen, color.GetValue())
}
func (p *Pen) GetColor() (color Color) {
GdipGetPenColor(p.nativePen, &color.Argb)
return
}
func (p *Pen) SetBrush(brush *Brush) {
GdipSetPenBrushFill(p.nativePen, brush.nativeBrush)
}
func (p *Pen) GetBrush() *Brush {
brush := &Brush{}
GdipGetPenBrushFill(p.nativePen, &brush.nativeBrush)
return brush
}
func (p *Pen) GetPenType() (penType PenType) {
GdipGetPenFillType(p.nativePen, (*GpPenType)(&penType))
return
}
func (p *Pen) GetDashStyle() (dashStyle DashStyle) {
GdipGetPenDashStyle(p.nativePen, (*GpDashStyle)(&dashStyle))
return
}
func (p *Pen) SetDashStyle(dashStyle DashStyle) {
GdipSetPenDashStyle(p.nativePen, GpDashStyle(dashStyle))
}
func (p *Pen) GetDashOffset() (offset float32) {
GdipGetPenDashOffset(p.nativePen, &offset)
return
}
func (p *Pen) SetDashOffset(offset float32) {
GdipSetPenDashOffset(p.nativePen, offset)
}
func (p *Pen) GetDashCount() (count int32) {
GdipGetPenDashCount(p.nativePen, &count)
return
}
func (p *Pen) SetDashArray(dash []float32) {
GdipSetPenDashArray(p.nativePen, &dash[0], int32(len(dash)))
}
func (p *Pen) GetDashArray(dash *float32, count int32) {
GdipGetPenDashArray(p.nativePen, dash, count)
}
func (p *Pen) GetCompoundCount() (count int32) {
GdipGetPenCompoundCount(p.nativePen, &count)
return
}
func (p *Pen) SetCompoundArray(dash []float32) {
GdipSetPenCompoundArray(p.nativePen, &dash[0], int32(len(dash)))
}
func (p *Pen) GetCompoundArray(dash *float32, count int32) {
GdipGetPenCompoundArray(p.nativePen, dash, count)
}