net.rim.device.api.math
Class Color3f

java.lang.Object
  extended by net.rim.device.api.math.Color3f
All Implemented Interfaces:
Animatable

public class Color3f
extends Object
implements Animatable

Defines a color made up of red, green, and blue components.

Since:
BlackBerry API 6.0.0

Field Summary
static int ANIMATION_PROPERTY_B
          Used to animate the blue component.
static int ANIMATION_PROPERTY_G
          Used to animate the green component.
static int ANIMATION_PROPERTY_R
          Used to animate the red component.
static int ANIMATION_PROPERTY_RGB
          Used to animate the red, green and blue components.
 
Constructor Summary
Color3f()
          Constructs a new color initialized to solid black.
Color3f(float r, float g, float b)
          Constructs a new color initialized to the specified values.
Color3f(float[] array, int offset)
          Constructs a new color initialized to the specified values.
Color3f(int color)
          Constructs a new color initialized to the given color represented in 32-bit integer ARGB format (the alpha is ignored).
Color3f(Color3f color)
          Constructs a new color from the given color.
 
Method Summary
 boolean equals(Object obj)
          Determines if the specified object is of type Color3f and all of its elements are equal to the elements of this color.
 boolean equals(Color3f color)
          Returns true if all elements of the specified color are equal to the elements of this color.
 int getAnimationPropertyComponentCount(int property)
           Gets the number of components of the specified property.
 void getAnimationValue(int property, AnimationValue value)
           Gets the value or values of the specified property.
 float getBlue()
          Gets the blue component of the color.
 float getGreen()
          Gets the green component of the color.
 float getRed()
          Gets the red component of the color.
 int hashCode()
          Returns a hash code based on the elements of this color.
 void set(float r, float g, float b)
          Sets this color to the specified values.
 void set(float[] array, int offset)
          Sets this color to the specified values.
 void set(int color)
          Sets this color to the given color represented in 32-bit integer ARGB format (the alpha is ignored).
 void set(Color3f color)
          Sets this color to the given color.
 void setAnimationValue(int property, AnimationValue value)
           Sets the value or values of the specified property.
 void setBlue(float b)
          Sets the blue component of the color.
 void setGreen(float g)
          Sets the green component of the color.
 void setRed(float r)
          Sets the red component of the color.
 String toString()
          Returns a String representation of this color.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 



Field Detail

ANIMATION_PROPERTY_R

public static final int ANIMATION_PROPERTY_R
Used to animate the red component.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ANIMATION_PROPERTY_G

public static final int ANIMATION_PROPERTY_G
Used to animate the green component.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ANIMATION_PROPERTY_B

public static final int ANIMATION_PROPERTY_B
Used to animate the blue component.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ANIMATION_PROPERTY_RGB

public static final int ANIMATION_PROPERTY_RGB
Used to animate the red, green and blue components.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0


Constructor Detail

Color3f

public Color3f()
Constructs a new color initialized to solid black.

Since:
BlackBerry API 6.0.0

Color3f

public Color3f(int color)
Constructs a new color initialized to the given color represented in 32-bit integer ARGB format (the alpha is ignored).

Parameters:
color - The color to set this color to (in 32-bit integer ARGB format).
See Also:
Color
Since:
BlackBerry API 6.0.0

Color3f

public Color3f(float[] array,
               int offset)
Constructs a new color initialized to the specified values.

Parameters:
array - An array containing the red, green, and blue values (in that order) for the new color.
offset - The offset into the array to begin reading at.
Throws:
NullPointerException - If array is null.
IllegalArgumentException - If offset is less than zero or offset + 2 is greater than or equal to array.length.
IllegalArgumentException - If any of the float values are less than 0 or greater than 1.
Since:
BlackBerry API 6.0.0

Color3f

public Color3f(float r,
               float g,
               float b)
Constructs a new color initialized to the specified values.

Parameters:
r - The red component.
g - The green component.
b - The blue component.
Throws:
IllegalArgumentException - If r, g, or b is less than 0 or greater than 1.
Since:
BlackBerry API 6.0.0

Color3f

public Color3f(Color3f color)
Constructs a new color from the given color.

Parameters:
color - The color to copy.
Throws:
NullPointerException - If color is null.
Since:
BlackBerry API 6.0.0


Method Detail

getBlue

public float getBlue()
Gets the blue component of the color.

Returns:
The blue component of the color.
Since:
BlackBerry API 6.0.0

getGreen

public float getGreen()
Gets the green component of the color.

Returns:
The green component of the color.
Since:
BlackBerry API 6.0.0

getRed

public float getRed()
Gets the red component of the color.

Returns:
The red component of the color.
Since:
BlackBerry API 6.0.0

set

public void set(int color)
Sets this color to the given color represented in 32-bit integer ARGB format (the alpha is ignored).

Parameters:
color - The color to set this color to (in 32-bit integer ARGB format).
See Also:
Color
Since:
BlackBerry API 6.0.0

set

public void set(float[] array,
                int offset)
Sets this color to the specified values.

Parameters:
array - An array containing the red, green, and blue values (in that order) for the new color.
offset - The offset into the array to begin reading at.
Throws:
NullPointerException - If array is null.
IllegalArgumentException - If offset is less than zero or offset + 2 is greater than or equal to array.length.
IllegalArgumentException - If any of the float values are less than 0 or greater than 1.
Since:
BlackBerry API 6.0.0

set

public void set(float r,
                float g,
                float b)
Sets this color to the specified values.

Parameters:
r - The red component.
g - The green component.
b - The blue component.
Throws:
IllegalArgumentException - If r, g, or b is less than 0 or greater than 1.
Since:
BlackBerry API 6.0.0

set

public void set(Color3f color)
Sets this color to the given color.

Parameters:
color - The color to set to.
Throws:
NullPointerException - If color is null.
Since:
BlackBerry API 6.0.0

setBlue

public void setBlue(float b)
Sets the blue component of the color.

Parameters:
b - The blue component of the color.
Throws:
IllegalArgumentException - If b is less than 0 or greater than 1.
Since:
BlackBerry API 6.0.0

setGreen

public void setGreen(float g)
Sets the green component of the color.

Parameters:
g - The green component of the color.
Throws:
IllegalArgumentException - If g is less than 0 or greater than 1.
Since:
BlackBerry API 6.0.0

setRed

public void setRed(float r)
Sets the red component of the color.

Parameters:
r - The red component of the color.
Throws:
IllegalArgumentException - If r is less than 0 or greater than 1.
Since:
BlackBerry API 6.0.0

getAnimationValue

public void getAnimationValue(int property,
                              AnimationValue value)
Description copied from interface: Animatable

Gets the value or values of the specified property.

Used by the Animation framework to get the values of the specified property on the Animatable. The implementer must set the value of the specified target property in the AnimationValue parameter.

Specified by:
getAnimationValue in interface Animatable
Parameters:
property - The property to get the current value or values of.
value - An AnimationValue used to store the returned property values.
See Also:
Animatable.getAnimationValue(int,AnimationValue)
Since:
BlackBerry API 6.0.0

setAnimationValue

public void setAnimationValue(int property,
                              AnimationValue value)
Description copied from interface: Animatable

Sets the value or values of the specified property.

Used by the Animation framework to update the value or values of the specified target property on the Animatable with the currently calculated animation value. The implementer must update the current value or values of the given target property with the values in the AnimationValue parameter.

Specified by:
setAnimationValue in interface Animatable
Parameters:
property - The property to set the current value or values of.
value - The AnimationValue used to specify the value or values to set.
See Also:
Animatable.setAnimationValue(int,AnimationValue)
Since:
BlackBerry API 6.0.0

getAnimationPropertyComponentCount

public int getAnimationPropertyComponentCount(int property)
Description copied from interface: Animatable

Gets the number of components of the specified property.

The implementer must define the component size of every animatable property defined for the Animatable.

Specified by:
getAnimationPropertyComponentCount in interface Animatable
Parameters:
property - The property to retrieve the component count for.
Returns:
The number of components comprising the specified property.
See Also:
Animatable.getAnimationPropertyComponentCount(int)
Since:
BlackBerry API 6.0.0

equals

public boolean equals(Color3f color)
Returns true if all elements of the specified color are equal to the elements of this color.

Parameters:
color - The color to compare.
Returns:
true if this color is equal to color; false otherwise.
Throws:
NullPointerException - If color is null.
Since:
BlackBerry API 6.0.0

equals

public boolean equals(Object obj)
Determines if the specified object is of type Color3f and all of its elements are equal to the elements of this color.

Overrides:
equals in class Object
Parameters:
obj - The object to compare.
Returns:
true if this color is equal to obj; false otherwise.
Throws:
NullPointerException - If obj is null.
See Also:
Boolean.hashCode(), Hashtable
Since:
BlackBerry API 6.0.0

hashCode

public int hashCode()
Returns a hash code based on the elements of this color.

Overrides:
hashCode in class Object
Returns:
The hash code for this color.
See Also:
Object.equals(java.lang.Object), Hashtable
Since:
BlackBerry API 6.0.0

toString

public String toString()
Returns a String representation of this color.

Overrides:
toString in class Object
Returns:
A String representation of this color.
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal