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

## de.rico.engine.material
Class Color4f

    java.lang.Object
      de.rico.engine.material.Color4f

    public class Color4f

extends java.lang.Object

This class represents a RGBA color.

Author:
  Frank Bruns

Field Summary
`float` | `alpha`
`float` | `blue`
`float` | `green`
`float` | `red`

Constructor Summary
`Color4f()` Creates a new RGAB color object with white color.
`Color4f(float r, float g, float b, float a)` Creates a new RGBA color object.

Method Summary
`Color4f` | `clone()`
`boolean` | `equals(Color4f color)` This method checks this color for equality with the specified color.
`boolean` | `equals(float r, float g, float b, float a)` /** This method checks this color for equality with the specified color.
`float` | `getAlpha()` Returns the alpha of the color.
`float` | `getBlue()` Returns the amount of blue in the color.
`float` | `getGreen()` Returns the amount of gree in the color.
`float` | `getRed()` Returns the amount of red in the color.
`void` | `setAlpha(float a)` Sets the alpha vlaue (0.0f - 1.0f) of the color
`void` | `setBlue(float b)` Sets the amount of blue (0.0f - 1.0f) in the color
`void` | `setColor(Color4f c)` Sets this color to the specified color.
`void` | `setColor(float r, float g, float b, float a)` Sets this color to the specified color.
`void` | `setGreen(float g)` Sets the amount of green (0.0f - 1.0f) in the color
`void` | `setRed(float r)` Sets the amount of red (0.0f - 1.0f) in the color
`float[]` | `toArray()` Returns the color in a float array representation.

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

Field Detail

### red

    public float red

### green

    public float green

### blue

    public float blue

### alpha

    public float alpha

Constructor Detail

### Color4f

    public Color4f()

  Creates a new RGAB color object with white color.

### Color4f

    public Color4f(float r,
                   float g,
                   float b,
                   float a)

  Creates a new RGBA color object.

  Parameters:
    `r` - amount of red (0.0f - 1.0f)
    `g` - amount of green (0.0f - 1.0f)
    `b` - amount of blue (0.0f - 1.0f)
    `a` - alpha value (0.0f - 1.0f)

Method Detail

### setColor

    public void setColor(Color4f c)

  Sets this color to the specified color.

  Parameters:
    `c` - new color

### setColor

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

  Sets this color to the specified color.

  Parameters:
    `r` - amount of red (0.0f - 1.0f)
    `g` - amount of green (0.0f - 1.0f)
    `b` - amount of blue (0.0f - 1.0f)
    `a` - alpha value (0.0f - 1.0f)

### toArray

    public float[] toArray()

  Returns the color in a float array representation. This is useful for some OpenGL commands that require the color as an array of floats.

  Returns:
    color in float array representation

### clone

    public Color4f clone()

  Overrides:
    `clone` in class `java.lang.Object`

### getRed

    public float getRed()

  Returns the amount of red in the color.

  Returns:
    amount of red

### getGreen

    public float getGreen()

  Returns the amount of gree in the color.

  Returns:
    amount of green

### getBlue

    public float getBlue()

  Returns the amount of blue in the color.

  Returns:
    amount of blue

### getAlpha

    public float getAlpha()

  Returns the alpha of the color.

  Returns:
    alpha value

### setRed

    public void setRed(float r)

  Sets the amount of red (0.0f - 1.0f) in the color

  Parameters:
    `r` - amount of red

### setGreen

    public void setGreen(float g)

  Sets the amount of green (0.0f - 1.0f) in the color

  Parameters:
    `g` - amount of green

### setBlue

    public void setBlue(float b)

  Sets the amount of blue (0.0f - 1.0f) in the color

  Parameters:
    `b` - amount of blue

### setAlpha

    public void setAlpha(float a)

  Sets the alpha vlaue (0.0f - 1.0f) of the color

  Parameters:
    `a` - alpha value

### equals

    public boolean equals(Color4f color)

  This method checks this color for equality with the specified color.

  Parameters:
    `color` - color to check for equality
  Returns:
    are colors equal? --> true=yes, false=no

### equals

    public boolean equals(float r,
                          float g,
                          float b,
                          float a)

  /** This method checks this color for equality with the specified color.

  Parameters:
    `r` - amount of red
    `g` - amount of green
    `b` - amount of blue
    `a` - amount of alpha
  Returns:
    are colors equal? --> true=yes, false=no

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