Golang image.NRGBA.Opaque function example

package image

 func (p *NRGBA) Opaque() bool
  

Opaque scans the entire image and reports whether it is fully opaque.

Golang image.NRGBA.Opaque function usage example

 package main

 import (
 "fmt"
 "image"
 )

 func main() {
 canvas := image.NewNRGBA(image.Rect(0, 0, 100, 100)) // or NewNRGBA64

 // is this canvas(image) opaque
 op := canvas.Opaque()

 fmt.Println("canvas is opaque ? ", op)

 }

References :

http://golang.org/pkg/image/#NRGBA.Opaque

Advertisement