com.sun.jimi.core.encoder.ico
Class ICOEncoder

java.lang.Object
  |
  +--com.sun.jimi.core.util.ProgressMonitorSupport
        |
        +--com.sun.jimi.core.compat.JimiEncoderBase
              |
              +--com.sun.jimi.core.encoder.ico.ICOEncoder
Direct Known Subclasses:
CUREncoder

public class ICOEncoder
extends JimiEncoderBase

Encoder pallette images into ICO format ICO is based upon DIB (Device Independent Bitmaps) a generalization of the BMP file format. ICO files consist of a directory of icons each of which points to a separate icon image


Field Summary
protected static int BMPINFOHEADER_SIZE
           
protected  int currentOffset
           
protected  LEDataOutputStream destination
           
protected  int stateFlag
          Is this encoder in a valid state, has it errored?
protected  short TYPE_FLAG
          The "resource id" flag
 
Fields inherited from class com.sun.jimi.core.compat.JimiEncoderBase
currentImage, DONE, ERROR, factory, MAX_COLORS_RGB, MULTIIMAGE, NEXTIMAGE
 
Fields inherited from class com.sun.jimi.core.util.ProgressMonitorSupport
currentProgressLevel, progressListener
 
Constructor Summary
ICOEncoder()
           
 
Method Summary
protected  int computeBitCount(int mapSize)
           
protected  int computeImageSize(int mapSize, int bitCount, int width, int height)
           
 boolean driveEncoder()
           
 void freeEncoder()
           
 int getState()
           
 void initSpecificEncoder(java.io.OutputStream out, AdaptiveRasterImage ji)
          Called by JimiEncoderBase (This is VERY Poor OOD since we should in reality override the initEncoder method in the base class and call super.initEncoder!
protected  void writeBitmapInfoHeader(LEDataOutputStream destination, int bitCount, int mapSize, AdaptiveRasterImage ji, java.awt.image.IndexColorModel icm)
           
protected  void writeDIBImage(LEDataOutputStream destination, AdaptiveRasterImage ji)
           
protected  void writeICOCURDirectory(LEDataOutputStream destination, AdaptiveRasterImage[] images)
          Write the ICODIR with entries for each image Each of which has the format :
WORD idReserved WORD idType WORD idCount ICONDIRENTRY idEntries[]
protected  void writeICOCURDIREntry(LEDataOutputStream destination, AdaptiveRasterImage anImage)
          Write the ICODIRENTRY for an image Each of which has the following format :
BYTE bWidth BYTE bHeight BYTE bColorCount BYTE bReserved WORD wPlanes WORD wBitCount DWORD dwBytesInRes DWORD dwImageOffset
protected  void writePixels(LEDataOutputStream destination, int bitCount, AdaptiveRasterImage anImage)
           
protected  void writeRGBQuads(LEDataOutputStream destination, java.awt.image.IndexColorModel icm)
           BYTE red BYTE green BYTE blue BYTE reserved - must be 0
 
Methods inherited from class com.sun.jimi.core.compat.JimiEncoderBase
createAdaptiveRasterImage, createAdaptiveRasterImage, encodeImage, encodeImage, encodeImages, encodeImages, getCapabilties, getJimiImage, getMaxColors, setJimiImage, setNumberOfImages, setProgress
 
Methods inherited from class com.sun.jimi.core.util.ProgressMonitorSupport
setProgressListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BMPINFOHEADER_SIZE

protected static final int BMPINFOHEADER_SIZE

destination

protected LEDataOutputStream destination

TYPE_FLAG

protected short TYPE_FLAG
The "resource id" flag

stateFlag

protected int stateFlag
Is this encoder in a valid state, has it errored?

currentOffset

protected int currentOffset
Constructor Detail

ICOEncoder

public ICOEncoder()
Method Detail

initSpecificEncoder

public void initSpecificEncoder(java.io.OutputStream out,
                                AdaptiveRasterImage ji)
Called by JimiEncoderBase (This is VERY Poor OOD since we should in reality override the initEncoder method in the base class and call super.initEncoder!
Overrides:
initSpecificEncoder in class JimiEncoderBase

driveEncoder

public boolean driveEncoder()
                     throws JimiException
Overrides:
driveEncoder in class JimiEncoderBase

getState

public int getState()
Overrides:
getState in class JimiEncoderBase

freeEncoder

public void freeEncoder()
                 throws JimiException
Overrides:
freeEncoder in class JimiEncoderBase

writeICOCURDirectory

protected void writeICOCURDirectory(LEDataOutputStream destination,
                                    AdaptiveRasterImage[] images)
                             throws JimiException,
                                    java.io.IOException
Write the ICODIR with entries for each image Each of which has the format :
 	WORD 		idReserved
		WORD 		idType
		WORD 		idCount
		ICONDIRENTRY idEntries[]
 

writeICOCURDIREntry

protected void writeICOCURDIREntry(LEDataOutputStream destination,
                                   AdaptiveRasterImage anImage)
                            throws JimiException,
                                   java.io.IOException
Write the ICODIRENTRY for an image Each of which has the following format :
		BYTE	bWidth
		BYTE	bHeight
		BYTE	bColorCount
		BYTE	bReserved
		WORD	wPlanes
		WORD	wBitCount
		DWORD	dwBytesInRes
		DWORD	dwImageOffset
 

writeDIBImage

protected void writeDIBImage(LEDataOutputStream destination,
                             AdaptiveRasterImage ji)
                      throws JimiException,
                             java.io.IOException

writeBitmapInfoHeader

protected void writeBitmapInfoHeader(LEDataOutputStream destination,
                                     int bitCount,
                                     int mapSize,
                                     AdaptiveRasterImage ji,
                                     java.awt.image.IndexColorModel icm)
                              throws JimiException,
                                     java.io.IOException

writeRGBQuads

protected void writeRGBQuads(LEDataOutputStream destination,
                             java.awt.image.IndexColorModel icm)
                      throws JimiException,
                             java.io.IOException
 	BYTE red
		BYTE green
		BYTE blue
		BYTE reserved - must be 0
 

writePixels

protected void writePixels(LEDataOutputStream destination,
                           int bitCount,
                           AdaptiveRasterImage anImage)
                    throws JimiException,
                           java.io.IOException

computeImageSize

protected int computeImageSize(int mapSize,
                               int bitCount,
                               int width,
                               int height)

computeBitCount

protected int computeBitCount(int mapSize)