Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jimi.core.encoder.xpm
Class XPMEncoder

    com.sun.jimi.core.encoder.xpm.XPMEncoder

public class XPMEncoder

Encoder class for XPM format.

Field Summary
`protected int` | `entrySize` size of each palette entry
`protected static java.lang.String` | `HEADER_STRING`
`protected AdaptiveRasterImage` | `jimiImage` JimiImage to get data from
`protected static java.lang.String` | `MAGIC`
`protected java.io.PrintStream` | `output` destination for encoded data
`protected int` | `paletteSize` number of colors in palette
`protected static char[]` | `paletteStringCharacters`
`protected java.lang.String[]` | `paletteStrings` palette mapping index to string representation
`protected int` | `state` current state of encoding

Constructor Summary
`XPMEncoder()`

Method Summary
`protected void` | `createPaletteStrings(java.awt.image.IndexColorModel cm)` Generate the strings which are used as color values.
`protected void` | `doImageEncode()` Workhorse method for actually encoding the image
`boolean` | `driveEncoder()` Drive the encoder through the image encoding process.
`protected void` | `generatePaletteStringCharacters()` Generate the characters which can legally be used to form palette strings.
`int` | `getState()` Return the state of the encoder.
`void` | `initSpecificEncoder(java.io.OutputStream out, AdaptiveRasterImage image)`
`protected java.lang.String` | `toPaddedHexString(int value)` Make a hex string out of an int, padding to 6 digits.
`protected void` | `writeHeader()` Write the XPM header to the output stream.
`protected void` | `writeImageData()` Write the image data to the output stream.
`protected void` | `writePalette(java.awt.image.IndexColorModel cm)` Write palette information to the output stream.
`protected void` | `writeTrailer()` Write the end of image marker.

Field Detail

### MAGIC

    protected static final java.lang.String MAGIC

### HEADER_STRING

    protected static final java.lang.String HEADER_STRING

### paletteStringCharacters

    protected static char[] paletteStringCharacters

### output

    protected java.io.PrintStream output

  destination for encoded data

### jimiImage

    protected AdaptiveRasterImage jimiImage

  JimiImage to get data from

### state

    protected int state

  current state of encoding

### paletteSize

    protected int paletteSize

  number of colors in palette

### paletteStrings

    protected java.lang.String[] paletteStrings

  palette mapping index to string representation

### entrySize

    protected int entrySize

  size of each palette entry

Constructor Detail

### XPMEncoder

    public XPMEncoder()

Method Detail

### initSpecificEncoder

    public void initSpecificEncoder(java.io.OutputStream out,
                                    AdaptiveRasterImage image)

### driveEncoder

    public boolean driveEncoder()
                         throws JimiException

  Drive the encoder through the image encoding process.

### getState

    public int getState()

  Return the state of the encoder.

### doImageEncode

    protected void doImageEncode()
                          throws JimiException,
                                 java.io.IOException

  Workhorse method for actually encoding the image

### createPaletteStrings

    protected void createPaletteStrings(java.awt.image.IndexColorModel cm)

  Generate the strings which are used as color values.

### writeHeader

    protected void writeHeader()
                        throws java.io.IOException

  Write the XPM header to the output stream.

### writePalette

    protected void writePalette(java.awt.image.IndexColorModel cm)
                         throws java.io.IOException

  Write palette information to the output stream.

### writeImageData

    protected void writeImageData()
                           throws java.io.IOException,
                                  JimiException

  Write the image data to the output stream.

### writeTrailer

    protected void writeTrailer()
                         throws java.io.IOException

  Write the end of image marker.

### toPaddedHexString

    protected java.lang.String toPaddedHexString(int value)

  Make a hex string out of an int, padding to 6 digits.
  Returns:
    a result of the form "0affb1".

### generatePaletteStringCharacters

    protected void generatePaletteStringCharacters()

  Generate the characters which can legally be used to form palette strings.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD