package image
import (
"image/color"
)
var (
Black = NewUniform (color .Black )
White = NewUniform (color .White )
Transparent = NewUniform (color .Transparent )
Opaque = NewUniform (color .Opaque )
)
type Uniform struct {
C color .Color
}
func (c *Uniform ) RGBA () (r , g , b , a uint32 ) {
return c .C .RGBA ()
}
func (c *Uniform ) ColorModel () color .Model {
return c
}
func (c *Uniform ) Convert (color .Color ) color .Color {
return c .C
}
func (c *Uniform ) Bounds () Rectangle { return Rectangle {Point {-1e9 , -1e9 }, Point {1e9 , 1e9 }} }
func (c *Uniform ) At (x , y int ) color .Color { return c .C }
func (c *Uniform ) RGBA64At (x , y int ) color .RGBA64 {
r , g , b , a := c .C .RGBA ()
return color .RGBA64 {uint16 (r ), uint16 (g ), uint16 (b ), uint16 (a )}
}
func (c *Uniform ) Opaque () bool {
_ , _ , _ , a := c .C .RGBA ()
return a == 0xffff
}
func NewUniform (c color .Color ) *Uniform {
return &Uniform {c }
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .