rebuild.graphics
Class JPEGEncoder

java.lang.Object
  extended by rebuild.graphics.ImageEncoder
      extended by rebuild.graphics.JPEGEncoder

public class JPEGEncoder
extends ImageEncoder

A JPEG encoder.

Since:
BBX 1.0.1

Field Summary
 
Fields inherited from class rebuild.graphics.ImageEncoder
compressionLevel, dataBytes, encodeAlpha, height, image, scaleX, scaleY, width, xOffset, yOffset
 
Constructor Summary
JPEGEncoder()
          Class constructor
JPEGEncoder(Bitmap image)
          Class constructor specifying Bitmap to encode, with no alpha channel encoding.
JPEGEncoder(Bitmap image, int compression)
          Class constructor specifying Bitmap to encode, with no alpha channel encoding.
 
Method Summary
 java.lang.String getMime()
          Get the MIME type of the image encoder.
protected  byte[] inEncode(boolean encodeAlpha)
          Creates an array of bytes that is the JPEG equivalent of the current image, specifying whether to encode alpha or not.
 void setCompressionLevel(int level)
          Set the compression level to use
 
Methods inherited from class rebuild.graphics.ImageEncoder
encode, encode, getARGBByte, getARGBInt, getCompressionLevel, getEncodeAlpha, getIndex, getIndex, setEncodeAlpha, setImage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPEGEncoder

public JPEGEncoder()
Class constructor


JPEGEncoder

public JPEGEncoder(Bitmap image)
Class constructor specifying Bitmap to encode, with no alpha channel encoding.

Parameters:
image - A Java Image object which uses the DirectColorModel.

JPEGEncoder

public JPEGEncoder(Bitmap image,
                   int compression)
Class constructor specifying Bitmap to encode, with no alpha channel encoding.

Parameters:
image - A Java Image object which uses the DirectColorModel.
compression - The compression level to use, the range is 0 - 100.
Method Detail

getMime

public java.lang.String getMime()
Get the MIME type of the image encoder.

Specified by:
getMime in class ImageEncoder
Returns:
The MIME type of the image encoder.

setCompressionLevel

public void setCompressionLevel(int level)
Set the compression level to use

Overrides:
setCompressionLevel in class ImageEncoder
Parameters:
level - 0 through 100

inEncode

protected byte[] inEncode(boolean encodeAlpha)
                   throws java.io.IOException
Creates an array of bytes that is the JPEG equivalent of the current image, specifying whether to encode alpha or not.

Specified by:
inEncode in class ImageEncoder
Parameters:
encodeAlpha - Ignored, JPEG's don't have an alpha channel.
Returns:
An array of bytes, or null if there was a problem.
Throws:
java.io.IOException - If an error occurs.