net.sourceforge.jiu.codecs
Class IFFCodec
A codec to read Amiga IFF image files.
IFF (Interchange File Format) is an Amiga wrapper file format for texts, images, animations, sound and other kinds of data.
This codec only deals with image IFF files.
Typical file extensions for IFF image files are
.lbm
and
.iff
.
Loading / saving
Only loading is supported by this codec.
Supported file types
Both uncompressed and run-length encoded files are read.
- 1 to 8 bit indexed (paletted) color
- 24 bit RGB truecolor
- HAM6 and HAM8 images (which are a mixture of paletted and truecolor)
Usage example
IFFCodec codec = new IFFCodec();
codec.setFile("image.iff", CodecMode.LOAD);
codec.process();
PixelImage image = codec.getImage();
boundsAvail , boundsHeight , boundsWidth , boundsX1 , boundsX2 , boundsY1 , boundsY2 , comments , din , dout , dpiX , dpiY , image , imageIndex , in , mode , out , raf |
appendComment , checkBounds , checkImageResolution , close , getBoundsHeight , getBoundsWidth , getBoundsX1 , getBoundsX2 , getBoundsY1 , getBoundsY2 , getComment , getDataInput , getDataOutput , getDpiX , getDpiY , getFileExtensions , getFormatName , getImage , getImageIndex , getInputAsDataInput , getInputStream , getMimeTypes , getMode , getNumComments , getOutputAsDataOutput , getOutputStream , getRandomAccessFile , hasBounds , initModeFromIOObjects , isLoadingSupported , isRowRequired , isSavingSupported , isTileRequired , removeAllComments , removeBounds , setBounds , setBoundsIfNecessary , setDataInput , setDataOutput , setDpi , setFile , setFile , setImage , setImageIndex , setInputStream , setOutputStream , setRandomAccessFile , suggestFileExtension |
COMPRESSION_NONE
private static final byte COMPRESSION_NONE
COMPRESSION_RLE
private static final byte COMPRESSION_RLE
MAGIC_BMHD
private static final int MAGIC_BMHD
MAGIC_BODY
private static final int MAGIC_BODY
MAGIC_CAMG
private static final int MAGIC_CAMG
MAGIC_CMAP
private static final int MAGIC_CMAP
MAGIC_FORM
private static final int MAGIC_FORM
MAGIC_ILBM
private static final int MAGIC_ILBM
MAGIC_PBM
private static final int MAGIC_PBM
SIZE_BMHD
private static final int SIZE_BMHD
compression
private byte compression
numPlanes
private int numPlanes
rgb24
private boolean rgb24
convertRow
private void convertRow(byte[][] sourcePlaneData,
byte[][] dest)
Converts input planes to index or truecolor output values.
Exact interpretation depends on the type of ILBM image storage:
- normal mode; the 1 to 8 planes create index values which are used
with the colormap
- RGB24; each of the 24 planes adds one bit to the three intensity
values for red, green and blue; no color map is necessary
- HAM6; a six bit integer (0 to 63) is assembled from the planes
and the top two bits determine if the previous color is modified or
if the lower four bits are used as an index into the palette (which
has consequently 24 = 16 entries
createExtraHalfbritePalette
private void createExtraHalfbritePalette()
getChunkName
private static String getChunkName(int name)
loadBytes
private void loadBytes(DataInput in,
byte[] data,
int num,
int y)
throws InvalidFileStructureException,
IOException
Loads data.length bytes from the input stream to the data array,
regarding the compression type.
COMPRESSION_NONE will make this method load data.length bytes from
the input stream.
COMPRESSION_RLE will make this method decompress data.length bytes
from input.
loadImage
private PixelImage loadImage(DataInput in)
throws InvalidFileStructureException,
IOException,
UnsupportedTypeException,
WrongParameterException
Loads an image from given input stream in, regarding the compression
type. The image will have 1 to 8 or 24 planes, a resolution given by
the dimension width times height. The color map data will be used to
convert index values to RGB pixels.
Returns the resulting image.
Will throw an IOException if either there were errors reading from the
input stream or if the file does not exactly match the file format.