public class XSSFColor extends ExtendedColor
Constructor and Description |
---|
XSSFColor()
Create an new instance of XSSFColor
|
XSSFColor(byte[] rgb) |
XSSFColor(java.awt.Color clr) |
XSSFColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color)
Create an instance of XSSFColor from the supplied XML bean
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
byte[] |
getARgb()
Deprecated.
Use
getARGB() |
byte[] |
getARGB()
Standard Alpha Red Green Blue ctColor value (ARGB).
|
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor |
getCTColor()
Returns the underlying XML bean
|
short |
getIndex()
Indexed ctColor value.
|
short |
getIndexed()
Indexed ctColor value.
|
byte[] |
getRgb()
Deprecated.
use
getRGB() |
byte[] |
getRGB()
Standard Red Green Blue ctColor value (RGB).
|
byte[] |
getRgbWithTint()
Standard Red Green Blue ctColor value (RGB) with applied tint.
|
protected byte[] |
getStoredRBG()
RGB or ARGB or null
|
int |
getTheme()
Index into the
|
double |
getTint()
Specifies the tint value applied to the ctColor.
|
int |
hashCode() |
boolean |
hasTint()
A boolean value indicating if the ctColor has a tint or not
|
boolean |
isAuto()
A boolean value indicating the ctColor is automatic and system ctColor dependent.
|
boolean |
isIndexed()
A boolean value indicating the ctColor is Indexed
|
boolean |
isRGB()
A boolean value indicating the ctColor is RGB or ARGB based
|
boolean |
isThemed()
A boolean value indicating the ctColor is Theme based
|
void |
setAuto(boolean auto)
A boolean value indicating the ctColor is automatic and system ctColor dependent.
|
void |
setIndexed(int indexed)
Indexed ctColor value.
|
void |
setRgb(byte[] rgb)
Standard Alpha Red Green Blue ctColor value (ARGB).
|
void |
setRGB(byte[] rgb)
Standard Alpha Red Green Blue ctColor value (ARGB).
|
void |
setTheme(int theme)
Index into the
|
void |
setTint(double tint)
Specifies the tint value applied to the ctColor.
|
static XSSFColor |
toXSSFColor(Color color) |
getARGBHex, getRGBOrARGB, getRGBWithTint, setARGBHex, setColor
public XSSFColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color)
public XSSFColor()
public XSSFColor(java.awt.Color clr)
public XSSFColor(byte[] rgb)
public boolean isAuto()
isAuto
in class ExtendedColor
public void setAuto(boolean auto)
public boolean isIndexed()
isIndexed
in class ExtendedColor
public boolean isRGB()
isRGB
in class ExtendedColor
public boolean isThemed()
isThemed
in class ExtendedColor
public boolean hasTint()
public short getIndex()
getIndex
in class ExtendedColor
public short getIndexed()
public void setIndexed(int indexed)
public byte[] getRGB()
getRGB
in class ExtendedColor
public byte[] getRgb()
getRGB()
public byte[] getARGB()
getARGB
in class ExtendedColor
public byte[] getARgb()
getARGB()
protected byte[] getStoredRBG()
ExtendedColor
getStoredRBG
in class ExtendedColor
public byte[] getRgbWithTint()
public void setRgb(byte[] rgb)
public void setRGB(byte[] rgb)
setRGB
in class ExtendedColor
public int getTheme()
getTheme
in class ExtendedColor
public void setTheme(int theme)
public double getTint()
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
getTint
in class ExtendedColor
public void setTint(double tint)
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
setTint
in class ExtendedColor
tint
- the tint value@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor getCTColor()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Copyright 2016 The Apache Software Foundation or its licensors, as applicable.