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
+9k Golang : Build and compile multiple source files
+5.6k PHP : Convert CSV to JSON with YQL example
+31.7k Golang : How to convert(cast) string to IP address?
+20.6k Golang : Secure(TLS) connection between server and client
+11.6k Golang : Convert(cast) float to int
+17.9k Golang : Login and logout a user after password verification and redirect example
+11.3k Golang : How to use if, eq and print properly in html template
+6.5k PHP : Shuffle to display different content or advertisement
+16.8k Golang : Get own process identifier
+31.5k Golang : bufio.NewReader.ReadLine to read file line by line
+7.1k Golang : Validate credit card example