Documentation
¶
Index ¶
- Variables
- func Distance(a, b Color) float64
- type Color
- type Image
- func (p *Image) At(x, y int) color.Color
- func (p *Image) Bounds() image.Rectangle
- func (p *Image) ColorModel() color.Model
- func (p *Image) OkLabAt(x, y int) Color
- func (p *Image) Opaque() bool
- func (p *Image) PixOffset(x, y int) int
- func (p *Image) RGBA64At(x, y int) color.RGBA64
- func (p *Image) Set(x, y int, c color.Color)
- func (p *Image) SetOkLab(x, y int, c Color)
- func (p *Image) SetRGBA64(x, y int, c color.RGBA64)
- func (p *Image) SubImage(r image.Rectangle) *Image
- type NRGBAColor
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Color ¶
type Color struct {
Lightness, ChromaA, ChromaB, A float64
}
func FromColor ¶
FromColor converts an arbitrary color type to an OKLab Color, with special handling for color.NRGBA, color.NRGBA64, and anything implementing the NRGBAColor interface to preserve transparent colors.
func FromNRGBA ¶
FromNRGBA create an OkLab color from non-pre-multiplied RGBA.
func FromRGBA ¶
FromRGBA create an OkLab color from pre-multiplied RGBA.
func (Color) NRGBA ¶
NRGBA converts to non-premultiplied RGBA.
type Image ¶ added in v0.1.1
Image represents an image that encodes its pixels using OKLab color.
Each pixel is 32 bytes in size, encoding the Lightness, ChromaA, ChromaB, and Alpha components of each pixel in that order as big-endian float64 values.
func (*Image) At ¶ added in v0.1.1
At implements the image.Image interface.
func (*Image) Bounds ¶ added in v0.1.1
Bounds implements the image.Image interface.
func (*Image) ColorModel ¶ added in v0.1.1
ColorModel implements the image.Image interface.
func (*Image) OkLabAt ¶ added in v0.1.1
OkLabAt decodes the pixel at the given coordinates into an OkLab color.
The zero value is returned for coordinates outside of the image.
func (*Image) Opaque ¶ added in v0.1.1
Opaque returns true if every pixel in the image would have an alpha value of 0xffff when converted to color.RGBA64.
func (*Image) PixOffset ¶ added in v0.1.1
PixOffset returns the offset into the [Pix] slice a pixel begins.
The given coordinates must be inside the image.
func (*Image) RGBA64At ¶ added in v0.1.1
RGBA64At implements the image.RGBA64Image interface.
func (*Image) Set ¶ added in v0.1.1
Set implements the draw.Image interface.
func (*Image) SetOkLab ¶ added in v0.1.1
SetOkLab encodes the given color into the pixel at the given coordinates.
Does nothing if the coordinates are outside the image.
func (*Image) SetRGBA64 ¶ added in v0.1.1
Set implements the draw.RGBA64Image interface.
Source Files
¶
- image.go
- oklab.go