|
JIU 0.12.0 Homepage | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jiu.ops.Operation
net.sourceforge.jiu.codecs.ImageCodec
net.sourceforge.jiu.codecs.BMPCodec
A codec to read and write Windows BMP image files.
Typical file extensions are .bmp
and .rle
(the latter is only used for compressed files).
This codec supports the bounds concept for loading and saving.
BilevelImage
can be given to the codec and it will load the image to that object
(if the image's resolution is sufficient).
If no image object is given to the codec, a new
MemoryBilevelImage
will be created.Paletted8Image
object.
This requires 50 % more space than is necessary, but there is
no dedicated 4 bit image data class in JIU.Paletted8Image
object.RGB24Image
object.
BilevelImage
objects are stored as 1 bit per pixel BMP files.Gray8Image
and
Paletted8Image
objects are stored as
paletted 8 bits per pixel files.
It doesn't really matter how many entries the palette has, the BMP file's
palette will always have 256 entries, filled up with zero entries if necessary.RGB24Image
objects are stored as 24 bpp BMP files.
InputStream
, OutputStream
,
DataInput
, DataOutput
,
RandomAccessFile
).
The RLE-compressed BMP files that I could test this codec on seem to
have an end-of-line code at the end of every line instead of relying
on the decoder to know when it has unpacked enough bytes for a line.
Whenever this codec encounters an EOL symbol and has a current column
value of 0
, the EOL is ignored.
BMPCodec codec = new BMPCodec(); codec.setImage(image); codec.setFile("out.bmp", CodecMode.SAVE); codec.process(); codec.close();Read an image from a BMP file.
BMPCodec codec = new BMPCodec(); codec.setFile("image.bmp", CodecMode.LOAD); codec.process(); codec.close(); PixelImage image = codec.getImage();
Constructor Summary | |
BMPCodec()
|
Method Summary | |
String[] |
getFileExtensions()
Returns all file extensions that are typical for this file format. |
String |
getFormatName()
Returns the name of the file format supported by this codec. |
String[] |
getMimeTypes()
Return the MIME (Multipurpose Internet Mail Extensions) type strings for this format, or null
if none are available. |
boolean |
isLoadingSupported()
Returns if this codec is able to load images in the file format supported by this codec. |
boolean |
isSavingSupported()
Returns if this codec is able to save images in the file format supported by this codec. |
void |
process()
This method does the actual work of the operation. |
String |
suggestFileExtension(PixelImage image)
Attempts to suggest a filename extension. |
Methods inherited from class net.sourceforge.jiu.codecs.ImageCodec |
appendComment, checkBounds, checkImageResolution, close, getBoundsHeight, getBoundsWidth, getBoundsX1, getBoundsX2, getBoundsY1, getBoundsY2, getComment, getDataInput, getDataOutput, getDpiX, getDpiY, getImage, getImageIndex, getInputAsDataInput, getInputStream, getMode, getNumComments, getOutputAsDataOutput, getOutputStream, getRandomAccessFile, hasBounds, initModeFromIOObjects, isRowRequired, isTileRequired, removeAllComments, removeBounds, setBounds, setBoundsIfNecessary, setDataInput, setDataOutput, setDpi, setFile, setFile, setImage, setImageIndex, setInputStream, setOutputStream, setRandomAccessFile |
Methods inherited from class net.sourceforge.jiu.ops.Operation |
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BMPCodec()
Method Detail |
public String[] getFileExtensions()
ImageCodec
null
.
The file extension strings should include a leading dot
and are supposed to be lower case (if that is allowed for
the given file format).
Example: {".jpg", ".jpeg"}
for the JPEG file format.
getFileExtensions
in class ImageCodec
public String getFormatName()
ImageCodec
ImageCodec
must override this method.
When overriding, leave out any words in a particular language so
that this format name can be understood by everyone.
Usually it is enough to return the format creator plus a typical
abbreviation, e.g. Microsoft BMP
or Portable Anymap (PNM)
.
getFormatName
in class ImageCodec
public String[] getMimeTypes()
ImageCodec
null
if none are available.
getMimeTypes
in class ImageCodec
public boolean isLoadingSupported()
ImageCodec
true
is returned this does not necessarily mean that all files in this
format can be read, but at least some.
isLoadingSupported
in class ImageCodec
public boolean isSavingSupported()
ImageCodec
true
is returned this does not necessarily mean that all types files in this
format can be written, but at least some.
isSavingSupported
in class ImageCodec
public void process() throws MissingParameterException, OperationFailedException
Operation
process
in class Operation
MissingParameterException
- if any mandatory parameter was not given to the operation
OperationFailedException
public String suggestFileExtension(PixelImage image)
ImageCodec
PNMCodec
).
This default implementation always returns null
.
suggestFileExtension
in class ImageCodec
image
- the image that is to be written to a file
null
if no file extension can be recommended
|
JIU 0.12.0 Homepage | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |