Example usage for java.awt Color getTransparency

List of usage examples for java.awt Color getTransparency

Introduction

In this page you can find the example usage for java.awt Color getTransparency.

Prototype

public int getTransparency() 

Source Link

Document

Returns the transparency mode for this Color .

Usage

From source file:Main.java

public static void main(String[] args) {
    Color myColor = Color.RED;

    System.out.println(myColor.getTransparency());

}

From source file:Main.java

public static double getAlpha(Color color, Composite composite) {
    int trans = color.getTransparency();
    if ((trans == Color.TRANSLUCENT || trans == Color.BITMASK)) {
        return color.getAlpha() / 255d;
    }//from w  w w . j  a  v a2 s  .c o m
    if (composite instanceof AlphaComposite) {
        AlphaComposite ac = (AlphaComposite) composite;
        return ac.getAlpha();
    }
    return 1d;
}