Java Utililty Methods Color Encode

List of utility methods to do Color Encode

  1. HOME
  2. Java
  3. C
  4. Color Encode

Description

The list of methods to do Color Encode are organized into topic(s).

Method

String encode(Color c)
encode
return "#" + hex(c.getAlpha(), 2) + hex(c.getRed(), 2) + hex(c.getGreen(), 2) + hex(c.getBlue(), 2);
String encode(Color color)
encode
return "#" + encode(color.getRed()) + encode(color.getGreen()) + encode(color.getBlue());
String encode(Color color)
encode
char[] buf = new char[8];
String s = Integer.toHexString(color.getRed());
if (s.length() == 1) {
 buf[0] = '0';
 buf[1] = s.charAt(0);
} else {
 buf[0] = s.charAt(0);
 buf[1] = s.charAt(1);
...
String encode(Color color)
Encodes the specified color to a hexadecimal string representation.
if (color == null) {
 return null;
if (color.getAlpha() == MAX_RGB_VALUE) {
 return "#" + Integer.toHexString(color.getRGB()).substring(2);
} else {
 return "#" + Integer.toHexString(color.getRGB());
String encode(Color color)
encode
if (color == null) {
 return null;
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();
int a = color.getAlpha();
return String.format("0x%02x%02x%02x%02x", r, g, b, a);
...
String encode(java.awt.Color c)
encode
int r = c.getRed();
int g = c.getGreen();
int b = c.getBlue();
StringBuffer sb = new StringBuffer();
sb.append("0x");
String red = Integer.toHexString(r);
if (red.length() < 2) {
 sb.append("0");
...
String encodeColor(Color color)
Converts a Color to a hex color string.
if (color == null) {
 return "#808080";
return "#" + String.format("%06x", color.getRGB() & 0xffffff);
String encodeColor(Color color)
encode Color
return color.getRed() + " " + color.getGreen() + " " + color.getBlue() + " " + color.getAlpha();
String encodeColor(Color color)
Encodes a color to a string value equal to the html representation.
return String.format("#%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue());
String encodeColor(int r, int g, int b)
encode Color
return "0x" + String.format("%02x%02x%02x", r, g, b).toUpperCase();


AltStyle によって変換されたページ (->オリジナル) /