Package jahuwaldt.image.encoders
Class PNGEncoderAdapter
- java.lang.Object
-
- jahuwaldt.image.encoders.PNGEncoderAdapter
-
- All Implemented Interfaces:
ImageEncoder
public class PNGEncoderAdapter extends java.lang.Object implements ImageEncoder
Adapter class for the Sun PNG Encoder.
-
-
Constructor Summary
Constructors Constructor Description PNGEncoderAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
encode(java.awt.image.BufferedImage bufferedImage)
Encodes an image in PNG format.void
encode(java.awt.image.BufferedImage bufferedImage, java.io.OutputStream outputStream)
Encodes an image in PNG format and writes it to an OutputStream.float
getQuality()
Get the quality of the image encoding (always 0.0).boolean
isEncodingAlpha()
Get whether the encoder should encode alpha transparency (always false).void
setEncodingAlpha(boolean encodingAlpha)
Set whether the encoder should encode alpha transparency (not supported in this ImageEncoder).void
setQuality(float quality)
Set the quality of the image encoding (not supported in this ImageEncoder).
-
-
-
Constructor Detail
-
PNGEncoderAdapter
public PNGEncoderAdapter()
-
-
Method Detail
-
getQuality
public float getQuality()
Get the quality of the image encoding (always 0.0).- Specified by:
getQuality
in interfaceImageEncoder
- Returns:
- A float representing the quality.
-
setQuality
public void setQuality(float quality)
Set the quality of the image encoding (not supported in this ImageEncoder).- Specified by:
setQuality
in interfaceImageEncoder
- Parameters:
quality
- A float representing the quality.
-
isEncodingAlpha
public boolean isEncodingAlpha()
Get whether the encoder should encode alpha transparency (always false).- 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 (not supported in this ImageEncoder).- Specified by:
setEncodingAlpha
in interfaceImageEncoder
- Parameters:
encodingAlpha
- Whether the encoder should encode alpha transparency.
-
encode
public byte[] encode(java.awt.image.BufferedImage bufferedImage) throws java.io.IOException
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:
java.io.IOException
-
encode
public void encode(java.awt.image.BufferedImage bufferedImage, java.io.OutputStream outputStream) throws java.io.IOException
Encodes an image in PNG format and writes it to an OutputStream.- Specified by:
encode
in interfaceImageEncoder
- Parameters:
bufferedImage
- The image to be encoded.outputStream
- The OutputStream to write the encoded image to.- Throws:
java.io.IOException
-
-