Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jcontrol.graphics
Class Color

    java.lang.Object
      jcontrol.graphics.Color

    public final class Color

extends Object

The class Color stores a color and offers several functions for decoding and manipulation. The stored color cosists of four 8-bit parameters: red, green, blue and alpha values. Internally a 32-bit ARGB value is used for storing (0x AA RR GG BB). which is compatible to the color functions of the Display class.

Field Summary
`static Color` | `BLACK` The color black.
`static Color` | `BLUE` The color blue.
`static Color` | `CYAN` The color cyan.
`static Color` | `DARK_GRAY` The color dark gray.
`static Color` | `GRAY` The color gray.
`static Color` | `GREEN` The color green.
`static Color` | `LIGHT_GRAY` The color light gray.
`static Color` | `MAGENTA` The color magenta.
`static Color` | `ORANGE` The color orange.
`static Color` | `PINK` The color pink.
`static Color[]` | `rainbowColors` A rainbow color Array.
`static Color` | `RED` The color red.
`static Color` | `WHITE` The color white.
`static Color` | `YELLOW` The color yellow.

Constructor Summary
`Color(Color c)` Constructor: creates a new Color-Object by overgiven Color
`Color(int c)` Constructor: creates a new Color-Object by overgiven RGB-Value
`Color(int r, int g, int b)` Constructor: creates a new Color-Object by overgiven separated RGB-Values
`Color(int r, int g, int b, int a)` Constructor: creates a new Color-Object by overgiven separated RGB-Values with alpha

Method Summary
`int` | `getAlpha()` Returns the alpha value.
`static int` | `getAlphaFromRGB(int argb)` Decodes a given 32bit integer value and returns its alpha fraction
`int` | `getBlue()` Returns the blue value.
`static int` | `getBlueFromRGB(int argb)` Decodes a given 32bit integer value and returns its blue fraction
`int` | `getGreen()` Returns the green value.
`static int` | `getGreenFromRGB(int argb)` Decodes a given 32bit integer value and returns its green fraction
`int` | `getRed()` Returns the red value.
`static int` | `getRedFromRGB(int argb)` Decodes a given ARGB value and returns its red fraction
`int` | `getRGB()` Returns the ARGB value of this Color
`static int` | `getRGB(Color c)` Returns ARGB value of the given Color
`static int` | `getRGB(int r, int g, int b, int a)` Returns the ARGB value of the given color-ammounts
`static Color` | `invertColor(Color c)` Inverts a Color.
`boolean` | `isOpaque()` Checks if the Color is opaque ( alpha = 255).
`void` | `setColor(int r, int g, int b)` Sets the Color's separate red, green and blue values.
`void` | `setColor(int r, int g, int b, int a)` Sets the Color's separate red, green, blue and alpha values.
`void` | `setRGB(int v)` Sets the ARGB value of this Color
`String` | `toString()` creates a human readable color description-string

Methods inherited from class java.lang.Object
`clone, equals, getClass, notifyAll, wait`

Field Detail

### WHITE

    public static final Color WHITE

  The color white.

### LIGHT_GRAY

    public static final Color LIGHT_GRAY

  The color light gray.

### GRAY

    public static final Color GRAY

  The color gray.

### DARK_GRAY

    public static final Color DARK_GRAY

  The color dark gray.

### BLACK

    public static final Color BLACK

  The color black.

### RED

    public static final Color RED

  The color red.

### PINK

    public static final Color PINK

  The color pink.

### ORANGE

    public static final Color ORANGE

  The color orange.

### YELLOW

    public static final Color YELLOW

  The color yellow.

### GREEN

    public static final Color GREEN

  The color green.

### MAGENTA

    public static final Color MAGENTA

  The color magenta.

### CYAN

    public static final Color CYAN

  The color cyan.

### BLUE

    public static final Color BLUE

  The color blue.

### rainbowColors

    public static final Color[] rainbowColors

  A rainbow color Array.

Constructor Detail

### Color

    public Color(Color c)

  Constructor: creates a new Color-Object by overgiven Color

  Parameters:
    `c` -

### Color

    public Color(int c)

  Constructor: creates a new Color-Object by overgiven RGB-Value

  Parameters:
    `c` -

### Color

    public Color(int r,
                 int g,
                 int b)

  Constructor: creates a new Color-Object by overgiven separated RGB-Values

  Parameters:
    `c` -

### Color

    public Color(int r,
                 int g,
                 int b,
                 int a)

  Constructor: creates a new Color-Object by overgiven separated RGB-Values with alpha

  Parameters:
    `c` -

Method Detail

### getRGB

    public int getRGB()

  Returns the ARGB value of this Color

  Returns:
    ARGB value

### getRGB

    public static int getRGB(Color c)

  Returns ARGB value of the given Color

  Parameters:
    `c` - Color to get integer value from
  Returns:
    ARGB value

### setRGB

    public void setRGB(int v)

  Sets the ARGB value of this Color

  Parameters:
    `v` - new ARGB value

### setColor

    public void setColor(int r,
                         int g,
                         int b)

  Sets the Color's separate red, green and blue values. The alpha value gets set to 255.

  Parameters:
    `r` - red value (0-255)
    `g` - green value (0-255)
    `b` - blue value (0-255)

### setColor

    public void setColor(int r,
                         int g,
                         int b,
                         int a)

  Sets the Color's separate red, green, blue and alpha values.

  Parameters:
    `r` - red value (0-255)
    `g` - green value (0-255)
    `b` - blue value (0-255)
    `a` - alpha value (0-255)

### getRed

    public int getRed()

  Returns the red value.

  Returns:
    red value (0-255)

### getGreen

    public int getGreen()

  Returns the green value.

  Returns:
    green value (0-255)

### getBlue

    public int getBlue()

  Returns the blue value.

  Returns:
    blue value (0-255)

### getAlpha

    public int getAlpha()

  Returns the alpha value.

  Returns:
    alpha value (0-255)

### isOpaque

    public boolean isOpaque()

  Checks if the Color is opaque ( alpha = 255).

  Returns:
    true, if Color is opaque

### getRedFromRGB

    public static int getRedFromRGB(int argb)

  Decodes a given ARGB value and returns its red fraction

  Parameters:
    `argb` - 32bit integer value (0x aa rr gg bb)
  Returns:
    red value (0-255)

### getGreenFromRGB

    public static int getGreenFromRGB(int argb)

  Decodes a given 32bit integer value and returns its green fraction

  Parameters:
    `argb` - 32bit integer value (0x aa rr gg bb)
  Returns:
    green value (0-255)

### getBlueFromRGB

    public static int getBlueFromRGB(int argb)

  Decodes a given 32bit integer value and returns its blue fraction

  Parameters:
    `argb` - 32bit integer value (0x aa rr gg bb)
  Returns:
    blue value (0-255)

### getAlphaFromRGB

    public static int getAlphaFromRGB(int argb)

  Decodes a given 32bit integer value and returns its alpha fraction

  Parameters:
    `argb` - 32bit integer value (0x aa rr gg bb)
  Returns:
    alpha value (0-255)

### invertColor

    public static Color invertColor(Color c)

  Inverts a Color. Leaves the alpha-value untouched.

  Parameters:
    `c` - Color
  Returns:
    the inverted Color

### getRGB

    public static int getRGB(int r,
                             int g,
                             int b,
                             int a)

  Returns the ARGB value of the given color-ammounts

  Parameters:
    `r` - ammount of red
    `g` - ammount of green
    `b` - ammound of blue
    `a` - alpha value
  Returns:
    corresponding ARGB value

### toString

    public String toString()

  creates a human readable color description-string

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD