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
+5.9k Golang : Generate multiplication table from an integer example
+15.9k Golang : Update database with GORM example
+13.9k Golang : How to check if a file is hidden?
+7.1k Golang : Gorrila mux.Vars() function example
+9.9k Golang : Translate language with language package example
+7.1k Nginx : How to block user agent ?
+9k Golang : Capture text return from exec function example
+6.8k Get Facebook friends working in same company
+6.3k WARNING: UNPROTECTED PRIVATE KEY FILE! error message
+80.6k Golang : How to return HTTP status code?
+51.1k Golang : Disable security check for HTTPS(SSL) with bad or expired certificate