lt.monarch.image.jpeg
Class JPEGEncoder

java.lang.Object
  extended by lt.monarch.image.AbstractEncoder
      extended by lt.monarch.image.jpeg.JPEGEncoder
All Implemented Interfaces:
java.io.Serializable

public class JPEGEncoder
extends AbstractEncoder

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
 
Fields inherited from class lt.monarch.image.AbstractEncoder
image
 
Constructor Summary
Constructor and Description
JPEGEncoder()
           
 
Method Summary
Modifier and Type Method and Description
 void encode(java.awt.Image _image, java.io.OutputStream outputStream)
          Encodes a BufferedImage as a JPEG data stream.
 java.lang.String getContentType()
          Returns content type string - 'jpeg'
 void setPhysicalDimension(int xPixelsPerInch, int yPixelsPerInch)
          Sets DPI (dots per inch) of resulting image.
 void setQuality(float quality)
          This method simply wraps the JPEGCodec.setQuality call.
 
Methods inherited from class lt.monarch.image.AbstractEncoder
readObject, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPEGEncoder

public JPEGEncoder()
Method Detail

getContentType

public java.lang.String getContentType()
Returns content type string - 'jpeg'

Specified by:
getContentType in class AbstractEncoder
Returns:
content type string

setQuality

public void setQuality(float quality)
This method simply wraps the JPEGCodec.setQuality call.

Parameters:
quality - - image quality value, in range [0..1]. Some guidelines: 0.75 high quality 0.5 medium quality 0.25 low quality

encode

public void encode(java.awt.Image _image,
                   java.io.OutputStream outputStream)
            throws java.io.IOException,
                   java.lang.InterruptedException
Encodes a BufferedImage as a JPEG data stream.

Specified by:
encode in class AbstractEncoder
Parameters:
_image -
outputStream -
Throws:
java.io.IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
java.lang.InterruptedException

setPhysicalDimension

public void setPhysicalDimension(int xPixelsPerInch,
                                 int yPixelsPerInch)
Sets DPI (dots per inch) of resulting image.

Parameters:
xPixelsPerInch - number of pixels per inch (horizontal dimension)
yPixelsPerInch - number of pixels per inch (vertical dimension)