DVBColor

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.dvb.ui
Class DVBColor

    java.lang.Object
      java.awt.Color
          javax.tv.graphics.AlphaColor
              org.dvb.ui.DVBColor

All Implemented Interfaces:
  Transparency, Serializable

    public class DVBColor

extends AlphaColor

A Color class which adds the notion of alpha. Because DVBColor extends Color the signatures in the existing classes do not change. Classes like Component should work with DVBColor internally. Instances of this class are a container for the values which are passed in to the constructor. Any approximations made by the platform are made when the colors are used. Note: org.dvb.ui.DVBColor adds support for alpha (compared to JDK1.1.8) and is intended to be compatible with the JDK1.2 java.awt.Color class - since org.dvb.ui.DVBColor extends javax.tv.graphics.AlphaColor which in turn extends java.awt.Color. In implementations where java.awt.Color supports alpha, such as JDK1.2, etc., the alpha-related methods in org.dvb.ui.DVBColor could just call super.

Since:
  MHP 1.0
See Also:
  Serialized Form

Field Summary

Fields inherited from class java.awt.Color
`black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOW`

Fields inherited from interface java.awt.Transparency
`BITMASK, OPAQUE, TRANSLUCENT`

Constructor Summary
`DVBColor(Color c)` Constructs a new DVBColor using the specified color.
`DVBColor(float r, float g, float b, float a)` Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0,0 to 1,0).
`DVBColor(int rgba, boolean hasalpha)` Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24 to 31, the red component in bits 16 to 23, the green component in bits 8 to 15, and the blue component in bits 0 to 7.
`DVBColor(int r, int g, int b, int a)` Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 to 255).

Method Summary
`Color` | `brighter()` Creates a brighter version of this color.
`Color` | `darker()` Creates a darker version of this color.
`boolean` | `equals(Object obj)` Determines whether another object is equal to this color.
`int` | `getAlpha()` Returns the alpha component.
`int` | `getRGB()` Returns the RGB value representing the color in the default sRGB ColorModel.
`String` | `toString()` Creates a string that represents this color and indicates the values of its ARGB components.

Methods inherited from class javax.tv.graphics.AlphaColor
`hashCode`

Methods inherited from class java.awt.Color
`decode, getBlue, getColor, getColor, getColor, getColorComponents, getColorSpace, getComponents, getGreen, getHSBColor, getRed, getRGBColorComponents, getRGBComponents, getTransparency, HSBtoRGB, RGBtoHSB`

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

Constructor Detail

### DVBColor

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

  Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0,0 to 1,0). The actual color used in rendering will depend on finding the best match given the color space available for a given output device.

  Parameters:
    `r` - the red component
    `g` - the green component
    `b` - the blue component
    `a` - the alpha component
  See Also:
    `Color.getRed()`, `Color.getGreen()`, `Color.getBlue()`, `getAlpha()`, `getRGB()`

### DVBColor

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

  Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 to 255).

  Parameters:
    `r` - the red component
    `g` - the green component
    `b` - the blue component
    `a` - the alpha component
  See Also:
    `Color.getRed()`, `Color.getGreen()`, `Color.getBlue()`, `getAlpha()`, `getRGB()`

### DVBColor

    public DVBColor(int rgba,
                    boolean hasalpha)

  Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24 to 31, the red component in bits 16 to 23, the green component in bits 8 to 15, and the blue component in bits 0 to 7. If the hasalpha argument is False, alpha is defaulted to 255.

  Parameters:
    `rgba` - the combined RGBA components
    `hasalpha` - true if the alpha bits are valid, false otherwise
  See Also:
    `Color.getRed()`, `Color.getGreen()`, `Color.getBlue()`, `getAlpha()`, `getRGB()`

### DVBColor

    public DVBColor(Color c)

  Constructs a new DVBColor using the specified color. If c supports alpha, e.g. if it is an instance of javax.tv.graphics.AlphaColor or JDK 1.2's java.awt.Color, then the alpha value of c shall be used. If this color has no alpha value, alpha will be set to 255 (opaque).

  Parameters:
    `c` - the java.awt.Color used to create a new DVBColor

Method Detail

### brighter

    public Color brighter()

  Creates a brighter version of this color. This method applies an arbitrary scale factor to each of the three RGB components of the color to create a brighter version of the same color. Although brighter and darker are inverse operations, the results of a series of invocations of these two methods may be inconsistent because of rounding errors. The alpha value shall be preserved.

  Overrides:
    `brighter` in class `AlphaColor`
  Returns:
    a new DVBColor object (cast to a java.awt.Color object) representing a brighter version of this color. Applications can recast it to a org.dvb.ui.DVBColor object
  See Also:
    `Color.brighter()`

### darker

    public Color darker()

  Creates a darker version of this color. This method applies an arbitrary scale factor to each of the three RGB components of the color to create a darker version of the same color. Although brighter and darker are inverse operations, the results of a series of invocations of these two methods may be inconsistent because of rounding errors. The alpha value shall be preserved.

  Overrides:
    `darker` in class `AlphaColor`
  Returns:
    a new DVBColor object (cast to a java.awt.Color object), representing a darker version of this color. Applications can recast it to a org.dvb.ui.DVBColor object
  See Also:
    `Color.darker()`

### equals

    public boolean equals(Object obj)

  Determines whether another object is equal to this color. The result is true if and only if the argument is not null and is a DVBColor object that has the same red, green, blue and alpha values as this object.

  Overrides:
    `equals` in class `AlphaColor`
  Parameters:
    `obj` - - the object to compare with.
  Returns:
    true if the objects are the same; false otherwise.
  Since:
    MHP 1.0
  See Also:
    `Object.hashCode()`, `Hashtable`

### getAlpha

    public int getAlpha()

  Returns the alpha component. In the range 0 to 255.

  Overrides:
    `getAlpha` in class `AlphaColor`
  Returns:
    the alpha component
  See Also:
    `getRGB()`

### getRGB

    public int getRGB()

  Returns the RGB value representing the color in the default sRGB ColorModel. (Bits 24 to 31 are alpha, 16 to 23 are red, 8 to 15 are green, 0 to 7 are blue).

  Overrides:
    `getRGB` in class `AlphaColor`
  Returns:
    the RGB value representing the color in the default sRGB ColorModel.
  Since:
    MHP 1.0
  See Also:
    `Color.getRed()`, `Color.getGreen()`, `Color.getBlue()`, `getAlpha()`

### toString

    public String toString()

  Creates a string that represents this color and indicates the values of its ARGB components.

  Overrides:
    `toString` in class `AlphaColor`
  Returns:
    a representation of this color as a String object.
  Since:
    MHP 1.0

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

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