Example usage for org.apache.poi.xssf.usermodel XSSFColor setTint

List of usage examples for org.apache.poi.xssf.usermodel XSSFColor setTint

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFColor setTint.

Prototype

@Override
public void setTint(double tint) 

Source Link

Document

Specifies the tint value applied to the ctColor.

Usage

From source file:org.tiefaces.components.websheet.utility.ColorUtility.java

License:MIT License

/**
 * assemble xssfcolor with tint/lumoff/lummod/alpha to xcolor.
 * //from w w  w  .  jav  a2s. co  m
 * @param bcolor
 *            xssfcolor
 * @param preTint
 *            tint
 * @param lumOff
 *            lumOff
 * @param lumMod
 *            lummod
 * @param alphaInt
 *            alpha
 * @return xcolor
 */
private static XColor assembleXcolor(final XSSFColor bcolor, final double preTint, final int lumOff,
        final int lumMod, final int alphaInt) {

    if (bcolor == null) {
        return null;
    }

    double tint = preTint;
    if (Double.compare(tint, 0) == 0) {
        // no preTint
        if (lumOff > 0) {
            tint = lumOff / MILLION_NUMBERS;
        } else {
            if (lumMod > 0) {
                tint = -1 * (lumMod / MILLION_NUMBERS);
            }
        }
    }

    bcolor.setTint(tint);

    double alpha = 0;
    if (alphaInt > 0) {
        alpha = alphaInt / MILLION_NUMBERS;
    }

    return new XColor(bcolor, alpha);

}