quicktime.qd
Class QDColor

java.lang.Object
  |
  +--quicktime.util.QTByteObject
        |
        +--quicktime.qd.QDColor
All Implemented Interfaces:
java.lang.Cloneable, quicktime.jdirect.InterfaceLib, quicktime.jdirect.PrimitivesLib, quicktime.jdirect.QuickTimeLib, java.io.Serializable, quicktime.jdirect.SharedLibrary, com.apple.jdirect.SharedLibrary

public final class QDColor
extends QTByteObject
implements quicktime.jdirect.QuickTimeLib, java.lang.Cloneable

Represents color as 16bit values for each component and alpha channel. Once created this class is a read only color. The static color variables are the same as the java.awt.Color colors, but in 16bit format. The default format for the class (ie. the bytes that are returned by getBytes) is RGBColor.

See Also:
Serialized Form

Field Summary
static QDColor black
           
static QDColor blue
           
static QDColor brown
           
static QDColor cyan
           
static QDColor darkGray
           
static QDColor gray
           
static QDColor green
           
static int kIsARGBColor
          These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.
static int kIsGradientColor
          These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.
static int kIsRGBColor
          These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.
static int kIsTQ3ColorARGB
          These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.
static int kIsTQ3ColorRGB
          These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.
static int kMaximumValue
          This is a convenience value - it represents the largest value that a colour component can have.
static QDColor lightGray
           
static QDColor magenta
           
static QDColor orange
           
static QDColor pink
           
static QDColor red
           
static QDColor white
           
static QDColor yellow
           
 
Fields inherited from interface quicktime.jdirect.QuickTimeLib
JDirect_MacOSX, libraryInstance, name
 
Constructor Summary
QDColor()
          Create an instance of an QDColor class - Black
QDColor(java.awt.Color color)
          Deprecated. as of QTJava 4.0
QDColor(float red, float green, float blue)
          Create an instance of an QDColor class.
QDColor(float red, float green, float blue, float alpha)
          Create an instance of an QDColor class.
QDColor(float red, float green, float blue, float alpha, float endingPercentage)
          Create an instance of an QDColor class.
QDColor(int red, int green, int blue)
          Create an instance of an QDColor class.
QDColor(int red, int green, int blue, int alpha)
          Create an instance of an QDColor class.
 
Method Summary
 java.lang.Object clone()
          Returns a copy of this object
static int convert16to8(int value)
          Takes a 16bit color value and converts it into an 8bit value.
static int convert8to16(int value)
          Takes an 8bit color value and converts it into a 16bit value.
static QDColor fromARGBColor(int argb)
          Creates a QDColor with the specified ARGB value, where the alpha component is in bits 24-32 of the argument, where the red component is in bits 16-23 of the argument, the green component is in bits 8-15 of the argument, and the blue component is in bits 0-7.
static QDColor fromArray(byte[] colorBytes, int flag)
          Takes a byte array and converts it to a QDColor.
 int getAlpha()
          Return value of alpha component
 float getAlphaF()
          Return value of alpha component as float
 int getARGB()
          Converts to a packed int according to the pixel depth supplied.
 byte[] getARGBColor()
          Returns the color as an ARGBColor value
 int getBlue()
          Return value of blue component
 float getBlueF()
          Return value of blue component as float
static EndianDescriptor getEndianDescriptorARGBColor()
          Returns the EndianDescriptor for ARGBColor color.
static EndianDescriptor getEndianDescriptorGradientColor()
          Returns the EndianDescriptor for ARGBColor color.
static EndianDescriptor getEndianDescriptorRGBColor()
          Returns the EndianDescriptor for RGBColor color.
static EndianDescriptor getEndianDescriptorTQ3Color()
          Returns the EndianDescriptor for TQ3Color color.
static EndianDescriptor getEndianDescriptorTQ3ColorARGB()
          Returns the EndianDescriptor for TQ3ColorARGB color.
 float getEndingPercentage()
          Return value of ending percentage component
 byte[] getGradientColor()
          Returns the color as an GradientColor value
 int getGreen()
          Return value of green component
 float getGreenF()
          Return value of green component as float
 int getRed()
          Return value of red component
 float getRedF()
          Return value of red component as float
 int getRGB()
          Converts to a packed int according to the pixel depth supplied.
 byte[] getRGBColor()
          Returns the color as an RGBColor value
 byte[] getTQ3ColorARGB()
          Returns the color as a TQ3ColorARGB value
 byte[] getTQ3ColorRGB()
          Returns the color as a TQ3ColorRGB value
 java.lang.String toString()
          Returns the String representation of this object
 
Methods inherited from class quicktime.util.QTByteObject
equals, fromArray, getBytes, getSize
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

black

public static final QDColor black

white

public static final QDColor white

red

public static final QDColor red

green

public static final QDColor green

blue

public static final QDColor blue

yellow

public static final QDColor yellow

magenta

public static final QDColor magenta

cyan

public static final QDColor cyan

darkGray

public static final QDColor darkGray

gray

public static final QDColor gray

lightGray

public static final QDColor lightGray

pink

public static final QDColor pink

orange

public static final QDColor orange

brown

public static final QDColor brown

kMaximumValue

public static final int kMaximumValue
This is a convenience value - it represents the largest value that a colour component can have.

kIsRGBColor

public static final int kIsRGBColor
These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.

kIsARGBColor

public static final int kIsARGBColor
These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.

kIsTQ3ColorRGB

public static final int kIsTQ3ColorRGB
These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.

kIsGradientColor

public static final int kIsGradientColor
These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.

kIsTQ3ColorARGB

public static final int kIsTQ3ColorARGB
These constants are used in the fromArray call to indicate which of the 4 formats the byte array is encoded in.
Constructor Detail

QDColor

public QDColor()
Create an instance of an QDColor class - Black

QDColor

public QDColor(int red,
               int green,
               int blue)
Create an instance of an QDColor class. Alpha is set to default (0xFFFF - opaque).
Parameters:
red - the 16bit red value
green - the 16bit green value
blue - the 16bit blue value

QDColor

public QDColor(int red,
               int green,
               int blue,
               int alpha)
Create an instance of an QDColor class.
Parameters:
red - the 16bit red value
green - the 16bit green value
blue - the 16bit blue value
alpha - the 16bit alpha value

QDColor

public QDColor(float red,
               float green,
               float blue)
Create an instance of an QDColor class. Alpha is set to default (0xFFFF - opaque).
Parameters:
red - the 0 to 1F red value
green - the 0 to 1F green value
blue - the 0 to 1F blue value

QDColor

public QDColor(float red,
               float green,
               float blue,
               float alpha)
Create an instance of an QDColor class.
Parameters:
red - the 0 to 1F red value
green - the 0 to 1F green value
blue - the 0 to 1F blue value
alpha - the 0 to 1F alpha value

QDColor

public QDColor(float red,
               float green,
               float blue,
               float alpha,
               float endingPercentage)
Create an instance of an QDColor class.
Parameters:
red - the 0 to 1F red value
green - the 0 to 1F green value
blue - the 0 to 1F blue value
alpha - the 0 to 1F alpha value
endingPercentage - Specifies the percentage of the gradient (expressed as value between 0 and 1 , where 0 is the beginning of the gradient) at which the specified color begins.

QDColor

public QDColor(java.awt.Color color)
Deprecated. as of QTJava 4.0

Create an instance of an QDColor class
Parameters:
color - the java.awt.Color class to convert
Method Detail

getEndianDescriptorRGBColor

public static final EndianDescriptor getEndianDescriptorRGBColor()
Returns the EndianDescriptor for RGBColor color.
Returns:
an EndianDescriptor

getEndianDescriptorARGBColor

public static final EndianDescriptor getEndianDescriptorARGBColor()
Returns the EndianDescriptor for ARGBColor color.
Returns:
an EndianDescriptor

getEndianDescriptorGradientColor

public static final EndianDescriptor getEndianDescriptorGradientColor()
Returns the EndianDescriptor for ARGBColor color.
Returns:
an EndianDescriptor

getEndianDescriptorTQ3Color

public static final EndianDescriptor getEndianDescriptorTQ3Color()
Returns the EndianDescriptor for TQ3Color color.
Returns:
an EndianDescriptor

getEndianDescriptorTQ3ColorARGB

public static final EndianDescriptor getEndianDescriptorTQ3ColorARGB()
Returns the EndianDescriptor for TQ3ColorARGB color.
Returns:
an EndianDescriptor

convert8to16

public static int convert8to16(int value)
Takes an 8bit color value and converts it into a 16bit value.

convert16to8

public static int convert16to8(int value)
Takes a 16bit color value and converts it into an 8bit value.

fromArray

public static QDColor fromArray(byte[] colorBytes,
                                int flag)
Takes a byte array and converts it to a QDColor. The flag tells the call what format the bytes are in. The length of the array must equate to at least the required length of bytes.
Parameters:
colorBytes - the byte array containing the color values
flag - flag that describes the format of the byte array
Returns:
a QDColor
Throws:
java.lang.IllegalArgumentException - if mismatch between minimum length of byte array and format flag

fromARGBColor

public static QDColor fromARGBColor(int argb)
Creates a QDColor with the specified ARGB value, where the alpha component is in bits 24-32 of the argument, where the red component is in bits 16-23 of the argument, the green component is in bits 8-15 of the argument, and the blue component is in bits 0-7. The value zero indicates no contribution from the primary color component.

getRGBColor

public byte[] getRGBColor()
Returns the color as an RGBColor value

getARGBColor

public byte[] getARGBColor()
Returns the color as an ARGBColor value

getGradientColor

public byte[] getGradientColor()
Returns the color as an GradientColor value

getTQ3ColorRGB

public byte[] getTQ3ColorRGB()
Returns the color as a TQ3ColorRGB value

getTQ3ColorARGB

public byte[] getTQ3ColorARGB()
Returns the color as a TQ3ColorARGB value

getRed

public int getRed()
Return value of red component

getRedF

public float getRedF()
Return value of red component as float

getGreen

public int getGreen()
Return value of green component

getGreenF

public float getGreenF()
Return value of green component as float

getBlue

public int getBlue()
Return value of blue component

getBlueF

public float getBlueF()
Return value of blue component as float

getAlpha

public int getAlpha()
Return value of alpha component

getAlphaF

public float getAlphaF()
Return value of alpha component as float

getEndingPercentage

public float getEndingPercentage()
Return value of ending percentage component

clone

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

getARGB

public int getARGB()
Converts to a packed int according to the pixel depth supplied.
Returns:
packed int of 8bit depth for each a, r, g, b component

getRGB

public int getRGB()
Converts to a packed int according to the pixel depth supplied. Alpha channel is 0 (the high 8 bits).
Returns:
packed int of 8bit depth for each r, g, b component

toString

public java.lang.String toString()
Returns the String representation of this object
Overrides:
toString in class QTByteObject