com.sun.jimi.core
Class JimiUtils

java.lang.Object
  |
  +--com.sun.jimi.core.JimiUtils

public class JimiUtils
extends java.lang.Object

Extra functionality to compliment com.sun.jimi.core.Jimi.


Constructor Summary
JimiUtils()
           
 
Method Summary
static java.awt.image.ImageProducer aspectAdjust(JimiRasterImage image)
          Some image formats contain information about the aspect ratio of their images, aswell as their dimensions in pixels.
static java.awt.Image getThumbnail(java.io.InputStream input, int width, int height, int flags)
          Get a thumbnail of an image.
static java.awt.Image getThumbnail(java.io.InputStream input, int width, int height, int flags, java.lang.String typeID)
          Get a thumbnail of an image.
static java.awt.Image getThumbnail(java.lang.String filename, int width, int height, int flags)
          Get a thumbnail of an image.
static java.awt.Image getThumbnail(java.net.URL location, int width, int height, int flags)
          Get a thumbnail of an image.
static java.awt.image.ImageProducer getThumbnailProducer(java.io.InputStream input, int width, int height, int flags)
          Get a thumbnail of an image.
static java.awt.image.ImageProducer getThumbnailProducer(java.io.InputStream input, int width, int height, int flags, java.lang.String typeID)
          Get a thumbnail of an image.
static java.awt.image.ImageProducer getThumbnailProducer(java.lang.String filename, int width, int height, int flags)
          Get a thumbnail of an image.
static java.awt.image.ImageProducer getThumbnailProducer(java.net.URL location, int width, int height, int flags)
          Get a thumbnail of an image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JimiUtils

public JimiUtils()
Method Detail

aspectAdjust

public static java.awt.image.ImageProducer aspectAdjust(JimiRasterImage image)
Some image formats contain information about the aspect ratio of their images, aswell as their dimensions in pixels. This method takes a JimiRasterImage, and returns a filtered ImageProducer which corrects the aspect ratio of the image based on information provided by the decoder. If no information about the aspect ratio is stored by the JimiRasterImage, an unfiltered ImageProducer is returned so there is no overhead.

TIFF is an example of a format which stores additional information about the aspect ratio.

Parameters:
image - the image to correct the aspect ratio of
Returns:
an ImageProducer which sends aspect-corrected image data

getThumbnail

public static java.awt.Image getThumbnail(java.lang.String filename,
                                          int width,
                                          int height,
                                          int flags)
Get a thumbnail of an image. The thumbnail is a scaled-down copy of the image which will fit inside the specified dimensions, maintaining aspect ratio.
Parameters:
filename - the file to load the thumbnail from
width - the maximum width
height - the maximum height
flags - the mode of image loading

getThumbnailProducer

public static java.awt.image.ImageProducer getThumbnailProducer(java.lang.String filename,
                                                                int width,
                                                                int height,
                                                                int flags)
Get a thumbnail of an image. The thumbnail is a scaled-down copy of the image which will fit inside the specified dimensions, maintaining aspect ratio.
Parameters:
filename - the file to load the thumbnail from
width - the maximum width
height - the maximum height
flags - image loading flags

getThumbnail

public static java.awt.Image getThumbnail(java.net.URL location,
                                          int width,
                                          int height,
                                          int flags)
Get a thumbnail of an image. The thumbnail is a scaled-down copy of the image which will fit inside the specified dimensions, maintaining aspect ratio.
Parameters:
location - the URL to load the image from
width - the maximum width
height - the maximum height
flags - the mode of image loading

getThumbnailProducer

public static java.awt.image.ImageProducer getThumbnailProducer(java.net.URL location,
                                                                int width,
                                                                int height,
                                                                int flags)
Get a thumbnail of an image. The thumbnail is a scaled-down copy of the image which will fit inside the specified dimensions, maintaining aspect ratio.
Parameters:
location - the URL to load the image from
width - the maximum width
height - the maximum height
flags - the mode of image loading

getThumbnail

public static java.awt.Image getThumbnail(java.io.InputStream input,
                                          int width,
                                          int height,
                                          int flags)
Get a thumbnail of an image. The thumbnail is a scaled-down copy of the image which will fit inside the specified dimensions, maintaining aspect ratio.
Parameters:
input - the stream to read the image from
width - the maximum width
height - the maximum height
flags - the mode of image loading

getThumbnailProducer

public static java.awt.image.ImageProducer getThumbnailProducer(java.io.InputStream input,
                                                                int width,
                                                                int height,
                                                                int flags)
Get a thumbnail of an image. The thumbnail is a scaled-down copy of the image which will fit inside the specified dimensions, maintaining aspect ratio.
Parameters:
input - the stream to read the image from
width - the maximum width
height - the maximum height
flags - the mode of image loading

getThumbnail

public static java.awt.Image getThumbnail(java.io.InputStream input,
                                          int width,
                                          int height,
                                          int flags,
                                          java.lang.String typeID)
Get a thumbnail of an image. The thumbnail is a scaled-down copy of the image which will fit inside the specified dimensions, maintaining aspect ratio.
Parameters:
input - the stream to read the image from
width - the maximum width
height - the maximum height
flags - the mode of image loading
typeID - the mime-type of the image format

getThumbnailProducer

public static java.awt.image.ImageProducer getThumbnailProducer(java.io.InputStream input,
                                                                int width,
                                                                int height,
                                                                int flags,
                                                                java.lang.String typeID)
Get a thumbnail of an image. The thumbnail is a scaled-down copy of the image which will fit inside the specified dimensions, maintaining aspect ratio.
Parameters:
input - the stream to read the image from
width - the maximum width
height - the maximum height
flags - the mode of image loading
typeID - the mime-type of the image format