Package org.jfree.chart.encoders
Class KeypointPNGEncoderAdapter
java.lang.Object
org.jfree.chart.encoders.KeypointPNGEncoderAdapter
- All Implemented Interfaces:
ImageEncoder
Adapter class for the Keypoint PNG Encoder. The ImageEncoderFactory will
only return a reference to this class by default if the library has been
compiled under a JDK < 1.4 or is being run using a JDK < 1.4.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Encode alpha?private int
The quality setting. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
encode
(BufferedImage bufferedImage) Encodes an image in PNG format.void
encode
(BufferedImage bufferedImage, OutputStream outputStream) Encodes an image in PNG format and writes it to anOutputStream
.float
Get the quality of the image encoding.boolean
Get whether the encoder should encode alpha transparency.void
setEncodingAlpha
(boolean encodingAlpha) Set whether the encoder should encode alpha transparency (supported).void
setQuality
(float quality) Set the quality of the image encoding (supported).
-
Field Details
-
quality
private int qualityThe quality setting. -
encodingAlpha
private boolean encodingAlphaEncode alpha?
-
-
Constructor Details
-
KeypointPNGEncoderAdapter
public KeypointPNGEncoderAdapter()
-
-
Method Details
-
getQuality
public float getQuality()Get the quality of the image encoding. The underlying encoder uses int values: 0 for no compression, and values 1 through 9 for various levels of compression (1 is best speed, 9 is best compression).- Specified by:
getQuality
in interfaceImageEncoder
- Returns:
- A float representing the quality.
-
setQuality
public void setQuality(float quality) Set the quality of the image encoding (supported). The underlying encoder uses int values: 0 for no compression, and values 1 through 9 for various levels of compression (1 is best speed, 9 is best compression).- Specified by:
setQuality
in interfaceImageEncoder
- Parameters:
quality
- A float representing the quality.
-
isEncodingAlpha
public boolean isEncodingAlpha()Get whether the encoder should encode alpha transparency.- Specified by:
isEncodingAlpha
in interfaceImageEncoder
- Returns:
- Whether the encoder is encoding alpha transparency.
-
setEncodingAlpha
public void setEncodingAlpha(boolean encodingAlpha) Set whether the encoder should encode alpha transparency (supported).- Specified by:
setEncodingAlpha
in interfaceImageEncoder
- Parameters:
encodingAlpha
- Whether the encoder should encode alpha transparency.
-
encode
Encodes an image in PNG format.- Specified by:
encode
in interfaceImageEncoder
- Parameters:
bufferedImage
- The image to be encoded.- Returns:
- The byte[] that is the encoded image.
- Throws:
IOException
- if there is an IO problem.
-
encode
Encodes an image in PNG format and writes it to anOutputStream
.- Specified by:
encode
in interfaceImageEncoder
- Parameters:
bufferedImage
- The image to be encoded.outputStream
- The OutputStream to write the encoded image to.- Throws:
IOException
- if there is an IO problem.
-