com.sun.j3d.utils.compression
Class CompressionStreamColor

java.lang.Object
  extended by com.sun.j3d.utils.compression.CompressionStreamElement
      extended by com.sun.j3d.utils.compression.CompressionStreamColor

 class CompressionStreamColor
extends CompressionStreamElement

This class represents a color in a compression stream. It maintains both floating-point and quantized representations. This color may be bundled with a vertex or exist separately as a global color.


Field Summary
private  int A
           
(package private)  int aAbsolute
           
private  int B
           
(package private)  int bAbsolute
           
private  boolean color3
           
private  boolean color4
           
private  float colorA
           
private  float colorB
           
private  float colorG
           
private  float colorR
           
private  int G
           
(package private)  int gAbsolute
           
private  int R
           
(package private)  int rAbsolute
           
 
Fields inherited from class com.sun.j3d.utils.compression.CompressionStreamElement
absolute, length, lengthMask, quantizationMask, shift
 
Constructor Summary
CompressionStreamColor(CompressionStream stream, Color3f c3)
          Create a CompressionStreamColor.
CompressionStreamColor(CompressionStream stream, Color4f c4)
          Create a CompressionStreamColor.
 
Method Summary
private  void outputColor(HuffmanTable table, CommandStream output, int header, int headerLength)
           
(package private)  void outputCommand(HuffmanTable table, CommandStream output)
          Output a setColor command.
(package private)  void outputSubcommand(HuffmanTable table, CommandStream output)
          Output a color subcommand.
(package private)  void quantize(CompressionStream stream, HuffmanTable huffmanTable)
          Quantize a floating point color to fixed point integer components of the specified number of bits.
 java.lang.String toString()
           
 
Methods inherited from class com.sun.j3d.utils.compression.CompressionStreamElement
computeLengthShift, computeLengthShift, computeLengthShift
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

R

private int R

G

private int G

B

private int B

A

private int A

color3

private boolean color3

color4

private boolean color4

colorR

private float colorR

colorG

private float colorG

colorB

private float colorB

colorA

private float colorA

rAbsolute

int rAbsolute

gAbsolute

int gAbsolute

bAbsolute

int bAbsolute

aAbsolute

int aAbsolute
Constructor Detail

CompressionStreamColor

CompressionStreamColor(CompressionStream stream,
                       Color3f c3)
Create a CompressionStreamColor.

Parameters:
stream - CompressionStream associated with this element
color3 - floating-point representation to be encoded

CompressionStreamColor

CompressionStreamColor(CompressionStream stream,
                       Color4f c4)
Create a CompressionStreamColor.

Parameters:
stream - CompressionStream associated with this element
color4 - floating-point representation to be encoded
Method Detail

quantize

void quantize(CompressionStream stream,
              HuffmanTable huffmanTable)
Quantize a floating point color to fixed point integer components of the specified number of bits. The bit length can range from a maximum of 16 to a minimum of 2 bits since negative colors are not defined.

The bit length is the total number of bits in the signed version of the fixed point representation of the input color, which is assumed to be normalized into the [0..1) range. With the maximum bit length of 16, 15 bits of positive colors can be represented; a bit length of 9 is needed to get the 8 bit positive color size in common use.

Specified by:
quantize in class CompressionStreamElement
Parameters:
stream - CompressionStream associated with this element
table - HuffmanTable for collecting data about the quantized representation of this element

outputCommand

void outputCommand(HuffmanTable table,
                   CommandStream output)
Output a setColor command.

Overrides:
outputCommand in class CompressionStreamElement
Parameters:
table - HuffmanTable mapping quantized representations to compressed encodings
output - CommandStream for collecting compressed output

outputSubcommand

void outputSubcommand(HuffmanTable table,
                      CommandStream output)
Output a color subcommand.

Parameters:
table - HuffmanTable mapping quantized representations to compressed encodings
output - CommandStream for collecting compressed output

outputColor

private void outputColor(HuffmanTable table,
                         CommandStream output,
                         int header,
                         int headerLength)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.