Here you can find the source of noAlpha(final Color col)
Parameter | Description |
---|---|
col | The color. |
public static Color noAlpha(final Color col)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { /**// w w w. j a v a 2 s .c o m * Removes the transparency of the given color. * * @param col The color. * @return The same color without transparency. */ public static Color noAlpha(final Color col) { return noAlpha(col, null); } /** * Removes the transparency of the given color. * * @param col The color. * @param alpha An optional array with a length of at least one that is used * to store the previous alpha value of the color in slot 0. * @return The same color without transparency. */ public static Color noAlpha(final Color col, final float[] alpha) { final float[] comp = col.getRGBComponents(null); if (alpha != null) { alpha[0] = comp[3]; } if (comp[3] == 1) return col; return new Color(comp[0], comp[1], comp[2]); } }