public class XSSFColor extends ExtendedColor
Constructor and Description |
---|
XSSFColor()
Deprecated.
as of 4.0.0, we want to have the indexed map, and all calling contexts have access to it.
|
XSSFColor(byte[] rgb, IndexedColorMap colorMap) |
XSSFColor(java.awt.Color clr)
Deprecated.
3.17 beta 1 - pass the workbook styles indexed color map, if any
|
XSSFColor(java.awt.Color clr, IndexedColorMap map)
TEST ONLY
|
XSSFColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color)
Deprecated.
3.17 beta 1 - pass the workbook styles indexed color map, if any
|
XSSFColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color, IndexedColorMap map)
Deprecated.
4.0.0 - use the factory
from(CTColor, IndexedColorMap) method instead to check for null CTColor instances. Make private eventually
|
XSSFColor(IndexedColorMap colorMap)
new color with the given indexed color map
|
XSSFColor(IndexedColors indexedColor, IndexedColorMap colorMap) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
static XSSFColor |
from(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color, IndexedColorMap map) |
byte[] |
getARGB()
Standard Alpha Red Green Blue ctColor value (ARGB).
(标准 Alpha 红绿蓝 ctColor 值 (ARGB)。)
|
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor |
getCTColor()
Returns the underlying XML bean
(返回底层 XML bean)
|
short |
getIndex()
Indexed ctColor value.
(索引 ctColor 值。)
|
short |
getIndexed() |
protected byte[] |
getIndexedRGB() |
byte[] |
getRGB()
Standard Red Green Blue ctColor value (RGB).
(标准红绿蓝 ctColor 值 (RGB)。)
|
protected byte[] |
getStoredRBG() |
int |
getTheme()
Index into the
|
double |
getTint()
Specifies the tint value applied to the ctColor.
(指定应用于 ctColor 的色调值。)
|
boolean |
hasAlpha() |
int |
hashCode() |
boolean |
hasTint() |
boolean |
isAuto()
A boolean value indicating the ctColor is automatic and system ctColor dependent.
(指示 ctColor 的布尔值是自动的并且取决于系统 ctColor。)
|
boolean |
isIndexed()
A boolean value indicating the ctColor is Indexed
(指示 ctColor 已索引的布尔值)
|
boolean |
isRGB() |
boolean |
isThemed() |
void |
setAuto(boolean auto) |
void |
setIndexed(int indexed)
Indexed ctColor value.
(索引 ctColor 值。)
|
void |
setRGB(byte[] rgb)
Standard Alpha Red Green Blue ctColor value (ARGB).
(标准 Alpha 红绿蓝 ctColor 值 (ARGB)。)
|
void |
setTheme(int theme)
Index into the
|
void |
setTint(double tint)
Specifies the tint value applied to the ctColor.
(指定应用于 ctColor 的色调值。)
|
static XSSFColor |
toXSSFColor(Color color)
Checked type cast
color to an XSSFColor.
(检查类型将颜色转换为 XSSFColor。)
|
getARGBHex, getRGBOrARGB, getRGBWithTint, setARGBHex, setColor
@Deprecated @Removal(version="4.2") public XSSFColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color)
color
- The
CTColor
to use as color-value.
(color - 用作颜色值的 CTColor。)
@Deprecated @Removal(version="4.2") public XSSFColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color, IndexedColorMap map)
from(CTColor, IndexedColorMap)
method instead to check for null CTColor instances. Make private eventually
color
- The
CTColor
to use as color-value.
(color - 用作颜色值的 CTColor。)
map
- The IndexedColorMap to use instead of the default one
(map - 要使用的 IndexedColorMap,而不是默认的)
@Deprecated @Removal(version="4.2") public XSSFColor()
public XSSFColor(IndexedColorMap colorMap)
colorMap
- The IndexedColorMap to use instead of the default one
(colorMap - 要使用的 IndexedColorMap 代替默认值)
@Deprecated @Removal(version="4.2") public XSSFColor(java.awt.Color clr)
clr
- awt Color
(clr - awt 颜色)
public XSSFColor(java.awt.Color clr, IndexedColorMap map)
clr
- awt Color
(clr - awt 颜色)
map
- The IndexedColorMap to use instead of the default one
(map - 要使用的 IndexedColorMap,而不是默认的)
public XSSFColor(byte[] rgb, IndexedColorMap colorMap)
rgb
- The RGB-byte-values for the Color
(rgb - 颜色的 RGB 字节值)
colorMap
- The IndexedColorMap to use instead of the default one
(colorMap - 要使用的 IndexedColorMap 代替默认值)
public XSSFColor(IndexedColors indexedColor, IndexedColorMap colorMap)
indexedColor
- color index (Enum named for default colors)
(indexedColor - 颜色索引(以默认颜色命名的枚举))
colorMap
- The IndexedColorMap to use instead of the default one
(colorMap - 要使用的 IndexedColorMap 代替默认值)
public static XSSFColor from(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color, IndexedColorMap map)
color
- The ooxml color object to use
(color - 要使用的 ooxml 颜色对象)
map
- The IndexedColorMap to use instead of the default one
(map - 要使用的 IndexedColorMap,而不是默认的)
public boolean isAuto()
isAuto
in class
ExtendedColor
(类 ExtendedColor 中的 isAuto)
public void setAuto(boolean auto)
auto
- true if the ctColor is automatic and system ctColor dependent.
(auto - 如果 ctColor 是自动的并且依赖于系统 ctColor,则为 true。)
public boolean isIndexed()
isIndexed
in class
ExtendedColor
(类 ExtendedColor 中的 isIndexed)
public boolean isRGB()
isRGB
in class
ExtendedColor
(类 ExtendedColor 中的 isRGB)
public boolean isThemed()
isThemed
in class
ExtendedColor
(类 ExtendedColor 中的 isThemed)
public boolean hasAlpha()
public boolean hasTint()
public short getIndex()
getIndex
in class
ExtendedColor
(类 ExtendedColor 中的 getIndex)
ExtendedColor.isIndexed()
is true
(索引颜色索引值,如果 ExtendedColor.isIndexed() 为真)
public short getIndexed()
public void setIndexed(int indexed)
indexed
- color index
(索引 - 颜色索引)
public byte[] getRGB()
getRGB
in class
ExtendedColor
(类 ExtendedColor 中的 getRGB)
public byte[] getARGB()
getARGB
in class
ExtendedColor
(类 ExtendedColor 中的 getARGB)
protected byte[] getStoredRBG()
getStoredRBG
in class
ExtendedColor
(类 ExtendedColor 中的 getStoredRBG)
protected byte[] getIndexedRGB()
getIndexedRGB
in class
ExtendedColor
(类 ExtendedColor 中的 getIndexedRGB)
ExtendedColor.isIndexed()
== true, null if not indexed or index is invalid
(索引颜色 RGB 字节,如果 ExtendedColor.isIndexed() == true,如果没有索引或索引无效,则为 null)
public void setRGB(byte[] rgb)
setRGB
in class
ExtendedColor
(类 ExtendedColor 中的 setRGB)
rgb
- bytes
(RGB - 字节)
public int getTheme()
getTheme
in class
ExtendedColor
(类 ExtendedColor 中的 getTheme)
ExtendedColor.isThemed()
is true
(主题颜色的索引,如果 ExtendedColor.isThemed() 为真)
public void setTheme(int theme)
theme
- index
(主题 - 索引)
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:(指定应用于 ctColor 的色调值。如果提供了 tint,则将其应用于 ctColor 的 RGB 值以确定最终应用的 ctColor。色调值存储为从 -1.0 .. 1.0 开始的双精度值,其中 -1.0 表示 100% 变暗,1.0 表示 100% 变亮。此外,0.0 表示没有变化。在加载 RGB 值时,将其转换为 HLS,其中 HLS 值为 (0..HLSMAX),其中 HLSMAX 当前为 255。以下是一些如何将 tint 应用于 ctColor 的示例: If (tint < 0) Lum' = Lum * (1.0 + tint) 例如:Lum = 200;色调 = -0.5;变暗 50% Lum' = 200 * (0.5) => 100 例如:Lum = 200;色调 = -1.0;变暗 100%(变黑) Lum' = 200 * (1.0-1.0) => 0 If (tint > 0) Lum' = Lum * (1.0-tint) + (HLSMAX - HLSMAX * (1.0-tint)) 例如: 流明 = 100;色调 = 0.75;减轻 75% Lum' = 100 * (1-.75) + (HLSMAX - HLSMAX*(1-.75)) = 100 * .25 + (255 - 255 * .25) = 25 + (255 - 63) = 25 + 192 = 217 例如:流明 = 100;色调 = 1.0;变亮 100%(变白)Lum' = 100 * (1-1) + (HLSMAX - HLSMAX*(1-1)) = 100 * 0 + (255 - 255 * 0) = 0 + (255 - 0) = 255)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
(类 ExtendedColor 中的 getTint)
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:(指定应用于 ctColor 的色调值。如果提供了 tint,则将其应用于 ctColor 的 RGB 值以确定最终应用的 ctColor。色调值存储为从 -1.0 .. 1.0 开始的双精度值,其中 -1.0 表示 100% 变暗,1.0 表示 100% 变亮。此外,0.0 表示没有变化。在加载 RGB 值时,将其转换为 HLS,其中 HLS 值为 (0..HLSMAX),其中 HLSMAX 当前为 255。以下是一些如何将 tint 应用于 ctColor 的示例: If (tint < 0) Lum' = Lum * (1.0 + tint) 例如:Lum = 200;色调 = -0.5;变暗 50% Lum' = 200 * (0.5) => 100 例如:Lum = 200;色调 = -1.0;变暗 100%(变黑) Lum' = 200 * (1.0-1.0) => 0 If (tint > 0) Lum' = Lum * (1.0-tint) + (HLSMAX - HLSMAX * (1.0-tint)) 例如: 流明 = 100;色调 = 0.75;减轻 75% Lum' = 100 * (1-.75) + (HLSMAX - HLSMAX*(1-.75)) = 100 * .25 + (255 - 255 * .25) = 25 + (255 - 63) = 25 + 192 = 217 例如:流明 = 100;色调 = 1.0;变亮 100%(变白)Lum' = 100 * (1-1) + (HLSMAX - HLSMAX*(1-1)) = 100 * 0 + (255 - 255 * 0) = 0 + (255 - 0) = 255)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
(类 ExtendedColor 中的 setTint)
tint
- the tint value
(tint - 色调值)
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor getCTColor()
public static XSSFColor toXSSFColor(Color color)
color
- the color to type cast
(color - 类型转换的颜色)
java.lang.IllegalArgumentException
- if color is null or is not an instance of XSSFColor
(java.lang.IllegalArgumentException - 如果 color 为 null 或不是 XSSFColor 的实例)
public int hashCode()
hashCode
in class
java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class
java.lang.Object
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.