fi.faidon.jis
Class TargaImageSaver

java.lang.Object
  |
  +--fi.faidon.jis.ImageSaverInterface
        |
        +--fi.faidon.jis.TargaImageSaver
All Implemented Interfaces:
java.awt.image.ImageConsumer, java.io.Serializable

public class TargaImageSaver
extends ImageSaverInterface
implements java.io.Serializable, java.awt.image.ImageConsumer

Class for saving an Image object to file using the TrueVision Targa format. Only 24-bit uncompressed format supported.

See Also:
Serialized Form

Field Summary
static java.lang.String FORMAT_CODE
           
static java.lang.String FORMAT_COMPLETE_NAME
           
static java.lang.String FORMAT_EXTENSION
           
 
Fields inherited from class fi.faidon.jis.ImageSaverInterface
saveImage, savePath
 
Fields inherited from interface java.awt.image.ImageConsumer
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT
 
Constructor Summary
TargaImageSaver()
           
 
Method Summary
 int checkSave()
          Return ImageObserver constants for indicating the state of the image saving.
 java.lang.String getFormatCode()
          ImageSaverInterface method implementations.
 java.lang.String getFormatExtension()
           
 java.lang.String getFormatString()
           
 void imageComplete(int status)
          Get imageComplete message so that we can close the output file.
static void main(java.lang.String[] argv)
          Main for testing this class.
 boolean saveIt()
          Save the image.
 void setColorModel(java.awt.image.ColorModel model)
           
 void setDimensions(int w, int h)
          Override the source image's dimensions and pass the dimensions of the rectangular cropped region to the ImageConsumer.
 void setHints(int hintflags)
           
 void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, byte[] pixels, int off, int scansize)
          Override the source image's setPixels method so that we can replace all non-transparent pixels with the given fill color or pattern.
 void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, int[] pixels, int off, int scansize)
          Override the source image's setPixels method so that we can replace all non-transparent pixels with the given fill color or pattern.
 void setProperties(java.util.Hashtable props)
          ImageConsumer method implementations.
 
Methods inherited from class fi.faidon.jis.ImageSaverInterface
getSaveImage, getSavePath, setSaveImage, setSavePath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_CODE

public static java.lang.String FORMAT_CODE

FORMAT_COMPLETE_NAME

public static java.lang.String FORMAT_COMPLETE_NAME

FORMAT_EXTENSION

public static java.lang.String FORMAT_EXTENSION
Constructor Detail

TargaImageSaver

public TargaImageSaver()
Method Detail

main

public static void main(java.lang.String[] argv)
Main for testing this class.


getFormatCode

public java.lang.String getFormatCode()
ImageSaverInterface method implementations.

Specified by:
getFormatCode in class ImageSaverInterface

getFormatString

public java.lang.String getFormatString()
Specified by:
getFormatString in class ImageSaverInterface

getFormatExtension

public java.lang.String getFormatExtension()
Specified by:
getFormatExtension in class ImageSaverInterface

saveIt

public boolean saveIt()
Save the image.

Specified by:
saveIt in class ImageSaverInterface

checkSave

public int checkSave()
Return ImageObserver constants for indicating the state of the image saving.

Specified by:
checkSave in class ImageSaverInterface

setProperties

public void setProperties(java.util.Hashtable props)
ImageConsumer method implementations.

Specified by:
setProperties in interface java.awt.image.ImageConsumer

setHints

public void setHints(int hintflags)
Specified by:
setHints in interface java.awt.image.ImageConsumer

setColorModel

public void setColorModel(java.awt.image.ColorModel model)
Specified by:
setColorModel in interface java.awt.image.ImageConsumer

setDimensions

public void setDimensions(int w,
                          int h)
Override the source image's dimensions and pass the dimensions of the rectangular cropped region to the ImageConsumer.

Specified by:
setDimensions in interface java.awt.image.ImageConsumer
See Also:
ImageConsumer.

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      java.awt.image.ColorModel model,
                      byte[] pixels,
                      int off,
                      int scansize)
Override the source image's setPixels method so that we can replace all non-transparent pixels with the given fill color or pattern. All transparent pixels are replaced by the background color.

Specified by:
setPixels in interface java.awt.image.ImageConsumer
See Also:
ImageConsumer.

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      java.awt.image.ColorModel model,
                      int[] pixels,
                      int off,
                      int scansize)
Override the source image's setPixels method so that we can replace all non-transparent pixels with the given fill color or pattern. All transparent pixels are replaced by the background color.

Specified by:
setPixels in interface java.awt.image.ImageConsumer
See Also:
ImageConsumer.

imageComplete

public void imageComplete(int status)
Get imageComplete message so that we can close the output file.

Specified by:
imageComplete in interface java.awt.image.ImageConsumer
See Also:
ImageConsumer.