本文整理汇总了Golang中github.com/gographics/imagick/imagick.MagickWand.NewPixelIterator方法的典型用法代码示例。如果您正苦于以下问题:Golang MagickWand.NewPixelIterator方法的具体用法?Golang MagickWand.NewPixelIterator怎么用?Golang MagickWand.NewPixelIterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/gographics/imagick/imagick.MagickWand
的用法示例。
在下文中一共展示了MagickWand.NewPixelIterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: tileLineImage
func tileLineImage(wand *imagick.MagickWand) {
it := wand.NewPixelIterator()
it.SetLastIteratorRow()
width := float32(wand.GetImageWidth())
height := float32(wand.GetImageHeight())
heightRemain := float32(int(height / 20))
if heightRemain != 0 {
heightRemain = height/float32(heightRemain) - 20
}
widthRemain := float32(int(width / 20))
if widthRemain != 0 {
widthRemain = width/float32(widthRemain) - 20
}
cnt := it.GetIteratorRow()
it.SetFirstIteratorRow()
heightCount := 0
nextHeight := 21
hLineCount := 0
hRemainCount := heightRemain
widthCount := 0
nextWidth := 21
wLineCount := 0
wRemainCount := widthRemain
for i := 0; i <= cnt; i++ {
heightCount++
it.SetIteratorRow(i)
pws := it.GetCurrentIteratorRow()
if nextHeight-heightCount < 2 {
for j := 0; j < len(pws); j++ {
pws[j].SetColor("#ffffff")
}
if nextHeight == heightCount {
heightCount = 0
hLineCount++
hRemainCount += heightRemain
if hRemainCount > 1 {
hRemainCount -= 1
nextHeight = 21
} else {
nextHeight = 20
}
}
} else {
for j := 0; j < len(pws); j++ {
widthCount++
if nextWidth-widthCount < 2 {
pws[j].SetColor("#ffffff")
if nextWidth == widthCount {
widthCount = 0
wLineCount++
wRemainCount += widthRemain
if wRemainCount > 1 {
wRemainCount -= 1
nextWidth = 21
} else {
nextWidth = 20
}
}
}
// if j % 20 < 2 {
// pws[j].SetColor("#ffffff")
// }
}
}
it.SyncIterator()
}
}