-
-
Notifications
You must be signed in to change notification settings - Fork 110
/
doc.go
64 lines (49 loc) · 1.46 KB
/
doc.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
/*
Package triangle is an image processing library which converts images to computer generated art using delaunay triangulation.
The package provides a command line utility supporting various customization options.
Check the supported commands by typing:
$ triangle --help
Using Go interfaces the API can expose the result either as raster or vector type.
Example to generate triangulated image and output the result as a raster type:
package main
import (
"fmt"
"github.com/esimov/triangle/v2"
)
func main() {
p := &triangle.Processor{
// Initialize struct variables
}
img := &triangle.Image{*p}
_, _, _, err := img.Draw(srcImg, p, func() {})
if err != nil {
fmt.Printf("Error on triangulation process: %s", err.Error())
}
}
Example to generate triangulated image and output the result as SVG:
package main
import (
"fmt"
"github.com/esimov/triangle/v2"
)
func main() {
p := &triangle.Processor{
// Initialize struct variables
}
svg := &triangle.SVG{
Title: "Delaunay image triangulator",
Lines: []triangle.Line{},
Description: "Convert images to computer generated art using delaunay triangulation.",
StrokeWidth: p.StrokeWidth,
StrokeLineCap: "round", //butt, round, square
Processor: *p,
}
_, _, _, err := svg.Draw(srcImg, p, func() {
// Call the closure function
})
if err != nil {
fmt.Printf("Error on triangulation process: %s", err.Error())
}
}
*/
package triangle