package color
Import Path
image/color (on golang.org and go.dev)
Dependency Relation
imports 0 packages, and imported by 6 packages
Involved Source Files
d-> color.go
ycbcr.go
Exported Type Names
type Alpha (struct)
Alpha represents an 8-bit alpha color.
A uint8
( T) RGBA() (r, g, b, a uint32)
T : Color
func image.(*Alpha).AlphaAt(x, y int) Alpha
func image.(*Alpha).SetAlpha(x, y int, c Alpha)
type Alpha16 (struct)
Alpha16 represents a 16-bit alpha color.
A uint16
( T) RGBA() (r, g, b, a uint32)
T : Color
func image.(*Alpha16).Alpha16At(x, y int) Alpha16
func image.(*Alpha16).SetAlpha16(x, y int, c Alpha16)
var Opaque
var Transparent
type CMYK (struct)
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.
C uint8
K uint8
M uint8
Y uint8
( T) RGBA() (uint32, uint32, uint32, uint32)
T : Color
func image.(*CMYK).CMYKAt(x, y int) CMYK
func image.(*CMYK).SetCMYK(x, y int, c CMYK)
type Color (interface)
Color can convert itself to alpha-premultiplied 16-bits per channel RGBA.
The conversion may be lossy.
RGBA returns the alpha-premultiplied red, green, blue and alpha values
for the color. Each value ranges within [0, 0xffff], but is represented
by a uint32 so that multiplying by a blend factor up to 0xffff will not
overflow.
An alpha-premultiplied color component c has been scaled by alpha (a),
so has valid values 0 <= c <= a.
Alpha
Alpha16
CMYK
Gray
Gray16
NRGBA
NRGBA64
NYCbCrA
RGBA
RGBA64
YCbCr
image.(*Uniform)
func Model.Convert(c Color) Color
func Palette.Convert(c Color) Color
func image.(*Alpha).At(x, y int) Color
func image.(*Alpha16).At(x, y int) Color
func image.(*CMYK).At(x, y int) Color
func image.(*Gray).At(x, y int) Color
func image.(*Gray16).At(x, y int) Color
func image.Image.At(x, y int) Color
func image.(*NRGBA).At(x, y int) Color
func image.(*NRGBA64).At(x, y int) Color
func image.(*NYCbCrA).At(x, y int) Color
func image.(*Paletted).At(x, y int) Color
func image.PalettedImage.At(x, y int) Color
func image.Rectangle.At(x, y int) Color
func image.(*RGBA).At(x, y int) Color
func image.(*RGBA64).At(x, y int) Color
func image.(*Uniform).At(x, y int) Color
func image.(*Uniform).Convert(Color) Color
func image.(*YCbCr).At(x, y int) Color
func image/draw.Image.At(x, y int) Color
func Model.Convert(c Color) Color
func Palette.Convert(c Color) Color
func Palette.Index(c Color) int
func image.NewUniform(c Color) *image.Uniform
func image.(*Alpha).Set(x, y int, c Color)
func image.(*Alpha16).Set(x, y int, c Color)
func image.(*CMYK).Set(x, y int, c Color)
func image.(*Gray).Set(x, y int, c Color)
func image.(*Gray16).Set(x, y int, c Color)
func image.(*NRGBA).Set(x, y int, c Color)
func image.(*NRGBA64).Set(x, y int, c Color)
func image.(*Paletted).Set(x, y int, c Color)
func image.(*RGBA).Set(x, y int, c Color)
func image.(*RGBA64).Set(x, y int, c Color)
func image.(*Uniform).Convert(Color) Color
func image/draw.Image.Set(x, y int, c Color)
type Gray (struct)
Gray represents an 8-bit grayscale color.
Y uint8
( T) RGBA() (r, g, b, a uint32)
T : Color
func image.(*Gray).GrayAt(x, y int) Gray
func image.(*Gray).SetGray(x, y int, c Gray)
type Gray16 (struct)
Gray16 represents a 16-bit grayscale color.
Y uint16
( T) RGBA() (r, g, b, a uint32)
T : Color
func image.(*Gray16).Gray16At(x, y int) Gray16
func image.(*Gray16).SetGray16(x, y int, c Gray16)
var Black
var White
type Model (interface)
Model can convert any Color to one from its own color model. The conversion
may be lossy.
( T) Convert(c Color) Color
Palette
image.(*Uniform)
func ModelFunc(f func(Color) Color) Model
func image.(*Alpha).ColorModel() Model
func image.(*Alpha16).ColorModel() Model
func image.(*CMYK).ColorModel() Model
func image.(*Gray).ColorModel() Model
func image.(*Gray16).ColorModel() Model
func image.Image.ColorModel() Model
func image.(*NRGBA).ColorModel() Model
func image.(*NRGBA64).ColorModel() Model
func image.(*NYCbCrA).ColorModel() Model
func image.(*Paletted).ColorModel() Model
func image.PalettedImage.ColorModel() Model
func image.Rectangle.ColorModel() Model
func image.(*RGBA).ColorModel() Model
func image.(*RGBA64).ColorModel() Model
func image.(*Uniform).ColorModel() Model
func image.(*YCbCr).ColorModel() Model
func image/draw.Image.ColorModel() Model
var Alpha16Model
var AlphaModel
var CMYKModel
var Gray16Model
var GrayModel
var NRGBA64Model
var NRGBAModel
var NYCbCrAModel
var RGBA64Model
var RGBAModel
var YCbCrModel
type NRGBA (struct)
NRGBA represents a non-alpha-premultiplied 32-bit color.
A uint8
B uint8
G uint8
R uint8
( T) RGBA() (r, g, b, a uint32)
T : Color
func image.(*NRGBA).NRGBAAt(x, y int) NRGBA
func image.(*NRGBA).SetNRGBA(x, y int, c NRGBA)
type NRGBA64 (struct)
NRGBA64 represents a non-alpha-premultiplied 64-bit color,
having 16 bits for each of red, green, blue and alpha.
A uint16
B uint16
G uint16
R uint16
( T) RGBA() (r, g, b, a uint32)
T : Color
func image.(*NRGBA64).NRGBA64At(x, y int) NRGBA64
func image.(*NRGBA64).SetNRGBA64(x, y int, c NRGBA64)
type NYCbCrA (struct)
NYCbCrA represents a non-alpha-premultiplied Y'CbCr-with-alpha color, having
8 bits each for one luma, two chroma and one alpha component.
A uint8
YCbCr YCbCr
YCbCr.Cb uint8
YCbCr.Cr uint8
YCbCr.Y uint8
( T) RGBA() (uint32, uint32, uint32, uint32)
T : Color
func image.(*NYCbCrA).NYCbCrAAt(x, y int) NYCbCrA
type Palette ([])
Palette is a palette of colors.
Convert returns the palette color closest to c in Euclidean R,G,B space.
Index returns the index of the palette color closest to c in Euclidean
R,G,B,A space.
T : Model
func image/draw.Quantizer.Quantize(p Palette, m image.Image) Palette
func image.NewPaletted(r image.Rectangle, p Palette) *image.Paletted
func image/draw.Quantizer.Quantize(p Palette, m image.Image) Palette
type RGBA (struct)
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.
A uint8
B uint8
G uint8
R uint8
( T) RGBA() (r, g, b, a uint32)
T : Color
func image.(*RGBA).RGBAAt(x, y int) RGBA
func image.(*RGBA).SetRGBA(x, y int, c RGBA)
type RGBA64 (struct)
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.
A uint16
B uint16
G uint16
R uint16
( T) RGBA() (r, g, b, a uint32)
T : Color
func image.(*RGBA64).RGBA64At(x, y int) RGBA64
func image.(*RGBA64).SetRGBA64(x, y int, c RGBA64)
type YCbCr (struct)
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.
Cb uint8
Cr uint8
Y uint8
( T) RGBA() (uint32, uint32, uint32, uint32)
T : Color
func image.(*YCbCr).YCbCrAt(x, y int) YCbCr
Exported Values
var Alpha16Model Model
Models for the standard color types.
var AlphaModel Model
Models for the standard color types.
func CMYKToRGB(c, m, y, k uint8) (uint8, uint8, uint8)
CMYKToRGB converts a CMYK quadruple to an RGB triple.
var Gray16Model Model
Models for the standard color types.
func ModelFunc(f func(Color) Color) Model
ModelFunc returns a Model that invokes f to implement the conversion.
var NRGBA64Model Model
Models for the standard color types.
var NRGBAModel Model
Models for the standard color types.
var NYCbCrAModel Model
NYCbCrAModel is the Model for non-alpha-premultiplied Y'CbCr-with-alpha
colors.
var RGBA64Model Model
Models for the standard color types.
func RGBToCMYK(r, g, b uint8) (uint8, uint8, uint8, uint8)
RGBToCMYK converts an RGB triple to a CMYK quadruple.
func RGBToYCbCr(r, g, b uint8) (uint8, uint8, uint8)
RGBToYCbCr converts an RGB triple to a Y'CbCr triple.
var Transparent Alpha16
Standard colors.
var YCbCrModel Model
YCbCrModel is the Model for Y'CbCr colors.
func YCbCrToRGB(y, cb, cr uint8) (uint8, uint8, uint8)
YCbCrToRGB converts a Y'CbCr triple to an RGB triple.
![]() |
The pages are generated with Golds v0.1.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project and 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. |