lcolor
--
import "github.com/MJKWoolnough/limage/lcolor"
Usage
var (
GrayAlphaModel = color.ModelFunc(grayAlphaColourModel)
RGBModel = color.ModelFunc(rgbColourModel)
)
Color Models
type AlphaPalette
type AlphaPalette color.Palette
AlphaPalette is an extension to the normal color.Palette type
func (AlphaPalette) Convert
func (ap AlphaPalette) Convert(c color.Color) color.Color
Convert converts the given color to the nearest color in the palette, but
preserves the alpha channel
func (AlphaPalette) Index
func (ap AlphaPalette) Index(c color.Color) int
Index returns the palette index of the nearest color
type GrayAlpha
type GrayAlpha struct {
Y, A uint8
}
GrayAlpha represents a Gray color with an Alpha channel
func (GrayAlpha) RGBA
func (c GrayAlpha) RGBA() (r, g, b, a uint32)
RGBA implements the color.Color interface
func (GrayAlpha) ToNRGBA
func (c GrayAlpha) ToNRGBA() color.NRGBA64
ToNRGBA converts the HSV color into the RGB colorspace
type HSLA
type HSLA struct {
H, S, L, A uint16
}
HSLA represents the Hue, Saturation, Lightness and Alpha of a pixel
func RGBToHSL
func RGBToHSL(cl color.Color) HSLA
RGBToHSL converts
func (HSLA) RGBA
func (h HSLA) RGBA() (uint32, uint32, uint32, uint32)
RGBA implements the color.Color interface
func (HSLA) ToNRGBA
func (h HSLA) ToNRGBA() color.NRGBA64
ToNRGBA converts the HSL color into the RGB colorspace
type HSVA
type HSVA struct {
H, S, V, A uint16
}
HSVA represents the Hue, Saturation, Value and Alpha of a pixel
func RGBToHSV
func RGBToHSV(cl color.Color) HSVA
RGBToHSV converts a color to the HSV color space
func (HSVA) RGBA
func (h HSVA) RGBA() (uint32, uint32, uint32, uint32)
RGBA implements the color.Color interface
func (HSVA) ToNRGBA
func (h HSVA) ToNRGBA() color.NRGBA64
ToNRGBA converts the HSV color into the RGB colorspace
type IndexedAlpha
type IndexedAlpha struct {
I, A uint8
}
IndexedAlpha is the combination of a palette index and an Alpha channel
type RGB
type RGB struct {
R, G, B uint8
}
RGB is a standard colour type whose Alpha channel is always full
func (RGB) RGBA
func (rgb RGB) RGBA() (r, g, b, a uint32)
RGBA implements the color.Color interface
func (RGB) ToNRGBA
func (rgb RGB) ToNRGBA() color.NRGBA64
ToNRGBA returns itself as a non-alpha-premultiplied value As the alpha is always
full, this only returns the normal values