-
Notifications
You must be signed in to change notification settings - Fork 3
/
gdipluslinecaps.go
169 lines (135 loc) · 4.17 KB
/
gdipluslinecaps.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
package gdiplus
import (
. "github.com/tryor/winapi"
)
type ICustomLineCap interface {
GetNativeCap() *GpCustomLineCap
}
type CustomLineCap struct {
GdiplusBase
nativeCap *GpCustomLineCap
}
func NewCustomLineCap(
fillPath *GraphicsPath,
strokePath *GraphicsPath,
baseCap LineCap,
baseInset REAL) (*CustomLineCap, error) {
linecap := &CustomLineCap{}
var nativeFillPath *GpPath
var nativeStrokePath *GpPath
if fillPath != nil {
nativeFillPath = fillPath.nativePath
}
if strokePath != nil {
nativeStrokePath = strokePath.nativePath
}
linecap.setStatus(GdipCreateCustomLineCap(
nativeFillPath, nativeStrokePath,
baseCap, baseInset, &linecap.nativeCap))
return linecap, linecap.LastError
}
func (this *CustomLineCap) GetNativeCap() *GpCustomLineCap {
return this.nativeCap
}
func (this *CustomLineCap) Release() {
if this.nativeCap != nil {
this.setStatus(GdipDeleteCustomLineCap(this.nativeCap))
this.nativeCap = nil
}
}
func (this *CustomLineCap) SetStrokeCaps(
startCap, endCap LineCap) Status {
return this.setStatus(GdipSetCustomLineCapStrokeCaps(this.nativeCap,
startCap, endCap))
}
func (this *CustomLineCap) GetStrokeCaps() (startCap, endCap LineCap, status Status) {
status = this.setStatus(GdipGetCustomLineCapStrokeCaps(this.nativeCap,
&startCap, &endCap))
return
}
func (this *CustomLineCap) SetStrokeJoin(lineJoin LineJoin) Status {
return this.setStatus(GdipSetCustomLineCapStrokeJoin(this.nativeCap,
lineJoin))
}
func (this *CustomLineCap) GetStrokeJoin() (lineJoin LineJoin) {
this.setStatus(GdipGetCustomLineCapStrokeJoin(this.nativeCap,
&lineJoin))
return
}
func (this *CustomLineCap) SetBaseCap(baseCap LineCap) Status {
return this.setStatus(GdipSetCustomLineCapBaseCap(this.nativeCap,
baseCap))
}
func (this *CustomLineCap) GetBaseCap() (baseCap LineCap) {
this.setStatus(GdipGetCustomLineCapBaseCap(this.nativeCap, &baseCap))
return
}
func (this *CustomLineCap) SetBaseInset(inset REAL) Status {
return this.setStatus(GdipSetCustomLineCapBaseInset(this.nativeCap,
inset))
}
func (this *CustomLineCap) GetBaseInset() (inset REAL) {
this.setStatus(GdipGetCustomLineCapBaseInset(this.nativeCap, &inset))
return
}
func (this *CustomLineCap) SetWidthScale(widthScale REAL) Status {
return this.setStatus(GdipSetCustomLineCapWidthScale(this.nativeCap,
widthScale))
}
func (this *CustomLineCap) GetWidthScale() (widthScale REAL) {
this.setStatus(GdipGetCustomLineCapWidthScale(this.nativeCap, &widthScale))
return
}
func (this *CustomLineCap) Clone() *CustomLineCap {
linecap := &CustomLineCap{}
this.setStatus(GdipCloneCustomLineCap(this.nativeCap,
&linecap.nativeCap))
return linecap
}
type AdjustableArrowCap struct {
CustomLineCap
}
//isFilled = TRUE
func NewAdjustableArrowCap(
height, width REAL, isFilled BOOL) (*AdjustableArrowCap, error) {
arrowCap := &AdjustableArrowCap{}
arrowCap.setStatus(GdipCreateAdjustableArrowCap(
height, width, isFilled, &arrowCap.nativeCap))
return arrowCap, arrowCap.LastError
}
func (this *AdjustableArrowCap) SetHeight(height REAL) Status {
return this.setStatus(GdipSetAdjustableArrowCapHeight(
this.nativeCap, height))
}
func (this *AdjustableArrowCap) GetHeight() (height REAL) {
this.setStatus(GdipGetAdjustableArrowCapHeight(
this.nativeCap, &height))
return
}
func (this *AdjustableArrowCap) SetWidth(width REAL) Status {
return this.setStatus(GdipSetAdjustableArrowCapWidth(
this.nativeCap, width))
}
func (this *AdjustableArrowCap) GetWidth() (width REAL) {
this.setStatus(GdipGetAdjustableArrowCapWidth(
this.nativeCap, &width))
return
}
func (this *AdjustableArrowCap) SetMiddleInset(middleInset REAL) Status {
return this.setStatus(GdipSetAdjustableArrowCapMiddleInset(
this.nativeCap, middleInset))
}
func (this *AdjustableArrowCap) GetMiddleInset() (middleInset REAL) {
this.setStatus(GdipGetAdjustableArrowCapMiddleInset(
this.nativeCap, &middleInset))
return
}
func (this *AdjustableArrowCap) SetFillState(isFilled BOOL) Status {
return this.setStatus(GdipSetAdjustableArrowCapFillState(
this.nativeCap, isFilled))
}
func (this *AdjustableArrowCap) IsFilled() (isFilled BOOL) {
this.setStatus(GdipGetAdjustableArrowCapFillState(
this.nativeCap, &isFilled))
return
}