Top Description Fields Constructors Methods
org.apache.poi.hssf.usermodel

public Class HSSFExtendedColor

extends ExtendedColor
Class Inheritance
Static Imports
org.apache.poi.hssf.record.common.ExtendedColor.TYPE_AUTO, .ExtendedColor.TYPE_INDEXED, .ExtendedColor.TYPE_RGB, .ExtendedColor.TYPE_THEMED

The HSSF file format normally stores Color information in the Palette (see PaletteRecord), but for a few cases (eg Conditional Formatting, Sheet Extensions), this XSSF-style color record can be used.

Field Summary

Modifier and TypeField and Description
private ExtendedColor

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public byte[]
protected ExtendedColor
public short
protected byte[]
public byte[]
protected byte[]
public int
public double
getTint()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.getTint.

Specifies the tint value applied to the ctColor.

public boolean
public boolean
public boolean
public boolean
public void
setRGB(byte[]
bytes
rgb
)

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.setRGB.

Sets the Red Green Blue or Alpha Red Green Blue

public void
setTint(double
the tint value
tint
)

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.setTint.

Specifies the tint value applied to the ctColor.

Inherited from org.apache.poi.ss.usermodel.ExtendedColor:
getARGBHexgetRGBOrARGBgetRGBWithTintsetARGBHexsetColor

Field Detail

colorback to summary
private ExtendedColor color

Constructor Detail

HSSFExtendedColorback to summary
public HSSFExtendedColor(ExtendedColor color)

Method Detail

getARGBback to summary
public byte[] getARGB()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.getARGB.

Returns:byte[]

Doc from org.apache.poi.ss.usermodel.ExtendedColor.getARGB.

Standard Alpha Red Green Blue ctColor value (ARGB) bytes.

getExtendedColorback to summary
protected ExtendedColor getExtendedColor()
getIndexback to summary
public short getIndex()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.getIndex.

Returns:short

Doc from org.apache.poi.ss.usermodel.ExtendedColor.getIndex.

Indexed Color index value, if isIndexed() is true

getIndexedRGBback to summary
protected byte[] getIndexedRGB()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.getIndexedRGB.

Returns:byte[]

Doc from org.apache.poi.ss.usermodel.ExtendedColor.getIndexedRGB.

index color RGB bytes, if isIndexed() == true, null if not indexed or index is invalid

getRGBback to summary
public byte[] getRGB()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.getRGB.

Returns:byte[]

Doc from org.apache.poi.ss.usermodel.ExtendedColor.getRGB.

Standard Red Green Blue ctColor value (RGB) bytes. If there was an A (Alpha) value, it will be stripped.

getStoredRGBback to summary
protected byte[] getStoredRGB()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.getStoredRGB.

Returns:byte[]

Doc from org.apache.poi.ss.usermodel.ExtendedColor.getStoredRGB.

RGB or ARGB bytes or null

getThemeback to summary
public int getTheme()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.getTheme.

Returns:int

Doc from org.apache.poi.ss.usermodel.ExtendedColor.getTheme.

Index of Theme color, if isThemed() is true

getTintback to summary
public double getTint()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.getTint.

Doc from org.apache.poi.ss.usermodel.ExtendedColor.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:double

the tint value

isAutoback to summary
public boolean isAuto()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.isAuto.

Returns:boolean

Doc from org.apache.poi.ss.usermodel.ExtendedColor.isAuto.

true if the color is automatic

isIndexedback to summary
public boolean isIndexed()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.isIndexed.

Returns:boolean

Doc from org.apache.poi.ss.usermodel.ExtendedColor.isIndexed.

true if the color is indexed

isRGBback to summary
public boolean isRGB()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.isRGB.

Returns:boolean

Doc from org.apache.poi.ss.usermodel.ExtendedColor.isRGB.

true if the color is RGB / ARGB

isThemedback to summary
public boolean isThemed()

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.isThemed.

Returns:boolean

Doc from org.apache.poi.ss.usermodel.ExtendedColor.isThemed.

true if the color is from a Theme

setRGBback to summary
public void setRGB(byte[] rgb)

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.setRGB.

Doc from org.apache.poi.ss.usermodel.ExtendedColor.setRGB.

Sets the Red Green Blue or Alpha Red Green Blue

Parameters
rgb:byte[]

bytes

setTintback to summary
public void setTint(double tint)

Implements abstract org.apache.poi.ss.usermodel.ExtendedColor.setTint.

Doc from org.apache.poi.ss.usermodel.ExtendedColor.setTint.

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:double

the tint value