Package com.itextpdf.io.image
Class PngImageData
java.lang.Object
com.itextpdf.io.image.ImageData
com.itextpdf.io.image.RawImageData
com.itextpdf.io.image.PngImageData
Image data and PNG-specific color information.
-
Field Summary
Fields inherited from class com.itextpdf.io.image.RawImageData
CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, typeCcittFields inherited from class com.itextpdf.io.image.ImageData
bpc, colorEncodingComponentsNumber, colorTransform, data, decode, decodeParms, deflated, dpiX, dpiY, filter, height, imageAttributes, imageMask, imageSize, interpolation, inverted, mask, mySerialId, originalType, profile, rotation, transparency, url, width, XYRatio -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPngImageData(byte[] bytes) Creates PNG image data from encoded bytes.protectedPngImageData(URL url) Creates PNG image data to be loaded from a URL. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Gets the indexed-color palette.intGets the PNG color type.floatgetGamma()Gets the PNG gamma value.Gets PNG chromaticity data.booleanChecks whether the PNG color type has no color components.booleanChecks whether PNG chromaticity data is available.booleanChecks whether the PNG uses indexed color.voidsetColorPalette(byte[] colorPalette) Sets the indexed-color palette.voidsetColorType(int colorType) Sets the PNG color type.voidsetGamma(float gamma) Sets the PNG gamma value.voidsetPngChromaticities(PngChromaticities pngChromaticities) Sets PNG chromaticity data.Methods inherited from class com.itextpdf.io.image.RawImageData
getTypeCcitt, isRawImage, setTypeCcittMethods inherited from class com.itextpdf.io.image.ImageData
canBeMask, canImageBeInline, getBpc, getColorEncodingComponentsNumber, getColorTransform, getData, getDecode, getDecodeParms, getDpiX, getDpiY, getFilter, getHeight, getImageAttributes, getImageMask, getOriginalType, getProfile, getRotation, getTransparency, getUrl, getWidth, getXYRatio, isDeflated, isInterpolation, isInverted, isMask, isSoftMask, loadData, makeMask, setBpc, setColorEncodingComponentsNumber, setColorTransform, setDecode, setDeflated, setDpi, setFilter, setHeight, setImageAttributes, setImageMask, setInterpolation, setInverted, setProfile, setRotation, setTransparency, setUrl, setWidth, setXYRatio
-
Constructor Details
-
PngImageData
protected PngImageData(byte[] bytes) Creates PNG image data from encoded bytes.- Parameters:
-
bytes- encoded PNG bytes; the array is retained
-
PngImageData
Creates PNG image data to be loaded from a URL.- Parameters:
-
url- source URL, notnull
-
-
Method Details
-
getColorPalette
public byte[] getColorPalette()Gets the indexed-color palette.- Returns:
-
retained PNG palette bytes, or
null
-
setColorPalette
public void setColorPalette(byte[] colorPalette) Sets the indexed-color palette.- Parameters:
-
colorPalette- PNG palette bytes to retain, ornull
-
getGamma
public float getGamma()Gets the PNG gamma value.- Returns:
- gamma value
-
setGamma
public void setGamma(float gamma) Sets the PNG gamma value.- Parameters:
-
gamma- gamma value
-
isHasCHRM
public boolean isHasCHRM()Checks whether PNG chromaticity data is available.- Returns:
-
truewhen chromaticity data is present
-
getPngChromaticities
Gets PNG chromaticity data.- Returns:
-
chromaticity data, or
null
-
setPngChromaticities
Sets PNG chromaticity data.- Parameters:
-
pngChromaticities- chromaticity data, ornull
-
getColorType
public int getColorType()Gets the PNG color type.- Returns:
- PNG color-type value
-
setColorType
public void setColorType(int colorType) Sets the PNG color type.- Parameters:
-
colorType- PNG color-type value
-
isIndexed
public boolean isIndexed()Checks whether the PNG uses indexed color.- Returns:
-
truefor color type3
-
isGrayscaleImage
public boolean isGrayscaleImage()Checks whether the PNG color type has no color components.- Returns:
-
truefor grayscale color types
-