public static final class PngConfig.Builder
extends java.lang.Object
PngConfig instances.
Each "setter" method returns an reference to the instance to enable
chaining multiple calls.
Call build() to construct a new PngConfig instance
using the current Builder settings. Example:
PngConfig config = new PngConfig.Builder()
.readLimit(PngConfig.READ_EXCEPT_METADATA)
.warningsFatal(true)
.build();| Constructor and Description |
|---|
PngConfig.Builder()
Create a new builder using default values.
|
PngConfig.Builder(PngConfig cfg)
Create a builder using values from the given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
PngConfig |
build()
Create a configuration using the current values of this builder.
|
PngConfig.Builder |
convertIndexed(boolean convertIndexed)
Whether to convert images with an indexed color model
(paletted and 1/2/4/8-bit grayscale) to use a component color model.
|
PngConfig.Builder |
defaultGamma(float defaultGamma)
Sets the default gamma value.
|
PngConfig.Builder |
displayExponent(float displayExponent)
Sets the default display exponent.
|
PngConfig.Builder |
gammaCorrect(boolean gammaCorrect)
Enables or disables gamma correction.
|
PngConfig.Builder |
progressive(boolean progressive)
Enables or disables progressive display for interlaced images.
|
PngConfig.Builder |
readLimit(int readLimit)
Configures how much of the image to read.
|
PngConfig.Builder |
reduce16(boolean reduce16)
Enables or disables 16-bit reduction.
|
PngConfig.Builder |
sourceRegion(java.awt.Rectangle sourceRegion)
Decode only a particular region of the source image.
|
PngConfig.Builder |
sourceSubsampling(int xsub,
int ysub,
int xoff,
int yoff)
Reduce the size of the decoded image (or source region) by only using
periodic rows and/or columns of the image.
|
PngConfig.Builder |
warningsFatal(boolean warningsFatal)
Configures whether warnings should be treated as fatal errors.
|
public PngConfig.Builder()
public PngConfig.Builder(PngConfig cfg)
cfg - the configuration to copypublic PngConfig build()
public PngConfig.Builder reduce16(boolean reduce16)
reduce16 - enable 16-bit reductionpublic PngConfig.Builder defaultGamma(float defaultGamma)
defaultGamma - the default gamma valuepublic PngConfig.Builder displayExponent(float displayExponent)
displayExponent - the display exponentpublic PngConfig.Builder gammaCorrect(boolean gammaCorrect)
gammaCorrect - use gamma correctionPngImage.getGamma(),
PngImage.getGammaTable()public PngConfig.Builder progressive(boolean progressive)
progressive - use progressive displayPngImage.handlePass(java.awt.image.BufferedImage, int)public PngConfig.Builder readLimit(int readLimit)
readLimit - READ_ALL,READ_HEADER,READ_UNTIL_DATA,READ_EXCEPT_DATA,READ_EXCEPT_METADATApublic PngConfig.Builder warningsFatal(boolean warningsFatal)
PngException exceptions are caught and passed to the PngImage.handleWarning(com.sixlegs.png.PngException)
method. If warnings are configured as fatal, that method will re-throw the
exception, which will abort image processing. Default is false.warningsFatal - true if warnings should be treated as fatal errorsPngImage.handleWarning(com.sixlegs.png.PngException)public PngConfig.Builder sourceRegion(java.awt.Rectangle sourceRegion)
public PngConfig.Builder sourceSubsampling(int xsub, int ysub, int xoff, int yoff)
public PngConfig.Builder convertIndexed(boolean convertIndexed)