public interface

ImageEncoder

org.jfree.chart.encoders.ImageEncoder
Known Indirect Subclasses

Class Overview

Interface for abstracting different types of image encoders.

Summary

Public Methods
abstract byte[] encode(BufferedImage bufferedImage)
Encodes an image in a particular format.
abstract void encode(BufferedImage bufferedImage, OutputStream outputStream)
Encodes an image in a particular format and writes it to an OutputStream.
abstract float getQuality()
Get the quality of the image encoding.
abstract boolean isEncodingAlpha()
Get whether the encoder should encode alpha transparency.
abstract void setEncodingAlpha(boolean encodingAlpha)
Set whether the encoder should encode alpha transparency (not supported by all ImageEncoders).
abstract void setQuality(float quality)
Set the quality of the image encoding (not supported by all ImageEncoders).

Public Methods

public abstract byte[] encode (BufferedImage bufferedImage)

Encodes an image in a particular format.

Parameters
bufferedImage The image to be encoded.
Returns
  • The byte[] that is the encoded image.
Throws
IOException

public abstract void encode (BufferedImage bufferedImage, OutputStream outputStream)

Encodes an image in a particular format and writes it to an OutputStream.

Parameters
bufferedImage The image to be encoded.
outputStream The OutputStream to write the encoded image to.
Throws
IOException

public abstract float getQuality ()

Get the quality of the image encoding.

Returns
  • A float representing the quality.

public abstract boolean isEncodingAlpha ()

Get whether the encoder should encode alpha transparency.

Returns
  • Whether the encoder is encoding alpha transparency.

public abstract void setEncodingAlpha (boolean encodingAlpha)

Set whether the encoder should encode alpha transparency (not supported by all ImageEncoders).

Parameters
encodingAlpha Whether the encoder should encode alpha transparency.

public abstract void setQuality (float quality)

Set the quality of the image encoding (not supported by all ImageEncoders).

Parameters
quality A float representing the quality.