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

Function textEffect8

examples/text_effects/main.go:283–320  ·  view source on GitHub ↗

Text effect 8 - Shepard's distortion

()

Source from the content-addressed store, hash-verified

281
282// Text effect 8 - Shepard's distortion
283func textEffect8() {
284 imagick.Initialize()
285 defer imagick.Terminate()
286 // This one uses d_args[0]
287 mw := imagick.NewMagickWand()
288 defer mw.Destroy()
289 dw := imagick.NewDrawingWand()
290 defer dw.Destroy()
291 pw := imagick.NewPixelWand()
292 defer pw.Destroy()
293 // Create a 320x200 transparent canvas
294 pw.SetColor("none")
295 mw.NewImage(640, 480, pw)
296 // Set up a 72 point font
297 dw.SetFont("Verdana-Bold-Italic")
298 dw.SetFontSize(72)
299 // Now draw the text
300 dw.Annotation(50, 240, "Magick Rocks")
301 // Draw the image on to the mw
302 mw.DrawImage(dw)
303 d_args[0] = 150.0
304 d_args[1] = 190.0
305 d_args[2] = 100.0
306 d_args[3] = 290.0
307 d_args[4] = 500.0
308 d_args[5] = 200.0
309 d_args[6] = 430.0
310 d_args[7] = 130.0
311 // DON'T FORGET to set the correct number of arguments here
312 mw.DistortImage(imagick.DISTORTION_SHEPARDS, d_args, true)
313 // Trim the image
314 mw.TrimImage(0)
315 // Add the border
316 pw.SetColor("none")
317 mw.BorderImage(pw, 10, 10)
318 // and write it
319 mw.WriteImage("text_shepards.png")
320}

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