Class LABColorValue
java.lang.Object
io.sf.carte.doc.style.css.property.StyleValue
io.sf.carte.doc.style.css.property.PrimitiveValue
io.sf.carte.doc.style.css.property.TypedValue
io.sf.carte.doc.style.css.property.ColorValue
io.sf.carte.doc.style.css.property.LABColorValue
- All Implemented Interfaces:
CSSColorValue
,CSSPrimitiveValue
,CSSTypedValue
,CSSValue
,LABColorValue
,Serializable
,Cloneable
Lab color value.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSColorValue
CSSColorValue.ColorModel
Nested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSValue
CSSValue.CssType, CSSValue.Type
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a copy of this object.float
deltaE2000
(CSSColorValue color) Compute the difference to the given color, according to CIE Delta E 2000.boolean
getColor()
Get thelab()
oroklab()
color represented by this value.Get the color model with which this value was set.getComponent
(int index) Get the color component atindex
.Get a string representation of the current value.getMinifiedCssText
(String propertyValue) Gives a minified version of the css text of the property.int
hashCode()
void
setComponent
(int index, StyleValue component) Set the color component atindex
.Convert this value to aLABColorValue
, if possible.Convert this value to aLCHColorValue
, if possible.If this value represents a color, get it or transform to a RGB color.toRGBColor
(boolean clamp) Get the RGB(A) color representation of this value.void
writeCssText
(io.sf.carte.util.SimpleWriter wri) Serialize this value to aSimpleWriter
.Methods inherited from class io.sf.carte.doc.style.css.property.ColorValue
isSystemDefault, setCssText, setSystemDefault, toHSLColorValue
Methods inherited from class io.sf.carte.doc.style.css.property.TypedValue
getCssValueType, getFloatValue, getStringValue, isCalculatedNumber, isNumberZero, setFloatValue, setStringValue
Methods inherited from class io.sf.carte.doc.style.css.property.PrimitiveValue
getPrimitiveType, isPrimitiveValue, isSubproperty, setExpectInteger, setSubproperty
Methods inherited from class io.sf.carte.doc.style.css.property.StyleValue
matches, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.sf.carte.doc.style.css.CSSPrimitiveValue
getUnitType, isNegativeNumber, setExpectInteger
Methods inherited from interface io.sf.carte.doc.style.css.CSSTypedValue
getFloatValue, getStringValue, isCalculatedNumber, isNumberZero, setFloatValue, setStringValue, toRGBColorValue
Methods inherited from interface io.sf.carte.doc.style.css.CSSValue
getCssValueType, getPrimitiveType, matches, setCssText
-
Constructor Details
-
LABColorValue
public LABColorValue()
-
-
Method Details
-
getColorModel
Description copied from interface:CSSColorValue
Get the color model with which this value was set.- Specified by:
getColorModel
in interfaceCSSColorValue
- Returns:
- the color model.
-
getCssText
Description copied from class:StyleValue
Get a string representation of the current value.- Specified by:
getCssText
in interfaceCSSValue
- Overrides:
getCssText
in classColorValue
- Returns:
- the css text representing the value of this property.
-
getMinifiedCssText
Description copied from interface:CSSValue
Gives a minified version of the css text of the property.It may be customized for the given property name.
- Specified by:
getMinifiedCssText
in interfaceCSSValue
- Overrides:
getMinifiedCssText
in classColorValue
- Parameters:
propertyValue
- the property name.- Returns:
- the minified css text.
-
writeCssText
Description copied from interface:CSSValue
Serialize this value to aSimpleWriter
.- Specified by:
writeCssText
in interfaceCSSValue
- Overrides:
writeCssText
in classColorValue
- Parameters:
wri
- the SimpleWriter.- Throws:
IOException
- if an error happened while writing.
-
getComponent
Description copied from class:ColorValue
Get the color component atindex
.This method allows to access the color components like if they were indexed. It is convenient to perform common tasks at the components (like when computing values).
- Specified by:
getComponent
in classColorValue
- Parameters:
index
- the index. Index0
is always the alpha channel.- Returns:
- the color component, or
null
if the index is incorrect.
-
setComponent
Description copied from class:ColorValue
Set the color component atindex
.This method allows to access the components regardless of them being formally indexed or not. It is convenient to perform common tasks at the components (like when computing values).
- Overrides:
setComponent
in classColorValue
- Parameters:
index
- the index. For colors, index0
is always the alpha channel. Setting a component at an index that does not exist has no effect.component
- the new color component. Must be a primitive value (that is, eitherTYPED
or aPROXY
).
-
toRGBColor
Description copied from interface:CSSTypedValue
If this value represents a color, get it or transform to a RGB color.If the color does not map into the sRGB gamut, it is clamped.
- Specified by:
toRGBColor
in interfaceCSSTypedValue
- Overrides:
toRGBColor
in classTypedValue
- Returns:
- the RGBA color.
- Throws:
DOMException
- INVALID_ACCESS_ERR: if this value can't return a RGB color value (either is not aCOLOR
or not a typed value).
NOT_SUPPORTED_ERR: if the conversion needs device color space information to be performed accurately.
-
toRGBColor
Description copied from interface:CSSColorValue
Get the RGB(A) color representation of this value.The returned value is implicitly in the sRGB color space, unless stated otherwise.
- Specified by:
toRGBColor
in interfaceCSSColorValue
- Parameters:
clamp
-true
if the converted value has to be clamped when it does not fall into the sRGB color gamut.- Returns:
- the RGBA color value.
- Throws:
DOMException
- INVALID_ACCESS_ERR: if this value can't return a RGB color value (either is not aCOLOR
, not a typed value, orclamp
is false and the color does not map into the -implicit- sRGB color space).
NOT_SUPPORTED_ERR: if the conversion needs device color space information to be performed accurately.
-
toLABColorValue
Description copied from class:ColorValue
Convert this value to aLABColorValue
, if possible.- Specified by:
toLABColorValue
in interfaceCSSColorValue
- Overrides:
toLABColorValue
in classColorValue
- Returns:
- the converted
LABColorValue
.
-
toLCHColorValue
Description copied from interface:CSSColorValue
Convert this value to aLCHColorValue
, if possible.- Specified by:
toLCHColorValue
in interfaceCSSColorValue
- Overrides:
toLCHColorValue
in classColorValue
- Returns:
- the converted
LCHColorValue
. - Throws:
DOMException
- INVALID_STATE_ERR if the components cannot be converted.
-
getColor
Description copied from interface:LABColorValue
Get thelab()
oroklab()
color represented by this value.- Specified by:
getColor
in interfaceCSSColorValue
- Specified by:
getColor
in interfaceLABColorValue
- Returns:
- the
lab()
oroklab()
color.
-
deltaE2000
Description copied from interface:CSSColorValue
Compute the difference to the given color, according to CIE Delta E 2000.- Specified by:
deltaE2000
in interfaceCSSColorValue
- Overrides:
deltaE2000
in classColorValue
- Parameters:
color
- the color to compute the delta from.- Returns:
- the CIE Delta E 2000.
-
hashCode
public int hashCode()- Overrides:
hashCode
in classPrimitiveValue
-
equals
- Overrides:
equals
in classPrimitiveValue
-
clone
Description copied from class:TypedValue
Creates and returns a copy of this object.The object will be the same except for the
subproperty
flag, that will be disabled in the clone object.- Specified by:
clone
in interfaceCSSColorValue
- Specified by:
clone
in interfaceCSSValue
- Specified by:
clone
in interfaceLABColorValue
- Specified by:
clone
in classColorValue
- Returns:
- a copy of this object.
-