package color

Import Path
	image/color (on go.dev)

Dependency Relation
	imports 0 packages, and imported by 6 packages

Involved Source Files Package color implements a basic color library. ycbcr.go
Package-Level Type Names (total 14)
/* sort by: | */
Alpha represents an 8-bit alpha color. A uint8 ( Alpha) RGBA() (r, g, b, a uint32) Alpha : Color func image.(*Alpha).AlphaAt(x, y int) Alpha func image.(*Alpha).SetAlpha(x, y int, c Alpha)
Alpha16 represents a 16-bit alpha color. A uint16 ( Alpha16) RGBA() (r, g, b, a uint32) Alpha16 : Color func image.(*Alpha16).Alpha16At(x, y int) Alpha16 func image.(*Alpha16).SetAlpha16(x, y int, c Alpha16) var Opaque var Transparent
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 ( CMYK) RGBA() (uint32, uint32, uint32, uint32) CMYK : Color func image.(*CMYK).CMYKAt(x, y int) CMYK func image.(*CMYK).SetCMYK(x, y int, c CMYK)
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.RGBA64Image.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 image/draw.RGBA64Image.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) func image/draw.RGBA64Image.Set(x, y int, c Color)
Gray represents an 8-bit grayscale color. Y uint8 ( Gray) RGBA() (r, g, b, a uint32) Gray : Color func image.(*Gray).GrayAt(x, y int) Gray func image.(*Gray).SetGray(x, y int, c Gray)
Gray16 represents a 16-bit grayscale color. Y uint16 ( Gray16) RGBA() (r, g, b, a uint32) Gray16 : Color func image.(*Gray16).Gray16At(x, y int) Gray16 func image.(*Gray16).SetGray16(x, y int, c Gray16) var Black var White
Model can convert any [Color] to one from its own color model. The conversion may be lossy. ( Model) 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.RGBA64Image.ColorModel() Model func image.(*Uniform).ColorModel() Model func image.(*YCbCr).ColorModel() Model func image/draw.Image.ColorModel() Model func image/draw.RGBA64Image.ColorModel() Model var Alpha16Model var AlphaModel var CMYKModel var Gray16Model var GrayModel var NRGBA64Model var NRGBAModel var NYCbCrAModel var RGBA64Model var RGBAModel var YCbCrModel
NRGBA represents a non-alpha-premultiplied 32-bit color. A uint8 B uint8 G uint8 R uint8 ( NRGBA) RGBA() (r, g, b, a uint32) NRGBA : Color func image.(*NRGBA).NRGBAAt(x, y int) NRGBA func image.(*NRGBA).SetNRGBA(x, y int, c NRGBA)
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 ( NRGBA64) RGBA() (r, g, b, a uint32) NRGBA64 : Color func image.(*NRGBA64).NRGBA64At(x, y int) NRGBA64 func image.(*NRGBA64).SetNRGBA64(x, y int, c NRGBA64)
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 ( NYCbCrA) RGBA() (uint32, uint32, uint32, uint32) NYCbCrA : Color func image.(*NYCbCrA).NYCbCrAAt(x, y int) NYCbCrA
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. Palette : 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
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 ( RGBA) RGBA() (r, g, b, a uint32) RGBA : Color func image.(*RGBA).RGBAAt(x, y int) RGBA func image.(*RGBA).SetRGBA(x, y int, c RGBA)
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 ( RGBA64) RGBA() (r, g, b, a uint32) RGBA64 : Color func image.(*Alpha).RGBA64At(x, y int) RGBA64 func image.(*Alpha16).RGBA64At(x, y int) RGBA64 func image.(*CMYK).RGBA64At(x, y int) RGBA64 func image.(*Gray).RGBA64At(x, y int) RGBA64 func image.(*Gray16).RGBA64At(x, y int) RGBA64 func image.(*NRGBA).RGBA64At(x, y int) RGBA64 func image.(*NRGBA64).RGBA64At(x, y int) RGBA64 func image.(*NYCbCrA).RGBA64At(x, y int) RGBA64 func image.(*Paletted).RGBA64At(x, y int) RGBA64 func image.Rectangle.RGBA64At(x, y int) RGBA64 func image.(*RGBA).RGBA64At(x, y int) RGBA64 func image.(*RGBA64).RGBA64At(x, y int) RGBA64 func image.RGBA64Image.RGBA64At(x, y int) RGBA64 func image.(*Uniform).RGBA64At(x, y int) RGBA64 func image.(*YCbCr).RGBA64At(x, y int) RGBA64 func image/draw.RGBA64Image.RGBA64At(x, y int) RGBA64 func image.(*Alpha).SetRGBA64(x, y int, c RGBA64) func image.(*Alpha16).SetRGBA64(x, y int, c RGBA64) func image.(*CMYK).SetRGBA64(x, y int, c RGBA64) func image.(*Gray).SetRGBA64(x, y int, c RGBA64) func image.(*Gray16).SetRGBA64(x, y int, c RGBA64) func image.(*NRGBA).SetRGBA64(x, y int, c RGBA64) func image.(*NRGBA64).SetRGBA64(x, y int, c RGBA64) func image.(*Paletted).SetRGBA64(x, y int, c RGBA64) func image.(*RGBA).SetRGBA64(x, y int, c RGBA64) func image.(*RGBA64).SetRGBA64(x, y int, c RGBA64) func image/draw.RGBA64Image.SetRGBA64(x, y int, c RGBA64)
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 ( YCbCr) RGBA() (uint32, uint32, uint32, uint32) YCbCr : Color func image.(*YCbCr).YCbCrAt(x, y int) YCbCr
Package-Level Functions (total 5)
CMYKToRGB converts a [CMYK] quadruple to an RGB triple.
ModelFunc returns a [Model] that invokes f to implement the conversion.
RGBToCMYK converts an RGB triple to a CMYK quadruple.
RGBToYCbCr converts an RGB triple to a Y'CbCr triple.
YCbCrToRGB converts a Y'CbCr triple to an RGB triple.
Package-Level Variables (total 15)
Models for the standard color types.
Models for the standard color types.
Standard colors.
CMYKModel is the [Model] for CMYK colors.
Models for the standard color types.
Models for the standard color types.
Models for the standard color types.
Models for the standard color types.
NYCbCrAModel is the [Model] for non-alpha-premultiplied Y'CbCr-with-alpha colors.
Standard colors.
Models for the standard color types.
Models for the standard color types.
Standard colors.
Standard colors.
YCbCrModel is the [Model] for Y'CbCr colors.