Documentation
¶
Index ¶
- Variables
- func DeltaE2000(L1, a1, b1, L2, a2, b2 float64) float64
- func DeltaEBetweenSrgb(r1, g1, b1, r2, g2, b2 float64) float64
- func SrgbToLab(r, g, b float64) (L, a, B float64)
- type ConvertColor
- func (cc *ConvertColor) AddPreviousMatrix(a, b, c [3]float64)
- func (c *ConvertColor) LabToLinearRGB(L, a, b float64) (r, g, bl float64)
- func (c *ConvertColor) LabToSRGB(L, a, b float64) (r, g, bl float64)
- func (c *ConvertColor) LabToSRGBClamp(L, a, b float64) (r, g, bl float64)
- func (c *ConvertColor) LabToSRGBNoGamutMap(L, a, b float64) (r, g, bl float64)
- func (c *ConvertColor) LabToXYZ(L, a, b float64) (X, Y, Z float64)
- func (c *ConvertColor) Matrix() Mat3
- func (c ConvertColor) String() string
- func (c *ConvertColor) XYZToLab(X, Y, Z float64) (L, a, b float64)
- func (c *ConvertColor) XYZToLinearRGB(X, Y, Z float64) (r, g, b float64)
- func (c *ConvertColor) XYZToSRGB(X, Y, Z float64) (r, g, b float64)
- func (c *ConvertColor) XYZToSRGBNoClamp(X, Y, Z float64) (r, g, b float64)
- func (c *ConvertColor) XYZToSRGBNoGamutMap(X, Y, Z float64) (r, g, b float64)
- type Mat3
- type Vec3
Constants ¶
This section is empty.
Variables ¶
var WhiteD50 = Vec3{0.96422, 1.00000, 0.82491}
Standard reference whites (CIE XYZ) normalized so Y = 1.0 Note that WhiteD50 uses Z value from ICC spec rather that CIE spec.
Functions ¶
func DeltaE2000 ¶
DeltaE2000 computes the CIEDE2000 color-difference between two Lab colors. Implementation follows the formula from Sharma et al., 2005.
func DeltaEBetweenSrgb ¶
DeltaEBetweenSrgb takes two sRGB colors (0..1) and returns the Delta E (CIEDE2000).
Types ¶
type ConvertColor ¶
type ConvertColor struct {
// contains filtered or unexported fields
}
func NewConvertColor ¶
func NewConvertColor(whitepoint_x, whitepoint_y, whitepoint_z, scale float64) (ans *ConvertColor)
func NewStandardConvertColor ¶
func NewStandardConvertColor() (ans *ConvertColor)
func (*ConvertColor) AddPreviousMatrix ¶
func (cc *ConvertColor) AddPreviousMatrix(a, b, c [3]float64)
func (*ConvertColor) LabToLinearRGB ¶
func (c *ConvertColor) LabToLinearRGB(L, a, b float64) (r, g, bl float64)
LabToLinearRGB converts Lab to linear RGB (not gamma-corrected), but still with chromatic adaptation to D65 fused into the matrix. Output is linear sRGB.
func (*ConvertColor) LabToSRGB ¶
func (c *ConvertColor) LabToSRGB(L, a, b float64) (r, g, bl float64)
LabToSRGB converts a Lab color (at the specified whitepoint) into sRGB (D65) with gamut mapping. Returned components are in [0,1].
func (*ConvertColor) LabToSRGBClamp ¶
func (c *ConvertColor) LabToSRGBClamp(L, a, b float64) (r, g, bl float64)
LabToSRGBClamp converts Lab(whitepoint) to sRGB(D65) without doing any gamut mapping.
func (*ConvertColor) LabToSRGBNoGamutMap ¶
func (c *ConvertColor) LabToSRGBNoGamutMap(L, a, b float64) (r, g, bl float64)
LabToSRGBNoGamutMap converts Lab(whitepoint) to sRGB(D65) without doing any gamut mapping. Values may be out of [0,1].
func (*ConvertColor) LabToXYZ ¶
func (c *ConvertColor) LabToXYZ(L, a, b float64) (X, Y, Z float64)
LabToXYZ converts Lab (whitepoint) to CIE XYZ values relative to the whitepoint (Y=1).
func (*ConvertColor) Matrix ¶
func (c *ConvertColor) Matrix() Mat3
func (ConvertColor) String ¶
func (c ConvertColor) String() string
func (*ConvertColor) XYZToLab ¶
func (c *ConvertColor) XYZToLab(X, Y, Z float64) (L, a, b float64)
XYZToLab converts XYZ (relative to whitepoint, Y=1) into CIELAB (whitepoint).
func (*ConvertColor) XYZToLinearRGB ¶
func (c *ConvertColor) XYZToLinearRGB(X, Y, Z float64) (r, g, b float64)
XYZToLinearRGB converts XYZ expressed relative to the specified whitepoint directly to linear sRGB values (D65) using the precomputed fused matrix. The output is linear RGB and may be outside the [0,1] range.
func (*ConvertColor) XYZToSRGB ¶
func (c *ConvertColor) XYZToSRGB(X, Y, Z float64) (r, g, b float64)
XYZToSRGB converts XYZ (whitepoint) to sRGB (D65) using the Lab-projection + chroma-scaling gamut mapping. It projects XYZ into CIELAB (whitepoint), reuses the existing LabToSRGB (which performs chroma-scaling if needed), and returns final sRGB.
func (*ConvertColor) XYZToSRGBNoClamp ¶
func (c *ConvertColor) XYZToSRGBNoClamp(X, Y, Z float64) (r, g, b float64)
If you need the non-clamped gamma-corrected values (for checking out-of-gamut) you can use this helper which only compands but doesn't clamp.
func (*ConvertColor) XYZToSRGBNoGamutMap ¶
func (c *ConvertColor) XYZToSRGBNoGamutMap(X, Y, Z float64) (r, g, b float64)
XYZToSRGBNoGamutMap converts XYZ expressed relative to the whitepoint directly to gamma-corrected sRGB values (D65). The outputs are clamped to [0,1]. This function re-uses the precomputed combined matrix and the existing companding function.