Class XSSFColor
- java.lang.Object
-
- org.apache.poi.xssf.usermodel.XSSFColor
-
-
Constructor Summary
Constructors Constructor and Description XSSFColor()Create an new instance of XSSFColorXSSFColor(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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object o)byte[]getARgb()Standard Alpha Red Green Blue ctColor value (ARGB).java.lang.StringgetARGBHex()Return the ARGB value in hex format, eg FF00FF00.org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColorgetCTColor()Returns the underlying XML beanshortgetIndexed()Indexed ctColor value.byte[]getRgb()Standard Red Green Blue ctColor value (RGB).byte[]getRgbWithTint()Standard Red Green Blue ctColor value (RGB) with applied tint.intgetTheme()Index into thecollection, referencing a particular or value expressed in the Theme part. doublegetTint()Specifies the tint value applied to the ctColor.inthashCode()booleanisAuto()A boolean value indicating the ctColor is automatic and system ctColor dependent.voidsetAuto(boolean auto)A boolean value indicating the ctColor is automatic and system ctColor dependent.voidsetIndexed(int indexed)Indexed ctColor value.voidsetRgb(byte[] rgb)Standard Alpha Red Green Blue ctColor value (ARGB).voidsetTheme(int theme)Index into thecollection, referencing a particular or value expressed in the Theme part. voidsetTint(double tint)Specifies the tint value applied to the ctColor.
-
-
-
Constructor Detail
-
XSSFColor
public XSSFColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color)
Create an instance of XSSFColor from the supplied XML bean
-
XSSFColor
public XSSFColor()
Create an new instance of XSSFColor
-
XSSFColor
public XSSFColor(java.awt.Color clr)
-
XSSFColor
public XSSFColor(byte[] rgb)
-
-
Method Detail
-
isAuto
public boolean isAuto()
A boolean value indicating the ctColor is automatic and system ctColor dependent.
-
setAuto
public void setAuto(boolean auto)
A boolean value indicating the ctColor is automatic and system ctColor dependent.
-
getIndexed
public short getIndexed()
Indexed ctColor value. Only used for backwards compatibility. References a ctColor in indexedColors.
-
setIndexed
public void setIndexed(int indexed)
Indexed ctColor value. Only used for backwards compatibility. References a ctColor in indexedColors.
-
getRgb
public byte[] getRgb()
Standard Red Green Blue ctColor value (RGB). If there was an A (Alpha) value, it will be stripped.
-
getARgb
public byte[] getARgb()
Standard Alpha Red Green Blue ctColor value (ARGB).
-
getRgbWithTint
public byte[] getRgbWithTint()
Standard Red Green Blue ctColor value (RGB) with applied tint. Alpha values are ignored.
-
getARGBHex
public java.lang.String getARGBHex()
Return the ARGB value in hex format, eg FF00FF00. Works for both regular and indexed colours.
-
setRgb
public void setRgb(byte[] rgb)
Standard Alpha Red Green Blue ctColor value (ARGB).
-
getTheme
public int getTheme()
Index into thecollection, referencing a particular or value expressed in the Theme part.
-
setTheme
public void setTheme(int theme)
Index into thecollection, referencing a particular or value expressed in the Theme part.
-
getTint
public 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 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
-
getCTColor
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor getCTColor()
Returns the underlying XML bean- Returns:
- the underlying XML bean
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG