本文整理匯總了Golang中github.com/BurntSushi/xgbutil/xgraphics.Image.PixOffset方法的典型用法代碼示例。如果您正苦於以下問題:Golang Image.PixOffset方法的具體用法?Golang Image.PixOffset怎麽用?Golang Image.PixOffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/BurntSushi/xgbutil/xgraphics.Image
的用法示例。
在下文中一共展示了Image.PixOffset方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: convertRGBAtoXgb
// This. This seems to be the solution. 0.72ns/op. RGBA -> RGBA is 0.02ns/op. Draw is 180ns/op.
// from https://github.com/BurntSushi/xgbutil/blob/master/xgraphics/convert.go
func convertRGBAtoXgb(dest *xgraphics.Image, src *image.RGBA) {
var x, y, i, si int
for x = dest.Rect.Min.X; x < dest.Rect.Max.X; x++ {
for y = dest.Rect.Min.Y; y < dest.Rect.Max.Y; y++ {
si = src.PixOffset(x, y)
i = dest.PixOffset(x, y)
dest.Pix[i+0] = src.Pix[si+2]
dest.Pix[i+1] = src.Pix[si+1]
dest.Pix[i+2] = src.Pix[si+0]
dest.Pix[i+3] = src.Pix[si+3]
}
}
}