List of utility methods to do Color Alpha
Color | premultiplyAlpha(Color fgColor, Color bgColor) premultiply Alpha int r, g, b; r = fgColor.getRed() * fgColor.getAlpha() + bgColor.getRed() * (255 - fgColor.getAlpha()); g = fgColor.getGreen() * fgColor.getAlpha() + bgColor.getGreen() * (255 - fgColor.getAlpha()); b = fgColor.getBlue() * fgColor.getAlpha() + bgColor.getBlue() * (255 - fgColor.getAlpha()); Color result = new Color(r / 255, g / 255, b / 255); return result; |
Color | setColorAlpha(Color c, int alpha) set Color Alpha if (alpha > 255 || alpha < 0) return c; return new Color(c.getRed(), c.getGreen(), c.getBlue(), alpha); |
Color | setColorAlpha(Color color, int alpha) Returns the old color with new alpha value. return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); |
Color | transparent(final Color color, final int alpha) transparent return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); |
Color | transparentColor(Color color, int alpha) transparent Color if (color == null) return null; return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); |
Color | washColor(int red, int green, int blue, int alpha, int amountToWash) wash Color return new Color(red / amountToWash, green / amountToWash, blue / amountToWash, alpha / amountToWash); |