Example usage for java.awt Color getRGBComponents

List of usage examples for java.awt Color getRGBComponents

Introduction

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

Prototype

public float[] getRGBComponents(float[] compArray) 

Source Link

Document

Returns a float array containing the color and alpha components of the Color , as represented in the default sRGB color space.

Usage

From source file:Main.java

public static void main(String[] args) {

    Color myColor = Color.RED;

    System.out.println(Arrays.toString(myColor.getRGBComponents(null)));

}

From source file:org.kalypsodeegree_impl.graphics.displayelements.RasterDisplayElement_Impl.java

private Color shadeColor(final Color color, final double shade) {
    final float[] cc = color.getRGBComponents(null);
    for (int i = 0; i < 3; i++)
        cc[i] *= shade;/*  w  w  w.j av a 2  s . c om*/

    return new Color(cc[0], cc[1], cc[2], cc[3]);
}