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
+32.6k Golang : Call a function after some delay(time.Sleep and Tick)
+12.6k Golang : Tutorial on loading GOB and PEM files
+17.9k Golang : How to make function callback or pass value from function as parameter?
+10.1k Golang : How to pipe input data to executing child process?
+5.2k Golang : Selection sort example
+8.5k Golang : ffmpeg with os/exec.Command() returns non-zero status
+17.7k Golang : Populate dropdown with html/template example
+10.2k Golang : Format numbers to nearest thousands such as kilos millions billions and trillions
+10.8k Golang : md5 hash of a string
+4.6k PHP : Convert CSV to JSON with YQL example
+11.3k Golang : Arithmetic operation with numerical slices or arrays example