com.sun.jimi.core.encoder.sunraster
Class SunRasterHeader

java.lang.Object
  |
  +--com.sun.jimi.core.encoder.sunraster.SunRasterHeader

public class SunRasterHeader
extends java.lang.Object

Class encapsulating SunRaster header information with support for writing it to a stream and querying for encoding information.


Field Summary
protected  int colorMapLength_
          Length of color map.
protected  int colorMapType_
          Type of color map.
protected  int depth_
          Number of bits per pixel.
protected  int height_
          Image dimensions.
protected  AdaptiveRasterImage jimiImage_
          JimiImage to draw information from.
protected static int MAGIC_NUMBER
          Magic number to identify SunRaster images.
static int NO_COLOR_MAP
          Values for ColorMapType field.
protected static int NO_COLORMAP
          ColorMap types.
protected  java.awt.image.IndexColorModel palette_
          Image palette.
static int RAW_COLOR_MAP
          Values for ColorMapType field.
protected static int RAW_COLORMAP
          ColorMap types.
static int RGB_COLOR_MAP
          Values for ColorMapType field.
protected static int RGB_COLORMAP
          ColorMap types.
protected  int scanLineSize_
          Number of bytes in a scan-line.
protected  int type_
          The type code of the image.
static int TYPE_BYTE_ENCODED
          Values for Type field.
static int TYPE_EXPERIMENTAL
          Values for Type field.
static int TYPE_IFF
          Values for Type field.
static int TYPE_OLD
          Values for Type field.
static int TYPE_RGB
          Values for Type field.
static int TYPE_STANDARD
          Values for Type field.
static int TYPE_TIFF
          Values for Type field.
protected  int width_
          Image dimensions.
 
Constructor Summary
SunRasterHeader()
           
SunRasterHeader(AdaptiveRasterImage image)
          Constructs a header based on a given JimiImage.
 
Method Summary
 int getDepth()
          Get the value of the Depth field.
 java.awt.image.IndexColorModel getPalette()
          Get the palette being used as the image's ColorMap.
 int getType()
          Get the value of the Type field.
 void setDepth(int depth)
          Set the value of the Depth field.
 void setPalette(java.awt.image.IndexColorModel palette)
          Set an IndexColorModel to use as the palette (ColorMap) of the image.
 void setType(int type)
          Set the value of the Type field.
protected  void writePaletteInfoTo(java.io.DataOutputStream out)
          Writes the palette information to a given stream.
 void writeTo(java.io.OutputStream output)
          Write the header, including palette information, to a given stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAGIC_NUMBER

protected static final int MAGIC_NUMBER
Magic number to identify SunRaster images.

TYPE_OLD

public static final int TYPE_OLD
Values for Type field.

TYPE_STANDARD

public static final int TYPE_STANDARD
Values for Type field.

TYPE_BYTE_ENCODED

public static final int TYPE_BYTE_ENCODED
Values for Type field.

TYPE_RGB

public static final int TYPE_RGB
Values for Type field.

TYPE_TIFF

public static final int TYPE_TIFF
Values for Type field.

TYPE_IFF

public static final int TYPE_IFF
Values for Type field.

TYPE_EXPERIMENTAL

public static final int TYPE_EXPERIMENTAL
Values for Type field.

NO_COLOR_MAP

public static final int NO_COLOR_MAP
Values for ColorMapType field.

RGB_COLOR_MAP

public static final int RGB_COLOR_MAP
Values for ColorMapType field.

RAW_COLOR_MAP

public static final int RAW_COLOR_MAP
Values for ColorMapType field.

NO_COLORMAP

protected static final int NO_COLORMAP
ColorMap types.

RGB_COLORMAP

protected static final int RGB_COLORMAP
ColorMap types.

RAW_COLORMAP

protected static final int RAW_COLORMAP
ColorMap types.

jimiImage_

protected AdaptiveRasterImage jimiImage_
JimiImage to draw information from.

width_

protected int width_
Image dimensions.

height_

protected int height_
Image dimensions.

depth_

protected int depth_
Number of bits per pixel.

type_

protected int type_
The type code of the image.

colorMapType_

protected int colorMapType_
Type of color map.

colorMapLength_

protected int colorMapLength_
Length of color map.

palette_

protected java.awt.image.IndexColorModel palette_
Image palette.

scanLineSize_

protected int scanLineSize_
Number of bytes in a scan-line.
Constructor Detail

SunRasterHeader

public SunRasterHeader()

SunRasterHeader

public SunRasterHeader(AdaptiveRasterImage image)
Constructs a header based on a given JimiImage. Width and Height are derived, but everything else must be set explicitly.
Parameters:
image - The JimiImage to read information from.
Method Detail

setDepth

public void setDepth(int depth)
Set the value of the Depth field.
Parameters:
depth - The number of bits per pixel.

getDepth

public int getDepth()
Get the value of the Depth field.
Returns:
The number of bits per pixel.

setType

public void setType(int type)
Set the value of the Type field.
Parameters:
type - The type, must be one of the TYPE_ constants.

getType

public int getType()
Get the value of the Type field.
Returns:
The value.

setPalette

public void setPalette(java.awt.image.IndexColorModel palette)
Set an IndexColorModel to use as the palette (ColorMap) of the image.
Parameters:
palette - The palette to use.

getPalette

public java.awt.image.IndexColorModel getPalette()
Get the palette being used as the image's ColorMap.
Returns:
The palette.

writeTo

public void writeTo(java.io.OutputStream output)
             throws java.io.IOException
Write the header, including palette information, to a given stream.
Parameters:
output - The stream to write to.

writePaletteInfoTo

protected void writePaletteInfoTo(java.io.DataOutputStream out)
                           throws java.io.IOException
Writes the palette information to a given stream.
Parameters:
out - The stream to write to.