Class ExtendedColor
- All Implemented Interfaces:
Color
- Direct Known Subclasses:
HSSFExtendedColor
,XSSFColor
XSSFColor
or a
ExtendedColor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract byte[]
getARGB()
abstract short
getIndex()
protected abstract byte[]
abstract byte[]
getRGB()
protected byte[]
byte[]
protected abstract byte[]
abstract int
getTheme()
abstract double
getTint()
Specifies the tint value applied to the ctColor.abstract boolean
isAuto()
abstract boolean
abstract boolean
isRGB()
abstract boolean
isThemed()
void
setARGBHex
(String argb) Sets the ARGB value from hex format, eg FF0077FF.protected void
abstract void
setRGB
(byte[] rgb) Sets the Red Green Blue or Alpha Red Green Blueabstract void
setTint
(double tint) Specifies the tint value applied to the ctColor.
-
Constructor Details
-
ExtendedColor
public ExtendedColor()
-
-
Method Details
-
setColor
- Parameters:
clr
- awt Color to set
-
isAuto
public abstract boolean isAuto()- Returns:
- true if the color is automatic
-
isIndexed
public abstract boolean isIndexed()- Returns:
- true if the color is indexed
-
isRGB
public abstract boolean isRGB()- Returns:
- true if the color is RGB / ARGB
-
isThemed
public abstract boolean isThemed()- Returns:
- true if the color is from a Theme
-
getIndex
public abstract short getIndex()- Returns:
- Indexed Color index value, if
isIndexed()
is true
-
getTheme
public abstract int getTheme()- Returns:
- Index of Theme color, if
isThemed()
is true
-
getRGB
public abstract byte[] getRGB()- Returns:
- Standard Red Green Blue ctColor value (RGB) bytes. If there was an A (Alpha) value, it will be stripped.
-
getARGB
public abstract byte[] getARGB()- Returns:
- Standard Alpha Red Green Blue ctColor value (ARGB) bytes.
-
getStoredRBG
protected abstract byte[] getStoredRBG()- Returns:
- RGB or ARGB bytes or null
-
setRGB
public abstract void setRGB(byte[] rgb) Sets the Red Green Blue or Alpha Red Green Blue- Parameters:
rgb
- bytes
-
getRGBOrARGB
protected byte[] getRGBOrARGB()- Returns:
- RGB or ARGB bytes, either stored or by index
-
getIndexedRGB
protected abstract byte[] getIndexedRGB()- Returns:
- index color RGB bytes, if
isIndexed()
== true, null if not indexed or index is invalid
-
getRGBWithTint
public byte[] getRGBWithTint()- Returns:
- Standard Red Green Blue ctColor value (RGB) bytes with applied tint. Alpha values are ignored.
-
getARGBHex
- Returns:
- the ARGB value in hex string format, eg FF00FF00. Works for both regular and indexed colours.
-
setARGBHex
Sets the ARGB value from hex format, eg FF0077FF. Only works for regular (non-indexed) colours- Parameters:
argb
- color ARGB hex string
-
getTint
public abstract double getTint()Specifies the tint value applied to the ctColor.If tint is supplied, then it is applied to the RGB value of the ctColor to determine the final ctColor applied.
The tint value is stored as a double from -1.0 .. 1.0, where -1.0 means 100% darken and 1.0 means 100% lighten. Also, 0.0 means no change.
In loading the RGB value, it is converted to HLS where HLS values are (0..HLSMAX), where HLSMAX is currently 255.
Here are some examples of how to apply tint to ctColor:If (tint < 0) Lum' = Lum * (1.0 + tint) For example: Lum = 200; tint = -0.5; Darken 50% Lum' = 200 * (0.5) => 100 For example: Lum = 200; tint = -1.0; Darken 100% (make black) Lum' = 200 * (1.0-1.0) => 0 If (tint > 0) Lum' = Lum * (1.0-tint) + (HLSMAX - HLSMAX * (1.0-tint)) For example: Lum = 100; tint = 0.75; Lighten 75% Lum' = 100 * (1-.75) + (HLSMAX - HLSMAX*(1-.75)) = 100 * .25 + (255 - 255 * .25) = 25 + (255 - 63) = 25 + 192 = 217 For example: Lum = 100; tint = 1.0; Lighten 100% (make white) Lum' = 100 * (1-1) + (HLSMAX - HLSMAX*(1-1)) = 100 * 0 + (255 - 255 * 0) = 0 + (255 - 0) = 255
- Returns:
- the tint value
-
setTint
public abstract void setTint(double tint) Specifies the tint value applied to the ctColor.If tint is supplied, then it is applied to the RGB value of the ctColor to determine the final ctColor applied.
The tint value is stored as a double from -1.0 .. 1.0, where -1.0 means 100% darken and 1.0 means 100% lighten. Also, 0.0 means no change.
In loading the RGB value, it is converted to HLS where HLS values are (0..HLSMAX), where HLSMAX is currently 255.
Here are some examples of how to apply tint to ctColor:If (tint < 0) Lum' = Lum * (1.0 + tint) For example: Lum = 200; tint = -0.5; Darken 50% Lum' = 200 * (0.5) => 100 For example: Lum = 200; tint = -1.0; Darken 100% (make black) Lum' = 200 * (1.0-1.0) => 0 If (tint > 0) Lum' = Lum * (1.0-tint) + (HLSMAX - HLSMAX * (1.0-tint)) For example: Lum = 100; tint = 0.75; Lighten 75% Lum' = 100 * (1-.75) + (HLSMAX - HLSMAX*(1-.75)) = 100 * .25 + (255 - 255 * .25) = 25 + (255 - 63) = 25 + 192 = 217 For example: Lum = 100; tint = 1.0; Lighten 100% (make white) Lum' = 100 * (1-1) + (HLSMAX - HLSMAX*(1-1)) = 100 * 0 + (255 - 255 * 0) = 0 + (255 - 0) = 255
- Parameters:
tint
- the tint value
-