本文整理匯總了Golang中image.RGBA64.PixOffset方法的典型用法代碼示例。如果您正苦於以下問題:Golang RGBA64.PixOffset方法的具體用法?Golang RGBA64.PixOffset怎麽用?Golang RGBA64.PixOffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類image.RGBA64
的用法示例。
在下文中一共展示了RGBA64.PixOffset方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: newAtFuncRGBA64
func newAtFuncRGBA64(p *image.RGBA64) AtFunc {
return func(x, y int) (r, g, b, a uint32) {
i := p.PixOffset(x, y)
r = uint32(p.Pix[i+0])<<8 | uint32(p.Pix[i+1])
g = uint32(p.Pix[i+2])<<8 | uint32(p.Pix[i+3])
b = uint32(p.Pix[i+4])<<8 | uint32(p.Pix[i+5])
a = uint32(p.Pix[i+6])<<8 | uint32(p.Pix[i+7])
return
}
}
示例2: convertRGBA64
func convertRGBA64(dest *Image, src *image.RGBA64) {
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+4]
dest.Pix[i+1] = src.Pix[si+2]
dest.Pix[i+2] = src.Pix[si+0]
dest.Pix[i+3] = src.Pix[si+6]
}
}
}
示例3: newSetFuncRGBA64
func newSetFuncRGBA64(p *image.RGBA64) SetFunc {
return func(x, y int, r, g, b, a uint32) {
i := p.PixOffset(x, y)
r16, g16, b16, a16 := uint16(r), uint16(g), uint16(b), uint16(a)
p.Pix[i+0] = uint8(r16 >> 8)
p.Pix[i+1] = uint8(r16)
p.Pix[i+2] = uint8(g16 >> 8)
p.Pix[i+3] = uint8(g16)
p.Pix[i+4] = uint8(b16 >> 8)
p.Pix[i+5] = uint8(b16)
p.Pix[i+6] = uint8(a16 >> 8)
p.Pix[i+7] = uint8(a16)
}
}
示例4: resizeSlice
// Resize a rectangle image slice
func resizeSlice(input image.Image, output *image.RGBA64, interp InterpolationFunction, scale, adjust, offset float32, slice image.Rectangle, c chan int) {
filter := interp(input, float32(clampFactor(scale)))
var u float32
var color color.RGBA64
for y := slice.Min.Y; y < slice.Max.Y; y++ {
u = scale*(float32(y)+adjust) + offset
filter.SetKernelWeights(u)
for x := slice.Min.X; x < slice.Max.X; x++ {
color = filter.Interpolate(u, x)
i := output.PixOffset(x, y)
output.Pix[i+0] = uint8(color.R >> 8)
output.Pix[i+1] = uint8(color.R)
output.Pix[i+2] = uint8(color.G >> 8)
output.Pix[i+3] = uint8(color.G)
output.Pix[i+4] = uint8(color.B >> 8)
output.Pix[i+5] = uint8(color.B)
output.Pix[i+6] = uint8(color.A >> 8)
output.Pix[i+7] = uint8(color.A)
}
}
c <- 1
}