本文整理匯總了Golang中github.com/gographics/imagick/imagick.MagickWand.AnnotateImage方法的典型用法代碼示例。如果您正苦於以下問題:Golang MagickWand.AnnotateImage方法的具體用法?Golang MagickWand.AnnotateImage怎麽用?Golang MagickWand.AnnotateImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/gographics/imagick/imagick.MagickWand
的用法示例。
在下文中一共展示了MagickWand.AnnotateImage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: draw_metrics
// The easiest (?) way to handle vertical text placement is
// not to use gravity at all because then you know that all the text is
// placed relative to ImageMagick's (0,0) coordinate which is the top left of
// the screen and the baseline will be y=0.
func draw_metrics(mw *imagick.MagickWand, dw *imagick.DrawingWand, dx *float64, dy, sx float64, text string) {
mw.AnnotateImage(dw, *dx, dy, 0, text)
mw.DrawImage(dw)
// get the font metrics
fm := mw.QueryFontMetrics(dw, text)
if fm != nil {
// Adjust the new x coordinate
*dx += fm.TextWidth + sx
}
}
示例2: drawMetrics
func drawMetrics(mw *imagick.MagickWand, dw *imagick.DrawingWand, dx *float64, text string) {
rotation := float64(random(-30, 30))
mw.AnnotateImage(dw, *dx, 35, rotation, text)
mw.DrawImage(dw)
// get the font metrics
fm := mw.QueryFontMetrics(dw, text)
if fm != nil {
// Adjust the new x coordinate
*dx += fm.TextWidth + 2
}
}