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
+10.8k PHP : Convert(cast) bigInt to string
+51.1k Golang : Disable security check for HTTPS(SSL) with bad or expired certificate
+7.7k Golang : Mapping Iban to Dunging alphabets
+5.7k Unix/Linux/MacOSx : Get local IP address
+7.3k Golang : How to fix html/template : "somefile" is undefined error?
+8.3k Swift : Convert (cast) Character to Integer?
+16.1k Golang : Generate universally unique identifier(UUID) example
+10.6k Golang : Allow Cross-Origin Resource Sharing request
+12.1k Golang : md5 hash of a string
+36.7k Golang : Display float in 2 decimal points and rounding up or down
+13.5k Golang : How to get year, month and day?