/
Graphic.fs
57 lines (45 loc) · 1.19 KB
/
Graphic.fs
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
namespace SharpVG
type Graphic =
| Path of Path
| Polygon of Polygon
| Polyline of Polyline
| Image of Image
| Circle of Circle
| Ellipse of Ellipse
| Line of Line
| Rect of Rect
| Text of Text
| Use of Use
module Graphic =
let ofPath path =
Path(path)
let ofPolygon polygon =
Polygon(polygon)
let ofPolyline polyline =
Polyline(polyline)
let ofImage image =
Image(image)
let ofCircle circle =
Circle(circle)
let ofEllipse ellipse =
Ellipse(ellipse)
let ofLine line =
Line(line)
let ofRect rect =
Rect(rect)
let ofText text =
Text(text)
let ofUse u =
Use(u)
let toElement graphic =
match graphic with
| Path(p) -> Element.create p
| Polygon(p) -> Element.create p
| Polyline(p) -> Element.create p
| Image(i) -> Element.create i
| Circle(c) -> Element.create c
| Ellipse(e) -> Element.create e
| Line(l) -> Element.create l
| Rect(r) -> Element.create r
| Text(t) -> Element.create t
| Use(u) -> Element.create u