com.qoppa.pdfWriter
Class ImageParam

java.lang.Object
  extended bycom.qoppa.pdfWriter.ImageParam
All Implemented Interfaces:
Cloneable

public class ImageParam
extends Object
implements Cloneable

This class is used in the PDFGraphics object to determine how to store images in a PDF document when any of the drawImage methods are called. The class provides settings to decide what type of image compression to use (deflate, JPEG or JBIG2) and in the case of JPEG, what the compression quality should be.

Use instances of this object to make a call to PDFGraphics.setImageParams. After the call is made, all images drawn to the graphics object will be output to the PDF in the appropriate format.

JBIG2 compression is only available when the optional JBIG2 module has been purchased.

Author:
Qoppa Software

Field Summary
static int COMPRESSION_DEFLATE
          Use Deflate compression when saving images to the PDF document.
static int COMPRESSION_JBIG2
          Use JBIG2 compression when saving images to the PDF document.
static int COMPRESSION_JPEG
          Use JPEG compression when saving images to the PDF document.
 
Constructor Summary
ImageParam()
          Constructs a default image parameters object.
ImageParam(int compression)
          Constructs an ImageParam object with the given compression type.
ImageParam(int compression, float quality)
          Constructs an ImageParam object with the given compression type and quality setting.
 
Method Summary
 Object clone()
          Clones this object.
 int getCompression()
          Gets the compression type used when writing images to the PDF document.
 float getQuality()
          Gets the current quality settings.
 void setCompression(int compression)
          Sets the compression type used when writing images to the PDF document.
 void setQuality(float quality)
          Sets the current quality setting.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPRESSION_DEFLATE

public static final int COMPRESSION_DEFLATE
Use Deflate compression when saving images to the PDF document.

See Also:
Constant Field Values

COMPRESSION_JPEG

public static final int COMPRESSION_JPEG
Use JPEG compression when saving images to the PDF document.

See Also:
Constant Field Values

COMPRESSION_JBIG2

public static final int COMPRESSION_JBIG2
Use JBIG2 compression when saving images to the PDF document. When this compression is used, images will first be translate to black-and-white and then saved to the PDF document.
This compression is only available when the optional JBIG2 module has been activated.

See Also:
Constant Field Values
Constructor Detail

ImageParam

public ImageParam()
Constructs a default image parameters object. Compression is set to COMPRESSION_DEFLATE.


ImageParam

public ImageParam(int compression)
Constructs an ImageParam object with the given compression type.

Parameters:
compression - The type of compression.

ImageParam

public ImageParam(int compression,
                  float quality)
Constructs an ImageParam object with the given compression type and quality setting. Currently, the quality setting is only used when the compression type is set to COMPRESSION_JPEG.

Parameters:
compression - The type of compression.
quality - The quality setting.
Method Detail

getCompression

public int getCompression()
Gets the compression type used when writing images to the PDF document. This method will return one of the values: COMPRESSION_DEFLATE, COMPRESSION_JPEG, COMPRESSION_JBIG2

Returns:
The type of compression.

setCompression

public void setCompression(int compression)
Sets the compression type used when writing images to the PDF document. The types supported are COMPRESSION_DEFLATE, COMPRESSION_JPEG and COMPRESSION_JBIG2.

Parameters:
compression - The new compression type.

getQuality

public float getQuality()
Gets the current quality settings. This value is only used when the compression type is set to JPEG and ranges from 0.1 to 1.0.

Returns:
The current quality settings

setQuality

public void setQuality(float quality)
Sets the current quality setting. This value is only used when the compression type is set to JPEG and ranges from 0.1 to 1.0.

Parameters:
quality - The new compression quality. The value will be bounded to >= 0.1 and <= 1.0

clone

public Object clone()
Clones this object.

Returns:
A clone of this object.