Class ImageRawPNG
- java.lang.Object
-
- org.apache.xmlgraphics.image.loader.impl.AbstractImage
-
- org.apache.xmlgraphics.image.loader.impl.ImageRawStream
-
- org.apache.xmlgraphics.image.loader.impl.ImageRawPNG
-
- All Implemented Interfaces:
Image
public class ImageRawPNG extends ImageRawStream
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.xmlgraphics.image.loader.impl.ImageRawStream
ImageRawStream.ByteArrayStreamFactory, ImageRawStream.InputStreamFactory
-
-
Field Summary
Fields Modifier and Type Field Description private int
bitDepth
private int
blueTransparentAlpha
private java.awt.image.ColorModel
cm
private int
grayTransparentAlpha
private int
greenTransparentAlpha
private java.awt.color.ICC_Profile
iccProfile
private boolean
isTransparent
private int
redTransparentAlpha
private int
renderingIntent
-
Constructor Summary
Constructors Constructor Description ImageRawPNG(ImageInfo info, java.io.InputStream in, java.awt.image.ColorModel colorModel, int bitDepth, java.awt.color.ICC_Profile iccProfile)
Main constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBitDepth()
The bit depth of each color channel.java.awt.image.ColorModel
getColorModel()
Returns the image's color model.java.awt.color.ColorSpace
getColorSpace()
Returns the image's color space.java.awt.color.ICC_Profile
getICCProfile()
Returns the ICC color profile if one is associated with the PNG image.int
getRenderingIntent()
Returns the rendering intent of the sRGB color space.java.awt.Color
getTransparentColor()
The color of the transparent pixel.boolean
isTransparent()
Whether the image is transparent (meaning there is a transparent pixel)protected void
setGrayTransparentAlpha(int gray)
Sets the gray transparent pixel value.void
setRenderingIntent(int intent)
Used to set the rendering intent when the color space is sRGB.protected void
setRGBTransparentAlpha(int red, int green, int blue)
Sets the RGB transparent pixel values.protected void
setTransparent()
Used to flag image as transparent when the image is of pallete type.-
Methods inherited from class org.apache.xmlgraphics.image.loader.impl.ImageRawStream
createInputStream, getFlavor, getMimeType, isCacheable, setInputStreamFactory, writeTo
-
Methods inherited from class org.apache.xmlgraphics.image.loader.impl.AbstractImage
getInfo, getSize, toString
-
-
-
-
Field Detail
-
cm
private java.awt.image.ColorModel cm
-
iccProfile
private java.awt.color.ICC_Profile iccProfile
-
bitDepth
private int bitDepth
-
isTransparent
private boolean isTransparent
-
grayTransparentAlpha
private int grayTransparentAlpha
-
redTransparentAlpha
private int redTransparentAlpha
-
greenTransparentAlpha
private int greenTransparentAlpha
-
blueTransparentAlpha
private int blueTransparentAlpha
-
renderingIntent
private int renderingIntent
-
-
Constructor Detail
-
ImageRawPNG
public ImageRawPNG(ImageInfo info, java.io.InputStream in, java.awt.image.ColorModel colorModel, int bitDepth, java.awt.color.ICC_Profile iccProfile)
Main constructor.- Parameters:
info
- the image info objectin
- the ImageInputStream with the raw contentcolorModel
- the color modelbitDepth
- the bit depthiccProfile
- an ICC color profile or null if no profile is associated
-
-
Method Detail
-
getBitDepth
public int getBitDepth()
The bit depth of each color channel.- Returns:
- the bit depth of one channel (same for all)
-
getICCProfile
public java.awt.color.ICC_Profile getICCProfile()
Returns the ICC color profile if one is associated with the PNG image.- Specified by:
getICCProfile
in interfaceImage
- Overrides:
getICCProfile
in classAbstractImage
- Returns:
- the ICC color profile or null if there's no profile
-
getColorModel
public java.awt.image.ColorModel getColorModel()
Returns the image's color model.- Returns:
- the color model
-
getColorSpace
public java.awt.color.ColorSpace getColorSpace()
Returns the image's color space.- Specified by:
getColorSpace
in interfaceImage
- Overrides:
getColorSpace
in classAbstractImage
- Returns:
- the color space
-
setGrayTransparentAlpha
protected void setGrayTransparentAlpha(int gray)
Sets the gray transparent pixel value.- Parameters:
gray
- the transparent pixel gray value (0...255)
-
setRGBTransparentAlpha
protected void setRGBTransparentAlpha(int red, int green, int blue)
Sets the RGB transparent pixel values.- Parameters:
red
- the transparent pixel red value (0...255)green
- the transparent pixel green value (0...255)blue
- the transparent pixel blue value (0...255)
-
setTransparent
protected void setTransparent()
Used to flag image as transparent when the image is of pallete type.
-
isTransparent
public boolean isTransparent()
Whether the image is transparent (meaning there is a transparent pixel)- Returns:
- true if transparent pixel exists
-
getTransparentColor
public java.awt.Color getTransparentColor()
The color of the transparent pixel.- Returns:
- the color of the transparent pixel.
-
setRenderingIntent
public void setRenderingIntent(int intent)
Used to set the rendering intent when the color space is sRGB.- Parameters:
intent
- the rendering intent of the sRGB color space
-
getRenderingIntent
public int getRenderingIntent()
Returns the rendering intent of the sRGB color space.- Returns:
- the rendering intent
-
-