List of utility methods to do Color to RGB String
String | colourToRgbString(Color colour) colour To Rgb String return new String(colour.getRed() + ", " + colour.getGreen() + ", " + colour.getBlue()); |
String | colourToString(Color colour) colour To String if (colour == null) { return "extend"; } else if (colour.getAlpha() == 0) { return "transparent"; return String.format("#%08X", colour.getRGB()); |
String | colourToString(java.awt.Color c) colour To String return Integer.toHexString(0xFF000000 | c.getRGB()).substring(2);
|
String | toRGB(Color c) convert this color as "rgb(red,green,blue)" if (c == null) return null; return "rgb(" + c.getRed() + "," + c.getGreen() + "," + c.getBlue() + ")"; |
String | toRGB(Color color) Turns the color into RGB notation ("R,G,B" or "A,R,G,B" with A/R/G/B ranging from 0-255). if (color.getAlpha() < 255) return color.getAlpha() + "," + color.getRed() + "," + color.getGreen() + "," + color.getBlue(); else return color.getRed() + "," + color.getGreen() + "," + color.getBlue(); |
int | toRGB(ColorSpace colorSpace, float... components) Returns an rgb value from color components in the specified color space. float[] rgb = colorSpace.toRGB(components); if (rgb[0] < 0f || rgb[1] < 0f || rgb[2] < 0f || rgb[0] > 1f || rgb[1] > 1f || rgb[2] > 1f) { return 0; return 0xff000000 | ((int) (rgb[0] * 255f) << 16) | ((int) (rgb[1] * 255f) << 8) | (int) (rgb[2] * 255f); |
int | toRGB(int red, int green, int blue) to RGB return new Color(red, green, blue).getRGB(); |
short | toRGB565(Color c) Returns a color in the RGB565 format based on a Color instance. if (c == null) { return 0; short rgb = (short) (((c.getRed() & 0xf8) << 8) | ((c.getGreen() & 0xfc) << 3) | (c.getBlue() >> 3)); if (rgb == 0) { return 0x20; if (rgb == 0x20) { ... |
int | toRGBA(Color c) to RGBA return c.getRed() | c.getGreen() << 8 | c.getBlue() << 16 | c.getAlpha() << 24;
|
String | toRGBFunctionCall(Color color) to RGB Function Call StringBuffer sbuf = new StringBuffer(); sbuf.append('#'); String s = Integer.toHexString(color.getRed()); if (s.length() == 1) { sbuf.append('0'); sbuf.append(s); s = Integer.toHexString(color.getGreen()); ... |