|
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.PalmCodec
A codec to read and write image files in the native image file format of Palm OS, an operating system for handheld devices.
BilevelImage
: will be saved as a 1 bit per pixel, monochrome file.Gray8Image
: will be saved as an 8 bits per pixel file with a custom
palette which will contain the 256 shades of gray from black - (0, 0, 0) - to
white - (255, 255, 255).Paletted8Image
: it is first checked if the image is using the
Palm system 8 bits per pixel palette. If so, an 8 bits per pixel file
with no custom palette is written, otherwise an 8 bits per pixel file
with a custom palette (of the original length) is written.
RGB24Image
: will be saved as a 16 bits per pixel, direct color file.
Some information will get lost when converting from 24 to 16 bits per pixel.
Instead of 256 shades for each red, green and blue (and thus, 2563 = 16,777,216
possible colors) the resulting file will only
use 32 shades of red and blue and 64 shades of green (65,536 possible colors).setFile(java.lang.String, net.sourceforge.jiu.codecs.CodecMode)
which does that automatically.
.palm
as file extension for this file format.
This is by no means official, but I find it helpful.
PalmCodec codec = new PalmCodec(); codec.setFile("test.palm", CodecMode.LOAD); codec.process(); PixelImage image = codec.getImage(); codec.close();Save an image to a Palm file using RLE compression:
PalmCodec codec = new PalmCodec(); codec.setImage(image); codec.setCompression(PalmCodec.COMPRESSION_RLE); codec.setFile("out.palm", CodecMode.SAVE); codec.process(); codec.close();
pnmtopalm
and
palmtopnm
that are part of the
Netpbm package,
Field Summary | |
static int |
COMPRESSION_NONE
Constant for compression type Uncompressed. |
static int |
COMPRESSION_PACKBITS
Constant for compression type Packbits. |
static int |
COMPRESSION_RLE
Constant for compression type RLE (run length encoding). |
static int |
COMPRESSION_SCANLINE
Constant for compression type Scanline. |
Constructor Summary | |
PalmCodec()
|
Method Summary | |
static Palette |
createSystem2BitGrayscalePalette()
Creates the 2 bits per pixel Palm system palette with grayscale values. |
static Palette |
createSystem4BitColorPalette()
Creates the 4 bits per pixel Palm system palette with color values. |
static Palette |
createSystem4BitGrayscalePalette()
Creates the 4 bits per pixel Palm system palette with grayscale values. |
static Palette |
createSystem8BitPalette()
Creates the 8 bits per pixel Palm system palette. |
int |
getCompression()
Returns the Palm compression method. |
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. |
int |
getTransparencyIndex()
Returns the transpareny index if one is available ( hasTransparencyIndex()
returns true ) or an undefined value otherwise. |
boolean |
hasTransparencyIndex()
Returns whether a transpareny index is available and can be retrieved via getTransparencyIndex() . |
boolean |
isLoadingSupported()
Returns if this codec is able to load images in the file format supported by this codec. |
static boolean |
isPalmSystemPalette256(Palette palette)
Returns if the argument palette is the Palm system palette with 256 colors. |
static boolean |
isPalmSystemPaletteColor16(Palette palette)
Returns if the argument palette is the Palm system color palette with 16 entries. |
static boolean |
isPalmSystemPaletteGray16(Palette palette)
Returns if the argument palette is the Palm system grayscale palette with 16 entries. |
static boolean |
isPalmSystemPaletteGray4(Palette palette)
Returns if the argument palette is the Palm system grayscale palette with 4 entries. |
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. |
void |
removeTransparencyIndex()
Removes the transparency index if one has been set. |
void |
setCompression(int newCompressionType)
Sets the compression algorithm to be used for saving an image. |
void |
setFile(String fileName,
CodecMode codecMode)
Reuses super.setFile when used for CodecMode.LOAD, but creates a RandomAccessFile instead of a FileOutputStream in write mode so that the compressed size can be written correcly (requires a seek operation). |
void |
setTransparencyIndex(int newIndex)
Sets a new transparency index when saving an image. |
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, getFileExtensions, getImage, getImageIndex, getInputAsDataInput, getInputStream, getMode, getNumComments, getOutputAsDataOutput, getOutputStream, getRandomAccessFile, hasBounds, initModeFromIOObjects, isRowRequired, isTileRequired, removeAllComments, removeBounds, setBounds, setBoundsIfNecessary, setDataInput, setDataOutput, setDpi, 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 |
Field Detail |
public static final int COMPRESSION_NONE
public static final int COMPRESSION_PACKBITS
public static final int COMPRESSION_RLE
public static final int COMPRESSION_SCANLINE
Constructor Detail |
public PalmCodec()
Method Detail |
public static Palette createSystem2BitGrayscalePalette()
public static Palette createSystem4BitColorPalette()
public static Palette createSystem4BitGrayscalePalette()
public static Palette createSystem8BitPalette()
public int getCompression()
setCompression(int)
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 int getTransparencyIndex()
hasTransparencyIndex()
returns true
) or an undefined value otherwise.
hasTransparencyIndex()
,
removeTransparencyIndex()
,
setTransparencyIndex(int)
public boolean hasTransparencyIndex()
getTransparencyIndex()
.
getTransparencyIndex()
,
removeTransparencyIndex()
,
setTransparencyIndex(int)
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 static boolean isPalmSystemPaletteGray4(Palette palette)
palette
- to be checkedcreateSystem2BitGrayscalePalette()
public static boolean isPalmSystemPaletteGray16(Palette palette)
palette
- to be checkedcreateSystem4BitGrayscalePalette()
public static boolean isPalmSystemPaletteColor16(Palette palette)
palette
- to be checkedcreateSystem4BitColorPalette()
public static boolean isPalmSystemPalette256(Palette palette)
palette
- to be checked
createSystem8BitPalette()
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 InvalidFileStructureException, MissingParameterException, OperationFailedException, WrongParameterException
Operation
process
in class Operation
MissingParameterException
- if any mandatory parameter was not given to the operation
WrongParameterException
- if at least one of the input parameters was
not initialized appropriately (values out of the valid interval, etc.)
OperationFailedException
InvalidFileStructureException
public void removeTransparencyIndex()
getTransparencyIndex()
,
hasTransparencyIndex()
,
setTransparencyIndex(int)
public void setCompression(int newCompressionType)
newCompressionType
- int value that is one of the COMPRESSION_xyz constants of this class
IllegalArgumentException
- if the compression type is unsupportedgetCompression()
public void setFile(String fileName, CodecMode codecMode) throws IOException, UnsupportedCodecModeException
setFile
in class ImageCodec
fileName
- name of the file to be openedcodecMode
- defines whether this codec object is to be used for loading or saving
IOException
UnsupportedCodecModeException
public void setTransparencyIndex(int newIndex)
newIndex
- the new transparency index, must be smaller than the number of entries in the palettegetTransparencyIndex()
,
hasTransparencyIndex()
,
removeTransparencyIndex()
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 |