Source File
color.go
Belonging Package
image/color
package color
RGBA() (r, g, b, a uint32)
}
var (
RGBAModel Model = ModelFunc(rgbaModel)
RGBA64Model Model = ModelFunc(rgba64Model)
NRGBAModel Model = ModelFunc(nrgbaModel)
NRGBA64Model Model = ModelFunc(nrgba64Model)
AlphaModel Model = ModelFunc(alphaModel)
Alpha16Model Model = ModelFunc(alpha16Model)
GrayModel Model = ModelFunc(grayModel)
Gray16Model Model = ModelFunc(gray16Model)
)
func ( Color) Color {
if , := .(RGBA); {
return
}
, , , := .RGBA()
return RGBA{uint8( >> 8), uint8( >> 8), uint8( >> 8), uint8( >> 8)}
}
func ( Color) Color {
if , := .(RGBA64); {
return
}
, , , := .RGBA()
return RGBA64{uint16(), uint16(), uint16(), uint16()}
}
func ( Color) Color {
if , := .(NRGBA); {
return
}
, , , := .RGBA()
if == 0xffff {
return NRGBA{uint8( >> 8), uint8( >> 8), uint8( >> 8), 0xff}
}
if == 0 {
return NRGBA{0, 0, 0, 0}
= ( * 0xffff) /
= ( * 0xffff) /
= ( * 0xffff) /
return NRGBA64{uint16(), uint16(), uint16(), uint16()}
}
func ( Color) Color {
if , := .(Alpha); {
return
}
, , , := .RGBA()
return Alpha{uint8( >> 8)}
}
func ( Color) Color {
if , := .(Alpha16); {
return
}
, , , := .RGBA()
return Alpha16{uint16()}
}
func ( Color) Color {
if , := .(Gray); {
return
}
, , , := .RGBA()
:= -
return ( * ) >> 2
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin 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. |