Golang image.Paletted.ColorModel, Opaque and PixOffset functions example
package image
Golang image.Paletted.ColorModel, Opaque and PixOffset functions usage example
package main
import (
"fmt"
"image"
"image/color"
)
func main() {
p := color.Palette{color.NRGBA{0xf0, 0xf0, 0xf0, 0xff}}
rect := image.Rect(0, 0, 100, 100)
paletted := image.NewPaletted(rect, p)
fmt.Println("ColorModel : ",paletted.ColorModel())
fmt.Println("Opaque : ", paletted.Opaque())
fmt.Println("PixOffset : ", paletted.PixOffset(10,10))
}
Output :
ColorModel : [{240 240 240 255}]
Opaque : true
PixOffset : 1010
References :
http://golang.org/pkg/image/#Paletted.ColorModel
Advertisement
Something interesting
Tutorials
+32.7k Golang : Regular Expression for alphanumeric and underscore
+23.1k Golang : simulate tail -f or read last line from log file example
+11.2k Golang : Calculate Relative Strength Index(RSI) example
+5.2k Golang : Experimental Jawi programming language
+34.1k Golang : Create x509 certificate, private and public keys
+13k Swift : Convert (cast) Int to String ?
+20.9k PHP : Convert(cast) int to double/float
+16.4k Golang : Test floating point numbers not-a-number and infinite example
+19.1k Golang : Display list of time zones with GMT
+6.5k PHP : Shuffle to display different content or advertisement