java.lang.Object
org.jfree.chart.encoders.SunJPEGEncoderAdapter
- All Implemented Interfaces:
ImageEncoder
Adapter class for the Sun JPEG Encoder. The
ImageEncoderFactory
will only return a reference to this class by default if the library has
been compiled under a JDK 1.4+ and is being run using a JRE 1.4+.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]encode(BufferedImage bufferedImage) Encodes an image in JPEG format.voidencode(BufferedImage bufferedImage, OutputStream outputStream) Encodes an image in JPEG format and writes it to an output stream.floatReturns the quality of the image encoding, which is a number in the range 0.0f to 1.0f (higher values give better quality output, but larger file sizes).booleanReturnsfalsealways, indicating that this encoder does not encode alpha transparency.voidsetEncodingAlpha(boolean encodingAlpha) Set whether the encoder should encode alpha transparency (this is not supported for JPEG, so this method does nothing).voidsetQuality(float quality) Set the quality of the image encoding.
-
Constructor Details
-
SunJPEGEncoderAdapter
public SunJPEGEncoderAdapter()Creates a newSunJPEGEncoderAdapterinstance.
-
-
Method Details
-
getQuality
public float getQuality()Returns the quality of the image encoding, which is a number in the range 0.0f to 1.0f (higher values give better quality output, but larger file sizes). The default value is 0.95f.- Specified by:
getQualityin interfaceImageEncoder- Returns:
- A float representing the quality, in the range 0.0f to 1.0f.
- See Also:
-
setQuality
public void setQuality(float quality) Set the quality of the image encoding.- Specified by:
setQualityin interfaceImageEncoder- Parameters:
quality- A float representing the quality (in the range 0.0f to 1.0f).- See Also:
-
isEncodingAlpha
public boolean isEncodingAlpha()Returnsfalsealways, indicating that this encoder does not encode alpha transparency.- Specified by:
isEncodingAlphain interfaceImageEncoder- Returns:
false.
-
setEncodingAlpha
public void setEncodingAlpha(boolean encodingAlpha) Set whether the encoder should encode alpha transparency (this is not supported for JPEG, so this method does nothing).- Specified by:
setEncodingAlphain interfaceImageEncoder- Parameters:
encodingAlpha- ignored.
-
encode
Encodes an image in JPEG format.- Specified by:
encodein interfaceImageEncoder- Parameters:
bufferedImage- the image to be encoded (nullnot permitted).- Returns:
- The byte[] that is the encoded image.
- Throws:
IOException- if there is an I/O problem.NullPointerException- ifbufferedImageisnull.
-
encode
Encodes an image in JPEG format and writes it to an output stream.- Specified by:
encodein interfaceImageEncoder- Parameters:
bufferedImage- the image to be encoded (nullnot permitted).outputStream- the OutputStream to write the encoded image to (nullnot permitted).- Throws:
IOException- if there is an I/O problem.NullPointerException- ifbufferedImageisnull.
-