javax.vecmath
Class Color4b

java.lang.Object
  extended by javax.vecmath.Tuple4b
      extended by javax.vecmath.Color4b
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Color4b
extends Tuple4b
implements java.io.Serializable

A four-byte color value represented by byte x, y, z, and w values. The x, y, z, and w values represent the red, green, blue, and alpha values, respectively.

Note that Java defines a byte as a signed integer in the range [-128, 127]. However, colors are more typically represented by values in the range [0, 255]. Java 3D recognizes this and for color treats the bytes as if the range were [0, 255]---in other words, as if the bytes were unsigned.

Java 3D assumes that a linear (gamma-corrected) visual is used for all colors.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.vecmath.Tuple4b
w, x, y, z
 
Constructor Summary
Color4b()
          Constructs and initializes a Color4b to (0,0,0,0).
Color4b(byte[] c)
          Constructs and initializes a Color4b from the array of length 4.
Color4b(byte b1, byte b2, byte b3, byte b4)
          Constructs and initializes a Color4b from the four specified values.
Color4b(java.awt.Color color)
          Constructs and initializes a Color4b from the specified AWT Color object.
Color4b(Color4b c1)
          Constructs and initializes a Color4b from the specified Color4b.
Color4b(Tuple4b t1)
          Constructs and initializes a Color4b from the specified Tuple4b.
 
Method Summary
 java.awt.Color get()
          Returns a new AWT color object initialized with the r,g,b,a values of this Color4b object.
 void set(java.awt.Color color)
          Sets the r,g,b,a values of this Color4b object to those of the specified AWT Color object.
 
Methods inherited from class javax.vecmath.Tuple4b
clone, equals, equals, get, get, getW, getX, getY, getZ, hashCode, set, set, setW, setX, setY, setZ, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Color4b

public Color4b(byte b1,
               byte b2,
               byte b3,
               byte b4)
Constructs and initializes a Color4b from the four specified values.

Parameters:
b1 - the red color value
b2 - the green color value
b3 - the blue color value
b4 - the alpha value

Color4b

public Color4b(byte[] c)
Constructs and initializes a Color4b from the array of length 4.

Parameters:
c - the array of length 4 containing r, g, b, and alpha in order

Color4b

public Color4b(Color4b c1)
Constructs and initializes a Color4b from the specified Color4b.

Parameters:
c1 - the Color4b containing the initialization r,g,b,a data

Color4b

public Color4b(Tuple4b t1)
Constructs and initializes a Color4b from the specified Tuple4b.

Parameters:
t1 - the Tuple4b containing the initialization r,g,b,a data

Color4b

public Color4b(java.awt.Color color)
Constructs and initializes a Color4b from the specified AWT Color object. No conversion is done on the color to compensate for gamma correction.

Parameters:
color - the AWT color with which to initialize this Color4b object
Since:
vecmath 1.2

Color4b

public Color4b()
Constructs and initializes a Color4b to (0,0,0,0).

Method Detail

set

public final void set(java.awt.Color color)
Sets the r,g,b,a values of this Color4b object to those of the specified AWT Color object. No conversion is done on the color to compensate for gamma correction.

Parameters:
color - the AWT color to copy into this Color4b object
Since:
vecmath 1.2

get

public final java.awt.Color get()
Returns a new AWT color object initialized with the r,g,b,a values of this Color4b object.

Returns:
a new AWT Color object
Since:
vecmath 1.2


Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.