Alpha16Model var #
Models for the standard color types.
var Alpha16Model Model = *ast.CallExprModels for the standard color types.
var Alpha16Model Model = *ast.CallExprModels for the standard color types.
var AlphaModel Model = *ast.CallExprStandard colors.
var Black = Gray16{...}CMYKModel is the [Model] for CMYK colors.
var CMYKModel Model = *ast.CallExprModels for the standard color types.
var Gray16Model Model = *ast.CallExprModels for the standard color types.
var GrayModel Model = *ast.CallExprModels for the standard color types.
var NRGBA64Model Model = *ast.CallExprModels for the standard color types.
var NRGBAModel Model = *ast.CallExprNYCbCrAModel is the [Model] for non-alpha-premultiplied Y'CbCr-with-alpha colors.
var NYCbCrAModel Model = *ast.CallExprStandard colors.
var Opaque = Alpha16{...}Models for the standard color types.
var RGBA64Model Model = *ast.CallExprModels for the standard color types.
var RGBAModel Model = *ast.CallExprStandard colors.
var Transparent = Alpha16{...}Standard colors.
var White = Gray16{...}YCbCrModel is the [Model] for Y'CbCr colors.
var YCbCrModel Model = *ast.CallExprPalette is a palette of colors.
type Palette []ColorColor can convert itself to alpha-premultiplied 16-bits per channel RGBA. The conversion may be lossy.
type Color interface {
RGBA() (r uint32, g uint32, b uint32, a uint32)
}Model can convert any [Color] to one from its own color model. The conversion may be lossy.
type Model interface {
Convert(c Color) Color
}Alpha represents an 8-bit alpha color.
type Alpha struct {
A uint8
}Alpha16 represents a 16-bit alpha color.
type Alpha16 struct {
A uint16
}CMYK represents a fully opaque CMYK color, having 8 bits for each of cyan, magenta, yellow and black. It is not associated with any particular color profile.
type CMYK struct {
C uint8
M uint8
Y uint8
K uint8
}Gray represents an 8-bit grayscale color.
type Gray struct {
Y uint8
}Gray16 represents a 16-bit grayscale color.
type Gray16 struct {
Y uint16
}NRGBA represents a non-alpha-premultiplied 32-bit color.
type NRGBA struct {
R uint8
G uint8
B uint8
A uint8
}NRGBA64 represents a non-alpha-premultiplied 64-bit color, having 16 bits for each of red, green, blue and alpha.
type NRGBA64 struct {
R uint16
G uint16
B uint16
A uint16
}NYCbCrA represents a non-alpha-premultiplied Y'CbCr-with-alpha color, having 8 bits each for one luma, two chroma and one alpha component.
type NYCbCrA struct {
YCbCr
A uint8
}RGBA represents a traditional 32-bit alpha-premultiplied color, having 8 bits for each of red, green, blue and alpha. An alpha-premultiplied color component C has been scaled by alpha (A), so has valid values 0 <= C <= A.
type RGBA struct {
R uint8
G uint8
B uint8
A uint8
}RGBA64 represents a 64-bit alpha-premultiplied color, having 16 bits for each of red, green, blue and alpha. An alpha-premultiplied color component C has been scaled by alpha (A), so has valid values 0 <= C <= A.
type RGBA64 struct {
R uint16
G uint16
B uint16
A uint16
}YCbCr represents a fully opaque 24-bit Y'CbCr color, having 8 bits each for one luma and two chroma components. JPEG, VP8, the MPEG family and other codecs use this color model. Such codecs often use the terms YUV and Y'CbCr interchangeably, but strictly speaking, the term YUV applies only to analog video signals, and Y' (luma) is Y (luminance) after applying gamma correction. Conversion between RGB and Y'CbCr is lossy and there are multiple, slightly different formulae for converting between the two. This package follows the JFIF specification at https://www.w3.org/Graphics/JPEG/jfif3.pdf.
type YCbCr struct {
Y uint8
Cb uint8
Cr uint8
}type modelFunc struct {
f func(Color) Color
}CMYKToRGB converts a [CMYK] quadruple to an RGB triple.
func CMYKToRGB(c uint8, m uint8, y uint8, k uint8) (uint8, uint8, uint8)Convert returns the palette color closest to c in Euclidean R,G,B space.
func (p Palette) Convert(c Color) Colorfunc (m *modelFunc) Convert(c Color) ColorIndex returns the index of the palette color closest to c in Euclidean R,G,B,A space.
func (p Palette) Index(c Color) intModelFunc returns a [Model] that invokes f to implement the conversion.
func ModelFunc(f func(Color) Color) Modelfunc (c Alpha) RGBA() (r uint32, g uint32, b uint32, a uint32)func (c NYCbCrA) RGBA() (uint32, uint32, uint32, uint32)func (c YCbCr) RGBA() (uint32, uint32, uint32, uint32)func (c CMYK) RGBA() (uint32, uint32, uint32, uint32)func (c Gray16) RGBA() (r uint32, g uint32, b uint32, a uint32)func (c RGBA) RGBA() (r uint32, g uint32, b uint32, a uint32)func (c RGBA64) RGBA() (r uint32, g uint32, b uint32, a uint32)func (c NRGBA) RGBA() (r uint32, g uint32, b uint32, a uint32)func (c NRGBA64) RGBA() (r uint32, g uint32, b uint32, a uint32)func (c Gray) RGBA() (r uint32, g uint32, b uint32, a uint32)func (c Alpha16) RGBA() (r uint32, g uint32, b uint32, a uint32)RGBToCMYK converts an RGB triple to a CMYK quadruple.
func RGBToCMYK(r uint8, g uint8, b uint8) (uint8, uint8, uint8, uint8)RGBToYCbCr converts an RGB triple to a Y'CbCr triple.
func RGBToYCbCr(r uint8, g uint8, b uint8) (uint8, uint8, uint8)YCbCrToRGB converts a Y'CbCr triple to an RGB triple.
func YCbCrToRGB(y uint8, cb uint8, cr uint8) (uint8, uint8, uint8)func alpha16Model(c Color) Colorfunc alphaModel(c Color) Colorfunc cmykModel(c Color) Colorfunc gray16Model(c Color) Colorfunc grayModel(c Color) Colorfunc nYCbCrAModel(c Color) Colorfunc nrgba64Model(c Color) Colorfunc nrgbaModel(c Color) Colorfunc rgba64Model(c Color) Colorfunc rgbaModel(c Color) ColorsqDiff returns the squared-difference of x and y, shifted by 2 so that adding four of those won't overflow a uint32. x and y are both assumed to be in the range [0, 0xffff].
func sqDiff(x uint32, y uint32) uint32func yCbCrModel(c Color) ColorGenerated with Arrow