com.moximedia.ows
Class Color

java.lang.Object
  extended bycom.moximedia.ows.Color
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Color
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Cloneable color object.

Author:
Doug Cates - www.moximedia.com
See Also:
Serialized Form

Constructor Summary
Color()
          Creates a new instance of Color
Color(java.awt.Color color)
          Creates a new instance of Color from a java.awt.Color
Color(int r, int g, int b)
          Creates a new Color object with red, green, blue arguments.
Color(int r, int g, int b, int a)
          Creates a new Color object with red, green, blue and alpha arguments.
Color(java.lang.String colorString)
          Creates a new Color object with red, green, blue arguments contained in a String.
 
Method Summary
 java.lang.Object clone()
          Gets a clone of this object.
 int getAlpha()
          Returns the alpha component of the color.
 java.awt.Color getAwtColor()
          Gets the comparable java.awt.Color object.
 int getBlue()
          Returns the blue component of the color.
 int getGreen()
          Returns the green component of the color.
 int getRed()
          Returns the red component of the color.
 java.lang.String toHexString()
          Returns a string representation of the color.
 java.lang.String toRBGString()
          Returns a string representation of the color.
 java.lang.String toString()
          Returns a string representation of the color.
 java.lang.String toWebHexString()
          Returns a string representation of the color.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Color

public Color()
Creates a new instance of Color


Color

public Color(java.awt.Color color)
Creates a new instance of Color from a java.awt.Color

Parameters:
color - The java.awt.Color.

Color

public Color(int r,
             int g,
             int b)
Creates a new Color object with red, green, blue arguments. The following is an example:
Color myRed = new Color(255,0,0);

Parameters:
r - A value for the red color intensity (0-255).
g - A value for the green color intensity (0-255).
b - A value for the blue color intensity (0-255).

Color

public Color(int r,
             int g,
             int b,
             int a)
Creates a new Color object with red, green, blue and alpha arguments. The following is an example:
Color myRed = new Color(255,0,0,255);

Parameters:
r - A value for the red color intensity (0-255).
g - A value for the green color intensity (0-255).
b - A value for the blue color intensity (0-255).
a - A value for the alpha transparency.

Color

public Color(java.lang.String colorString)
Creates a new Color object with red, green, blue arguments contained in a String. The following is an example:
Color myRed = new Color("255,0,0");

Parameters:
colorString - The color value in string format.
Method Detail

clone

public java.lang.Object clone()
Gets a clone of this object.

Returns:
The clone. Remember to cast this back to the proper object type before using.

getAwtColor

public java.awt.Color getAwtColor()
Gets the comparable java.awt.Color object.

Returns:
The color object.

toHexString

public java.lang.String toHexString()
Returns a string representation of the color.

Returns:
The hex color value as a string, e.g. "FF0000".

toRBGString

public java.lang.String toRBGString()
Returns a string representation of the color.

Returns:
The RBG color value as a string, e.g. "255,0,0".

toString

public java.lang.String toString()
Returns a string representation of the color.

Returns:
The color value as a string, e.g. "255,0,0".

toWebHexString

public java.lang.String toWebHexString()
Returns a string representation of the color.

Returns:
The hex color value as a string, e.g. "#FF0000".

getRed

public int getRed()
Returns the red component of the color.

Returns:
The red value, 0 to 255.

getGreen

public int getGreen()
Returns the green component of the color.

Returns:
The green value, 0 to 255.

getBlue

public int getBlue()
Returns the blue component of the color.

Returns:
The blue value, 0 to 255.

getAlpha

public int getAlpha()
Returns the alpha component of the color.

Returns:
The alpha value, 0 to 255.


Internet Mapping Framework for OpenGIS Java Object Model API (v1.3.007)
Copyright © 2005 Moxi Media Inc. and Province of British Columbia. All Rights Reserved.