summaryrefslogtreecommitdiff
path: root/draw.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-12-16 14:03:47 -0500
committerPietro Gagliardi <[email protected]>2015-12-16 14:03:47 -0500
commite67ed84ad93b128cd4afe58b012b0e3889a34b66 (patch)
tree849e8f63fb22bfd9ec1c4411defc45bc7adb6c4e /draw.go
parenta6c0fbdb870f6a5fb48824ebeac03360be601f57 (diff)
Did some build fixes.
Diffstat (limited to 'draw.go')
-rw-r--r--draw.go27
1 files changed, 24 insertions, 3 deletions
diff --git a/draw.go b/draw.go
index 4d09bd5..27ed8ba 100644
--- a/draw.go
+++ b/draw.go
@@ -32,14 +32,35 @@ import "C"
// dp.Context.Clip(p)
// // ...
// p.Free() // when done with the path
+//
+// A Path also defines its fill mode. (This should ideally be a fill
+// parameter, but some implementations prevent it.)
+// TODO talk about fill modes
type Path struct {
p *C.uiDrawPath
}
-// NewPath creates a new Path.
-func NewPath() *Path {
+// TODO
+type FillMode uint
+const (
+ Winding FillMode = iota
+ Alternate
+)
+
+// NewPath creates a new Path with the given fill mode.
+func NewPath(fillMode FillMode) *Path {
+ var fm C.uiDrawFillMode
+
+ switch fillMode {
+ case Winding:
+ fm = C.uiDrawFillModeWinding
+ case Alternate:
+ fm = C.uiDrawFillModeAlternate
+ default:
+ panic("invalid fill mode passed to ui.NewPath()")
+ }
return &Path{
- p: C.uiDrawNewPath(),
+ p: C.uiDrawNewPath(fm),
}
}