Golang image.Alpha.Opaque function example
package image
func (p *Alpha) Opaque() bool
Opaque scans the entire image and reports whether it is fully opaque.
Golang image.Alpha.Opaque function usage example
package main
import (
"fmt"
"image"
"image/draw"
)
func main() {
canvas := image.NewAlpha(image.Rect(0, 0, 100, 100))
// is this canvas(image) opaque
op := canvas.Opaque()
fmt.Println("canvas is opaque ? ", op)
rgba := image.NewRGBA(image.Rect(0, 0, 100, 100))
// see http://golang.org/pkg/image/#pkg-variables for image.Opaque
draw.Draw(rgba, image.Rect(0, 0, 100, 100), image.Opaque, image.ZP, draw.Src)
op1 := rgba.Opaque()
fmt.Println("rgba is opaque ? ", op1)
}
Output :
canvas is opaque ? false
rgba is opaque ? true
Reference :
Advertisement
Something interesting
Tutorials
+6.4k CodeIgniter : form input set_value cause " to become & quot
+14.6k Golang : Execute function at intervals or after some delay
+29.2k Golang : missing Git command
+15.4k Golang : Find location by IP address and display with Google Map
+5.7k List of Golang XML tutorials
+8.3k Golang: Prevent over writing file with md5 hash
+32.2k Golang : Convert []string to []byte examples
+9.4k Golang : Terminate-stay-resident or daemonize your program?
+6.9k Golang : Pat multiplexer routing example
+25.3k Golang : Get current file path of a file or executable
+6.3k Golang : Detect face in uploaded photo like GPlus
+9.3k Golang : Temperatures conversion example