Documentation ¶
Overview ¶
The image package implements a basic 2-D image library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Aqua = ColorImage{RGBAColor{0x00, 0xff, 0xff, 0xff}} Black = ColorImage{RGBAColor{0x00, 0x00, 0x00, 0xff}} Blue = ColorImage{RGBAColor{0x00, 0x00, 0xff, 0xff}} Fuchsia = ColorImage{RGBAColor{0xff, 0x00, 0xff, 0xff}} Gray = ColorImage{RGBAColor{0x80, 0x80, 0x80, 0xff}} Green = ColorImage{RGBAColor{0x00, 0x80, 0x00, 0xff}} Lime = ColorImage{RGBAColor{0x00, 0xff, 0x00, 0xff}} Maroon = ColorImage{RGBAColor{0x80, 0x00, 0x00, 0xff}} Olive = ColorImage{RGBAColor{0x80, 0x80, 0x00, 0xff}} Red = ColorImage{RGBAColor{0xff, 0x00, 0x00, 0xff}} Purple = ColorImage{RGBAColor{0x80, 0x00, 0x80, 0xff}} Silver = ColorImage{RGBAColor{0xc0, 0xc0, 0xc0, 0xff}} Teal = ColorImage{RGBAColor{0x00, 0x80, 0x80, 0xff}} White = ColorImage{RGBAColor{0xff, 0xff, 0xff, 0xff}} Yellow = ColorImage{RGBAColor{0xff, 0xff, 0x00, 0xff}} // These synonyms are not in HTML 4.01. Cyan = Aqua Magenta = Fuchsia )
Colors from the HTML 4.01 specification: http://www.w3.org/TR/REC-html40/types.html#h-6.5 These names do not necessarily match those from other lists, such as the X11 color names.
Functions ¶
This section is empty.
Types ¶
type Alpha ¶
type Alpha struct { // The Pixel field's indices are y first, then x, so that At(x, y) == Pixel[y][x]. Pixel [][]AlphaColor }
An Alpha is an in-memory image backed by a 2-D slice of AlphaColor values.
func (*Alpha) ColorModel ¶
func (p *Alpha) ColorModel() ColorModel
type AlphaColor ¶
type AlphaColor struct {
A uint8
}
An AlphaColor represents an 8-bit alpha.
func (AlphaColor) RGBA ¶
func (c AlphaColor) RGBA() (r, g, b, a uint32)
type Color ¶
type Color interface {
RGBA() (r, g, b, a uint32)
}
All Colors can convert themselves, with a possible loss of precision, to 128-bit alpha-premultiplied RGBA.
type ColorImage ¶
type ColorImage struct {
C Color
}
A ColorImage is a practically infinite-sized Image of uniform Color. It implements both the Color and Image interfaces.
func (ColorImage) At ¶
func (c ColorImage) At(x, y int) Color
func (ColorImage) ColorModel ¶
func (c ColorImage) ColorModel() ColorModel
func (ColorImage) Height ¶
func (c ColorImage) Height() int
func (ColorImage) RGBA ¶
func (c ColorImage) RGBA() (r, g, b, a uint32)
func (ColorImage) Width ¶
func (c ColorImage) Width() int
type ColorModel ¶
A ColorModel can convert foreign Colors, with a possible loss of precision, to a Color from its own color model.
var AlphaColorModel ColorModel = ColorModelFunc(toAlphaColor)
The ColorModel associated with AlphaColor.
var NRGBA64ColorModel ColorModel = ColorModelFunc(toNRGBA64Color)
The ColorModel associated with NRGBA64Color.
var NRGBAColorModel ColorModel = ColorModelFunc(toNRGBAColor)
The ColorModel associated with NRGBAColor.
var RGBA64ColorModel ColorModel = ColorModelFunc(toRGBA64Color)
The ColorModel associated with RGBA64Color.
var RGBAColorModel ColorModel = ColorModelFunc(toRGBAColor)
The ColorModel associated with RGBAColor.
type ColorModelFunc ¶
The ColorModelFunc type is an adapter to allow the use of an ordinary color conversion function as a ColorModel. If f is such a function, ColorModelFunc(f) is a ColorModel object that invokes f to implement the conversion.
func (ColorModelFunc) Convert ¶
func (f ColorModelFunc) Convert(c Color) Color
type Image ¶
type Image interface { ColorModel() ColorModel Width() int Height() int // At(0, 0) returns the upper-left pixel of the grid. // At(Width()-1, Height()-1) returns the lower-right pixel. At(x, y int) Color }
An Image is a rectangular grid of Colors drawn from a ColorModel.
type NRGBA ¶
type NRGBA struct { // The Pixel field's indices are y first, then x, so that At(x, y) == Pixel[y][x]. Pixel [][]NRGBAColor }
A NRGBA is an in-memory image backed by a 2-D slice of NRGBAColor values.
func (*NRGBA) ColorModel ¶
func (p *NRGBA) ColorModel() ColorModel
type NRGBA64 ¶
type NRGBA64 struct { // The Pixel field's indices are y first, then x, so that At(x, y) == Pixel[y][x]. Pixel [][]NRGBA64Color }
A NRGBA64 is an in-memory image backed by a 2-D slice of NRGBA64Color values.
func NewNRGBA64 ¶
NewNRGBA64 returns a new NRGBA64 with the given width and height.
func (*NRGBA64) ColorModel ¶
func (p *NRGBA64) ColorModel() ColorModel
type NRGBA64Color ¶
type NRGBA64Color struct {
R, G, B, A uint16
}
An NRGBA64Color represents a non-alpha-premultiplied 64-bit color, having 16 bits for each of red, green, blue and alpha.
func (NRGBA64Color) RGBA ¶
func (c NRGBA64Color) RGBA() (r, g, b, a uint32)
type NRGBAColor ¶
type NRGBAColor struct {
R, G, B, A uint8
}
An NRGBAColor represents a non-alpha-premultiplied 32-bit color.
func (NRGBAColor) RGBA ¶
func (c NRGBAColor) RGBA() (r, g, b, a uint32)
type Paletted ¶
type Paletted struct { // The Pixel field's indices are y first, then x, so that At(x, y) == Palette[Pixel[y][x]]. Pixel [][]uint8 Palette PalettedColorModel }
A Paletted is an in-memory image backed by a 2-D slice of uint8 values and a PalettedColorModel.
func NewPaletted ¶
func NewPaletted(w, h int, m PalettedColorModel) *Paletted
NewPaletted returns a new Paletted with the given width, height and palette.
func (*Paletted) ColorIndexAt ¶
func (*Paletted) ColorModel ¶
func (p *Paletted) ColorModel() ColorModel
func (*Paletted) SetColorIndex ¶
type PalettedColorModel ¶
type PalettedColorModel []Color
A PalettedColorModel represents a fixed palette of colors.
func (PalettedColorModel) Convert ¶
func (p PalettedColorModel) Convert(c Color) Color
Convert returns the palette color closest to c in Euclidean R,G,B space.
type RGBA ¶
type RGBA struct { // The Pixel field's indices are y first, then x, so that At(x, y) == Pixel[y][x]. Pixel [][]RGBAColor }
An RGBA is an in-memory image backed by a 2-D slice of RGBAColor values.
func (*RGBA) ColorModel ¶
func (p *RGBA) ColorModel() ColorModel
type RGBA64 ¶
type RGBA64 struct { // The Pixel field's indices are y first, then x, so that At(x, y) == Pixel[y][x]. Pixel [][]RGBA64Color }
An RGBA64 is an in-memory image backed by a 2-D slice of RGBA64Color values.
func (*RGBA64) ColorModel ¶
func (p *RGBA64) ColorModel() ColorModel
type RGBA64Color ¶
type RGBA64Color struct {
R, G, B, A uint16
}
An RGBA64Color represents a 64-bit alpha-premultiplied color, having 16 bits for each of red, green, blue and alpha.
func (RGBA64Color) RGBA ¶
func (c RGBA64Color) RGBA() (r, g, b, a uint32)
Directories ¶
Path | Synopsis |
---|---|
The jpeg package implements a decoder for JPEG images, as defined in ITU-T T.81.
|
The jpeg package implements a decoder for JPEG images, as defined in ITU-T T.81. |
The png package implements a PNG image decoder and encoder.
|
The png package implements a PNG image decoder and encoder. |