forked from rustyoz/svg
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcircle.go
39 lines (31 loc) · 917 Bytes
/
circle.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
package svg
import mt "github.com/smallpdf/Mtransform"
// Circle is an SVG circle element
type Circle struct {
ID string `xml:"id,attr"`
Transform string `xml:"transform,attr"`
Style string `xml:"style,attr"`
Cx float64 `xml:"cx,attr"`
Cy float64 `xml:"cy,attr"`
Radius float64 `xml:"r,attr"`
Fill string `xml:"fill,attr"`
transform mt.Transform
group *Group
}
// ParseDrawingInstructions implements the DrawingInstructionParser
// interface
func (c *Circle) ParseDrawingInstructions() (chan *DrawingInstruction, chan error) {
draw := make(chan *DrawingInstruction)
errs := make(chan error)
go func() {
defer close(draw)
defer close(errs)
draw <- &DrawingInstruction{
Kind: CircleInstruction,
M: &Tuple{c.Cx, c.Cy},
Radius: &c.Radius,
}
draw <- &DrawingInstruction{Kind: PaintInstruction, Fill: &c.Fill}
}()
return draw, errs
}