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

Function textEffect7

examples/text_effects/main.go:249–280  ·  view source on GitHub ↗

Text effect 7 - Polar distortion

()

Source from the content-addressed store, hash-verified

247
248// Text effect 7 - Polar distortion
249func textEffect7() {
250 imagick.Initialize()
251 defer imagick.Terminate()
252 // This one uses d_args[0]
253 mw := imagick.NewMagickWand()
254 defer mw.Destroy()
255 dw := imagick.NewDrawingWand()
256 defer dw.Destroy()
257 pw := imagick.NewPixelWand()
258 defer pw.Destroy()
259 // Create a 320x200 transparent canvas
260 pw.SetColor("none")
261 mw.NewImage(320, 200, pw)
262 // Set up a 72 point font
263 dw.SetFont("Verdana-Bold-Italic")
264 dw.SetFontSize(72)
265 // Now draw the text
266 dw.Annotation(25, 65, "Magick")
267 // Draw the image on to the mw
268 mw.DrawImage(dw)
269 d_args[0] = 0.0
270 // DON'T FORGET to set the correct number of arguments here
271 mw.DistortImage(imagick.DISTORTION_POLAR, d_args, true)
272 //mw.ResetImagePage("")
273 // Trim the image again
274 mw.TrimImage(0)
275 // Add the border
276 pw.SetColor("none")
277 mw.BorderImage(pw, 10, 10)
278 // and write it
279 mw.WriteImage("text_polar.png")
280}
281
282// Text effect 8 - Shepard's distortion
283func textEffect8() {

Callers 1

mainFunction · 0.85

Calls 13

DestroyMethod · 0.95
DestroyMethod · 0.95
DestroyMethod · 0.95
SetColorMethod · 0.95
NewImageMethod · 0.95
SetFontMethod · 0.95
SetFontSizeMethod · 0.95
AnnotationMethod · 0.95
DrawImageMethod · 0.95
DistortImageMethod · 0.95
TrimImageMethod · 0.95
BorderImageMethod · 0.95

Tested by

no test coverage detected