se.datadosen.jalbum
Class AlbumImage

java.lang.Object
  extended by se.datadosen.jalbum.AlbumImage

public class AlbumImage
extends java.lang.Object

This class is an abstraction of an album image. Currently it simplifies loading, scaling, filtering and saving images, but in the future this class will have a more central role as abstraction instead of File and BufferedImage objects.


Constructor Summary
  AlbumImage(java.awt.image.BufferedImage image, AlbumBean engine)
           
  AlbumImage(java.io.File imageFile, AlbumBean engine)
          Construct an AlbumImage from a File and AlbumBean instance
protected AlbumImage(java.io.File file, java.awt.image.BufferedImage im, int stage, AlbumBean engine)
          Construct an AlbumImage, also telling what stage an image is in: (1=original, 2=scaled to closeup size for use by closeups and thumbnails, 3=scaled to closeup size for use by closeups only, 4=scaled to closeup size for use by thumbnails, 5=scaled to thumbnail size for use by thumbnails.
 
Method Summary
 AlbumImage applyFilter(JAFilter filter)
          Return new AlbumImage, filtered with the specified filter
 AlbumImage applyFilter(JAFilter filter, java.util.Map vars)
          Return new AlbumImage, filtered with the specified filter and variables
 AlbumImage applyFilters()
          Return new AlbumImage, filtered with the filters and variables installed in the engine for the current stage
 AlbumImage applyFilters(int stage)
          Return new AlbumImage, filtered with the filters and variables installed in the engine for the specified stage
protected static java.awt.image.BufferedImage cloneImage(java.awt.image.BufferedImage im)
           
 java.awt.image.BufferedImage getBufferedImage()
           
 java.awt.Image getImage()
           
 AlbumImage saveJPEG(java.io.File output)
           
 AlbumImage saveJPEG(java.io.File output, int qualityPercent)
           
 AlbumImage scaleToCloseup()
          Return new AlbumImage, scaled to closeup size (and with closeup stage set)
 AlbumImage scaleToFit(java.awt.Dimension dim)
          Return new AlbumImage, scaled to specified dimension
protected  AlbumImage scaleToFit(java.awt.Dimension dim, int stage)
           
 AlbumImage scaleToThumbnail()
          Return new AlbumImage, scaled to thumbnail size (and with thumbnail stage set)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlbumImage

public AlbumImage(java.awt.image.BufferedImage image,
                  AlbumBean engine)

AlbumImage

public AlbumImage(java.io.File imageFile,
                  AlbumBean engine)
           throws com.sun.image.codec.jpeg.ImageFormatException,
                  java.io.IOException
Construct an AlbumImage from a File and AlbumBean instance

Throws:
com.sun.image.codec.jpeg.ImageFormatException
java.io.IOException

AlbumImage

protected AlbumImage(java.io.File file,
                     java.awt.image.BufferedImage im,
                     int stage,
                     AlbumBean engine)
Construct an AlbumImage, also telling what stage an image is in: (1=original, 2=scaled to closeup size for use by closeups and thumbnails, 3=scaled to closeup size for use by closeups only, 4=scaled to closeup size for use by thumbnails, 5=scaled to thumbnail size for use by thumbnails. The stage information is usually not relevant, but image filters may use it to decide on different behaviour.

Method Detail

cloneImage

protected static java.awt.image.BufferedImage cloneImage(java.awt.image.BufferedImage im)

scaleToFit

public AlbumImage scaleToFit(java.awt.Dimension dim)
Return new AlbumImage, scaled to specified dimension

Parameters:
dim -
Returns:

scaleToFit

protected AlbumImage scaleToFit(java.awt.Dimension dim,
                                int stage)

scaleToThumbnail

public AlbumImage scaleToThumbnail()
Return new AlbumImage, scaled to thumbnail size (and with thumbnail stage set)

Returns:

scaleToCloseup

public AlbumImage scaleToCloseup()
Return new AlbumImage, scaled to closeup size (and with closeup stage set)

Returns:

applyFilter

public AlbumImage applyFilter(JAFilter filter,
                              java.util.Map vars)
Return new AlbumImage, filtered with the specified filter and variables

Parameters:
filter -
vars -
Returns:

applyFilter

public AlbumImage applyFilter(JAFilter filter)
Return new AlbumImage, filtered with the specified filter

Parameters:
filter -
Returns:

applyFilters

public AlbumImage applyFilters(int stage)
Return new AlbumImage, filtered with the filters and variables installed in the engine for the specified stage

Parameters:
stage -
Returns:

applyFilters

public AlbumImage applyFilters()
Return new AlbumImage, filtered with the filters and variables installed in the engine for the current stage

Returns:

getImage

public java.awt.Image getImage()

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()

saveJPEG

public AlbumImage saveJPEG(java.io.File output,
                           int qualityPercent)
                    throws com.sun.image.codec.jpeg.ImageFormatException,
                           java.io.IOException
Throws:
com.sun.image.codec.jpeg.ImageFormatException
java.io.IOException

saveJPEG

public AlbumImage saveJPEG(java.io.File output)
                    throws java.io.IOException,
                           com.sun.image.codec.jpeg.ImageFormatException
Throws:
java.io.IOException
com.sun.image.codec.jpeg.ImageFormatException