List of usage examples for java.awt Color getBlue
public int getBlue()
From source file:imageprocessingproject.ImageHistogram.java
private static int getGrayValue(int rgb) { Color c = new Color(rgb); return (c.getRed() + c.getGreen() + c.getBlue()) / 3; }
From source file:ColorUtils.java
private static float[] toHSB(Color aColor) { return Color.RGBtoHSB(aColor.getRed(), aColor.getGreen(), aColor.getBlue(), null); }
From source file:Main.java
public static void addColorProperty(Document document, Element parent, String name, Color value) { addPropertyNode(document, parent, name).setAttribute(COLOR_ATTR, value.getRed() + "," + value.getGreen() + "," + value.getBlue()); }
From source file:ColorUtils.java
/** * Darkens a color by a given amount/* w w w . j a va 2 s .c om*/ * * @param color The color to darken * @param amount The amount to darken the color. 0 will leave the color unchanged; 1 will make * the color completely black * @return The stained color */ public static Color stain(Color color, float amount) { int red = (int) ((color.getRed() * (1 - amount) / 255) * 255); int green = (int) ((color.getGreen() * (1 - amount) / 255) * 255); int blue = (int) ((color.getBlue() * (1 - amount) / 255) * 255); return new Color(red, green, blue); }
From source file:modelo.HTMLUtils.java
private static String colorToHex(Color color) { String hex = String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()); return hex;//from w w w . java 2 s . co m }
From source file:Main.java
public static Color neighbour(Color c1, Color c2, double f) { return new Color(c1.getRed() + (int) ((c2.getRed() - c1.getRed()) * f), c1.getGreen() + (int) ((c2.getGreen() - c1.getGreen()) * f), c1.getBlue() + (int) ((c2.getBlue() - c1.getBlue()) * f), c1.getAlpha() + (int) ((c2.getAlpha() - c1.getAlpha()) * f)); }
From source file:Main.java
public static String getColorString(Color color) { StringBuffer buffer = new StringBuffer("#"); //$NON-NLS-1$ appendComponent(buffer, color.getRed()); appendComponent(buffer, color.getGreen()); appendComponent(buffer, color.getBlue()); return buffer.toString(); }
From source file:ColorUtils.java
/** * Lightens a color by a given amount// w w w.ja v a 2s.c om * * @param color The color to lighten * @param amount The amount to lighten the color. 0 will leave the color unchanged; 1 will make * the color completely white * @return The bleached color */ public static Color bleach(Color color, float amount) { int red = (int) ((color.getRed() * (1 - amount) / 255 + amount) * 255); int green = (int) ((color.getGreen() * (1 - amount) / 255 + amount) * 255); int blue = (int) ((color.getBlue() * (1 - amount) / 255 + amount) * 255); return new Color(red, green, blue); }
From source file:Main.java
/** * Adjusts a preset color to a roughness value. * @param orig The original color//from w w w . j a v a 2 s . c om * @param a The roughness value. * @param maxmin The maximum and minimum differential. * @return A color that has been adjust to match the original and roughness. */ public static Color adjust(Color orig, double a, int maxmin) { if (a > 1) a = 1; if (a < 0) a = 0; int r = orig.getRed(); int g = orig.getGreen(); int b = orig.getBlue(); r = (int) (r - (a * maxmin)); g = (int) (g - (a * maxmin)); b = (int) (b - (a * maxmin)); r = colorSnap(r); g = colorSnap(g); b = colorSnap(b); return new Color(r, g, b, orig.getAlpha()); }
From source file:net.sf.maltcms.chromaui.charts.ChartCustomizer.java
/** * * @param color/* w w w.java 2 s . co m*/ * @param alpha * @return */ public static Color withAlpha(Color color, float alpha) { Color ca = new Color(color.getRed(), color.getGreen(), color.getBlue(), (int) (alpha * 255.0f)); return ca; }