org.dmonix.util.image
Class JpegProducer

java.lang.Object
  extended byorg.dmonix.util.image.JpegProducer

public class JpegProducer
extends java.lang.Object

Utility class for creating JPEG encoded images.

Copyright: Copyright (c) 2003

Company: dmonix.org

Version:
1.0
Author:
Peter Nerg

Constructor Summary
JpegProducer()
           
 
Method Summary
 java.awt.image.BufferedImage createImage(ImageObject imageObject)
          Creates a buffered image out of an image object.
static void encodeImage(java.awt.image.BufferedImage bi, java.io.File file)
          Encodes the buffered image to any given file.
static void encodeImage(java.awt.image.BufferedImage bi, java.io.OutputStream stream)
          Encodes the buffered image to any given output stream.
 void encodeImage(ImageObject imageObject, java.io.OutputStream stream)
          Encodes the image object to any given output stream.
 java.awt.image.BufferedImage getBufferedImage()
          Returns the current buffered image.
 java.awt.image.BufferedImage getImage()
          Deprecated.  
 void setBackground(java.awt.Color bgColor)
          Set the background color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JpegProducer

public JpegProducer()
Method Detail

setBackground

public void setBackground(java.awt.Color bgColor)
Set the background color.

Parameters:
bgColor - The background color

encodeImage

public static void encodeImage(java.awt.image.BufferedImage bi,
                               java.io.OutputStream stream)
                        throws java.io.IOException
Encodes the buffered image to any given output stream.
Note that the method does neither flush nor close the given stream.

Parameters:
bi - The buffered image
stream - The stream to write the image to
Throws:
java.io.IOException

encodeImage

public static void encodeImage(java.awt.image.BufferedImage bi,
                               java.io.File file)
                        throws java.io.IOException
Encodes the buffered image to any given file.
Any existing file will be overwritten.

Parameters:
bi - The buffered image
file - The file to write the image to
Throws:
java.io.IOException

encodeImage

public void encodeImage(ImageObject imageObject,
                        java.io.OutputStream stream)
                 throws java.io.IOException
Encodes the image object to any given output stream.
Note that the method does neither flush nor close the given stream.

Parameters:
imageObject - The object used to render an image
stream - The output stream
Throws:
java.io.IOException

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()
Returns the current buffered image.

Returns:
The buffered image

getImage

public java.awt.image.BufferedImage getImage()
Deprecated.  

Returns:

createImage

public java.awt.image.BufferedImage createImage(ImageObject imageObject)
                                         throws java.io.IOException
Creates a buffered image out of an image object.

Parameters:
imageObject - The image object
Returns:
The image
Throws:
java.io.IOException


Copyright © 1998-2005 dmonix.org Peter Nerg, All Rights Reserved.