MCPcopy
hub / github.com/gographics/imagick / main

Function main

examples/3dlogo/main.go:9–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7)
8
9func main() {
10 imagick.Initialize()
11 defer imagick.Terminate()
12
13 mw := imagick.NewMagickWand()
14 defer mw.Destroy()
15 pw := imagick.NewPixelWand()
16 defer pw.Destroy()
17 dw := imagick.NewDrawingWand()
18 defer dw.Destroy()
19
20 if err := mw.SetSize(170, 100); err != nil {
21 panic(err)
22 }
23 if err := mw.ReadImage("xc:black"); err != nil {
24 panic(err)
25 }
26
27 pw.SetColor("white")
28 dw.SetFillColor(pw)
29 dw.Circle(50, 50, 13, 50)
30 dw.Circle(120, 50, 157, 50)
31 dw.Rectangle(50, 13, 120, 87)
32
33 pw.SetColor("black")
34 dw.SetFillColor(pw)
35 dw.Circle(50, 50, 25, 50)
36 dw.Circle(120, 50, 145, 50)
37 dw.Rectangle(50, 25, 120, 75)
38
39 pw.SetColor("white")
40 dw.SetFillColor(pw)
41 dw.Circle(60, 50, 40, 50)
42 dw.Circle(110, 50, 130, 50)
43 dw.Rectangle(60, 30, 110, 70)
44
45 // Now we draw the Drawing wand on to the Magick Wand
46 if err := mw.DrawImage(dw); err != nil {
47 panic(err)
48 }
49 if err := mw.GaussianBlurImage(1, 1); err != nil {
50 panic(err)
51 }
52 // Turn the matte of == +matte
53 if err := mw.SetImageMatte(false); err != nil {
54 panic(err)
55 }
56 if err := mw.WriteImage("logo_mask.png"); err != nil {
57 panic(err)
58 }
59
60 mw.Destroy()
61 dw.Destroy()
62 pw.Destroy()
63
64 mw = imagick.NewMagickWand()
65 pw = imagick.NewPixelWand()
66 dw = imagick.NewDrawingWand()

Callers

nothing calls this directly

Calls 15

DestroyMethod · 0.95
DestroyMethod · 0.95
DestroyMethod · 0.95
SetSizeMethod · 0.95
ReadImageMethod · 0.95
SetColorMethod · 0.95
SetFillColorMethod · 0.95
CircleMethod · 0.95
RectangleMethod · 0.95
DrawImageMethod · 0.95
GaussianBlurImageMethod · 0.95
SetImageMatteMethod · 0.95

Tested by

no test coverage detected