|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.math.Color4f
public class Color4f
Defines a color made up of red, green, blue, and alpha components. Note: The alpha value defaults to 1.0 (opaque).
Field Summary | ||
---|---|---|
static int |
ANIMATION_PROPERTY_A
Used to animate the alpha component. |
|
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. |
|
static int |
ANIMATION_PROPERTY_RGBA
Used to animate the red, green, blue and alpha components. |
Constructor Summary | ||
---|---|---|
Color4f()
Constructs a new color initialized to solid (opaque) black. |
||
Color4f(float r,
float g,
float b)
Constructs a new color initialized to the specified values (with alpha equal to 1.0). |
||
Color4f(float r,
float g,
float b,
float a)
Constructs a new color initialized to the specified values. |
||
Color4f(float[] array,
int offset)
Constructs a new color initialized to the specified values. |
||
Color4f(int color)
Constructs a new color initialized to the given color represented in 32-bit integer ARGB format. |
||
Color4f(Color4f color)
Constructs a new color from the given color. |
Method Summary | ||
---|---|---|
boolean |
equals(Object obj)
Determines if the specified object is of type Color4f and all of its elements are equal to the elements of this color. |
|
boolean |
equals(Color4f color)
Returns true if all elements of the specified color are equal to the elements of this color. |
|
float |
getAlpha()
Gets the alpha component of the 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 (this method does not modify alpha). |
|
void |
set(float r,
float g,
float b,
float a)
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. |
|
void |
set(Color4f color)
Sets this color to the given color. |
|
void |
setAlpha(float a)
Sets the alpha component of the 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 |
---|
public static final int ANIMATION_PROPERTY_R
public static final int ANIMATION_PROPERTY_G
public static final int ANIMATION_PROPERTY_B
public static final int ANIMATION_PROPERTY_A
public static final int ANIMATION_PROPERTY_RGB
public static final int ANIMATION_PROPERTY_RGBA
Constructor Detail |
---|
public Color4f()
public Color4f(int color)
color
- The color to set this color to (in 32-bit integer ARGB format).Color
public Color4f(float[] array, int offset)
array
- An array containing the red, green, blue,
and alpha values (in that order) for the new color.offset
- The offset into the array to begin reading at.
NullPointerException
- If array
is null
.
IllegalArgumentException
- If offset
is less than zero or
offset + 3
is greater than or equal to array.length
.
IllegalArgumentException
- If any of the float values are less than 0 or greater than 1.public Color4f(float r, float g, float b)
r
- The red component.g
- The green component.b
- The blue component.
IllegalArgumentException
- If r
, g
, or b
is less than 0 or greater than 1.public Color4f(float r, float g, float b, float a)
r
- The red component.g
- The green component.b
- The blue component.a
- The alpha component.public Color4f(Color4f color)
color
- The color to copy.
NullPointerException
- If color
is null
.Method Detail |
---|
public float getAlpha()
public float getBlue()
public float getGreen()
public float getRed()
public void set(int color)
color
- The color to set this color to (in 32-bit integer ARGB format).Color
public void set(float[] array, int offset)
array
- An array containing the red, green, blue,
and alpha values (in that order) for the new color.offset
- The offset into the array to begin reading at.
NullPointerException
- If array
is null
.
IllegalArgumentException
- If offset
is less than zero or
offset + 3
is greater than or equal to array.length
.
IllegalArgumentException
- If any of the float values are less than 0 or greater than 1.public void set(float r, float g, float b)
r
- The red component.g
- The green component.b
- The blue component.
IllegalArgumentException
- If r
, g
, or b
is less than 0 or greater than 1.public void set(float r, float g, float b, float a)
r
- The red component.g
- The green component.b
- The blue component.a
- The alpha component.
IllegalArgumentException
- If r
, g
, or b
is less than 0 or greater than 1.public void set(Color4f color)
color
- The color to set to.
NullPointerException
- If color
is null
.public void setAlpha(float a)
a
- The alpha component of the color.
IllegalArgumentException
- If a
is less than 0 or greater than 1.public void setBlue(float b)
b
- The blue component of the color.
IllegalArgumentException
- If b
is less than 0 or greater than 1.public void setGreen(float g)
g
- The green component of the color.
IllegalArgumentException
- If g
is less than 0 or greater than 1.public void setRed(float r)
r
- The red component of the color.
IllegalArgumentException
- If r
is less than 0 or greater than 1.public void getAnimationValue(int property, AnimationValue value)
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.
getAnimationValue
in interface Animatable
property
- The property to get the current value or values of.value
- An AnimationValue
used to store the returned property values.Animatable.getAnimationValue(int,AnimationValue)
public void setAnimationValue(int property, AnimationValue value)
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.
setAnimationValue
in interface Animatable
property
- The property to set the current value or values of.value
- The AnimationValue
used to specify the value or values to set.Animatable.setAnimationValue(int,AnimationValue)
public int getAnimationPropertyComponentCount(int property)
Animatable
Gets the number of components of the specified property.
The implementer must define the component size of every animatable property defined for theAnimatable
.
getAnimationPropertyComponentCount
in interface Animatable
property
- The property to retrieve the component count for.
Animatable.getAnimationPropertyComponentCount(int)
public boolean equals(Color4f color)
color
- The color to compare.
true
if this color is equal to color
;
false
otherwise.
NullPointerException
- If color
is null
.public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare.
true
if this color is equal to obj
;
false
otherwise.
NullPointerException
- If obj
is null
.Boolean.hashCode()
,
Hashtable
public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
Hashtable
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.