ColorUtils

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openmali.vecmath2.util
Class ColorUtils

    java.lang.Object
      org.openmali.vecmath2.util.ColorUtils

    public final class ColorUtils

extends java.lang.Object

Methods to convert from hex to colors and vice versa.

Author:
  Marvin Froehlich (aka Qudus)

Field Summary
`static int` | `ALPHA_OPAQUE`
`static java.awt.Color` | `BLACK_TRANSPARENT`

Method Summary
`static int` | `checkHexString(java.lang.String hexStr)` Checks the hex-string for validity.
`static int` | `checkHexString(java.lang.String hexStr, boolean throwException)` Checks the hex-string for validity.
`static java.lang.String` | `colorToHex(java.awt.Color color)`
`static java.lang.String` | `colorToHex(int red, int green, int blue)`
`static java.lang.String` | `colorToHex(int red, int green, int blue, int alpha)`
`static java.awt.Color` | `hexToColor(java.lang.String hexStr)`
`static java.awt.Color` | `hexToColor(java.lang.String hexStr, boolean throwException)`
`static boolean` | `hexToColor(java.lang.String hexStr, boolean throwException, int[] buffer)`
`static boolean` | `hexToColor(java.lang.String hexStr, int[] buffer)`
`static int` | `hexToInt(char ch)` Convertes the char interpreded as hex to its corresponding int.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### BLACK_TRANSPARENT

    public static final java.awt.Color BLACK_TRANSPARENT

### ALPHA_OPAQUE

    public static final int ALPHA_OPAQUE

See Also:
  Constant Field Values

Method Detail

### hexToInt

    public static final int hexToInt(char ch)

  Convertes the char interpreded as hex to its corresponding int. Returns -1, if the char is not a hex char.

  Parameters:
    `ch` -
  Returns:
    the corresponding int or -1

### checkHexString

    public static final int checkHexString(java.lang.String hexStr,
                                           boolean throwException)

  Checks the hex-string for validity.

  Parameters:
    `hexStr` -
    `throwException` -
  Returns:
    0 for RGB hex-string without leading #, 1 for RGB hex-string with leading #, 2 for RGBA hex-string without leading #, 3 for RGBA hex-string with leading #

### checkHexString

    public static final int checkHexString(java.lang.String hexStr)

  Checks the hex-string for validity.

  Parameters:
    `hexStr` -
  Returns:
    0 for RGB hex-string without leading #, 1 for RGB hex-string with leading #, 2 for RGBA hex-string without leading #, 3 for RGBA hex-string with leading #

### hexToColor

    public static final boolean hexToColor(java.lang.String hexStr,
                                           boolean throwException,
                                           int[] buffer)

### hexToColor

    public static final boolean hexToColor(java.lang.String hexStr,
                                           int[] buffer)

### hexToColor

    public static final java.awt.Color hexToColor(java.lang.String hexStr,
                                                  boolean throwException)

### hexToColor

    public static final java.awt.Color hexToColor(java.lang.String hexStr)

### colorToHex

    public static final java.lang.String colorToHex(int red,
                                                    int green,
                                                    int blue,
                                                    int alpha)

### colorToHex

    public static final java.lang.String colorToHex(int red,
                                                    int green,
                                                    int blue)

### colorToHex

    public static final java.lang.String colorToHex(java.awt.Color color)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD