本文整理了Java中org.apache.poi.xssf.usermodel.XSSFColor.getTint()
方法的一些代码示例,展示了XSSFColor.getTint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSSFColor.getTint()
方法的具体详情如下:
包路径:org.apache.poi.xssf.usermodel.XSSFColor
类名称:XSSFColor
方法名: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
[中]指定应用于ctColor的色调值。
如果提供了色调,则将其应用于ctColor的RGB值,以确定应用的最终ctColor。
色调值存储为-1.0的双精度值。。1.0,其中-1.0表示100%变暗,1.0表示100%变亮。而且,0.0意味着没有变化。
在加载RGB值时,会将其转换为HLS,其中HLS值为(0..HLSMAX),其中HLSMAX当前为255。
以下是一些如何将色调应用于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
代码示例来源:origin: org.apache.poi/poi-ooxml
private boolean sameTint(XSSFColor other) {
if (hasTint() == other.hasTint()) {
return !hasTint() || getTint() == other.getTint();
}
return false;
}
private boolean sameAuto(XSSFColor other) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
private boolean sameTint(XSSFColor other) {
if (hasTint() == other.hasTint()) {
return !hasTint() || getTint() == other.getTint();
}
return false;
}
private boolean sameAuto(XSSFColor other) {
代码示例来源:origin: jbaliuka/x4j-analytic
public Color getAwtColor(XSSFColor color) {
if(color == null){
return Color.BLACK;
}
if (color.getRgb() != null) {
return new Color(ByteBuffer.wrap(color.getRgb()).getInt(), true);
}
else {
if(color.getIndexed() == 64){
return Color.BLACK;
}
return getAwtColor(color.getTheme(), color.getTint());
}
}
代码示例来源:origin: openl-tablets/openl-tablets
public static short[] toRgb(Color color) {
if (color == null) {
return null;
}
if (color instanceof HSSFColor) {
return ((HSSFColor) color).getTriplet();
} else if (color instanceof XSSFColor) {
byte[] rgb = ((XSSFColor) color).getRGB();
// Byte to short
if (rgb != null) {
return applyTint(rgb, ((XSSFColor) color).getTint());
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!