Package org.apache.fop.render.pdf
Class ImageRawPNGAdapter
- java.lang.Object
-
- org.apache.fop.render.pdf.AbstractImageAdapter
-
- org.apache.fop.render.pdf.ImageRawPNGAdapter
-
- All Implemented Interfaces:
PDFImage
public class ImageRawPNGAdapter extends AbstractImageAdapter
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.Log
log
logging instanceprivate java.lang.String
maskRef
private int
numberOfInterleavedComponents
private PDFFilter
pdfFilter
private static PDFName
RI_ABSOLUTE_COLORIMETRIC
private static PDFName
RI_PERCEPTUAL
private static PDFName
RI_RELATIVE_COLORIMETRIC
private static PDFName
RI_SATURATION
private PDFReference
softMask
-
Fields inherited from class org.apache.fop.render.pdf.AbstractImageAdapter
image
-
-
Constructor Summary
Constructors Constructor Description ImageRawPNGAdapter(org.apache.xmlgraphics.image.loader.impl.ImageRawPNG image, java.lang.String key)
Creates a new PDFImage from an Image instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBitsPerComponent()
Get the bits per color component for this image.PDFDeviceColorSpace
getColorSpace()
Get the color space for this image.java.lang.String
getFilterHint()
Returns a hint in form of a String (Possible values from PDFFilterList) indicating which filter setup should be used to encode the object.java.lang.String
getMask()
Get the PDF reference for a bitmap mask.PDFFilter
getPDFFilter()
Get the PDF Filter to be applied to the image.java.lang.String
getSoftMask()
PDFReference
getSoftMaskReference()
Get the PDF reference for a soft mask.PDFColor
getTransparentColor()
Get the transparent color.protected boolean
issRGB()
boolean
isTransparent()
Check if this image has a transparent color transparency.void
outputContents(java.io.OutputStream out)
Writes the raw, unencoded contents of the image to a given output stream.void
populateXObjectDictionary(PDFDictionary dict)
Populates the XObject's dictionary with additional values.void
setup(PDFDocument doc)
Setup the PDF image for the current document.-
Methods inherited from class org.apache.fop.render.pdf.AbstractImageAdapter
disallowMultipleFilters, getEffectiveICCProfile, getHeight, getICCStream, getImageColorSpace, getKey, getWidth, isInverted, isPS, multipleFiltersAllowed, populateXObjectDictionaryForIndexColorModel, toPDFColorSpace
-
-
-
-
Field Detail
-
log
private static org.apache.commons.logging.Log log
logging instance
-
RI_PERCEPTUAL
private static final PDFName RI_PERCEPTUAL
-
RI_RELATIVE_COLORIMETRIC
private static final PDFName RI_RELATIVE_COLORIMETRIC
-
RI_SATURATION
private static final PDFName RI_SATURATION
-
RI_ABSOLUTE_COLORIMETRIC
private static final PDFName RI_ABSOLUTE_COLORIMETRIC
-
pdfFilter
private PDFFilter pdfFilter
-
maskRef
private java.lang.String maskRef
-
softMask
private PDFReference softMask
-
numberOfInterleavedComponents
private int numberOfInterleavedComponents
-
-
Method Detail
-
setup
public void setup(PDFDocument doc)
Setup the PDF image for the current document. Some image formats may need to access the document (for example to add an ICC profile to the document).- Specified by:
setup
in interfacePDFImage
- Overrides:
setup
in classAbstractImageAdapter
- Parameters:
doc
- the PDF parent document (todo) Remove this and delegate to the XObject
-
getColorSpace
public PDFDeviceColorSpace getColorSpace()
Get the color space for this image. Possible results are: DeviceGray, DeviceRGB, or DeviceCMYK- Returns:
- the color space
-
getBitsPerComponent
public int getBitsPerComponent()
Get the bits per color component for this image.- Returns:
- the bits per component
-
isTransparent
public boolean isTransparent()
Check if this image has a transparent color transparency. Classes such asPDFImageXObject
rely on this simple binary model of transparency (e.g. compare toTransparency
) in order to render color key masking (see PDF Spec 1.7 Chapter 8.9.6.4). Therefore only return true if image has fully transparent colors.- Specified by:
isTransparent
in interfacePDFImage
- Overrides:
isTransparent
in classAbstractImageAdapter
- Returns:
- true if it has at least one fully transparent color
-
getTransparentColor
public PDFColor getTransparentColor()
Get the transparent color.- Specified by:
getTransparentColor
in interfacePDFImage
- Overrides:
getTransparentColor
in classAbstractImageAdapter
- Returns:
- the transparent color for this image
-
getMask
public java.lang.String getMask()
Get the PDF reference for a bitmap mask.- Specified by:
getMask
in interfacePDFImage
- Overrides:
getMask
in classAbstractImageAdapter
- Returns:
- the PDF reference for the mask image
-
getSoftMask
public java.lang.String getSoftMask()
- Overrides:
getSoftMask
in classAbstractImageAdapter
- Returns:
- null (if not overridden)
-
getSoftMaskReference
public PDFReference getSoftMaskReference()
Get the PDF reference for a soft mask.- Specified by:
getSoftMaskReference
in interfacePDFImage
- Overrides:
getSoftMaskReference
in classAbstractImageAdapter
- Returns:
- the PDF reference for a soft mask image (or null if there's no soft mask)
-
getPDFFilter
public PDFFilter getPDFFilter()
Get the PDF Filter to be applied to the image.- Returns:
- the PDF Filter or null
-
outputContents
public void outputContents(java.io.OutputStream out) throws java.io.IOException
Writes the raw, unencoded contents of the image to a given output stream.- Parameters:
out
- OutputStream to write to- Throws:
java.io.IOException
- if there creating stream
-
getFilterHint
public java.lang.String getFilterHint()
Returns a hint in form of a String (Possible values from PDFFilterList) indicating which filter setup should be used to encode the object.- Returns:
- the filter setup hint
-
populateXObjectDictionary
public void populateXObjectDictionary(PDFDictionary dict)
Description copied from class:AbstractImageAdapter
Populates the XObject's dictionary with additional values. The values are added to the dictionary after all the values obtained from other methods from this interface have been put into the dictionary. That allows to override certain values.- Specified by:
populateXObjectDictionary
in interfacePDFImage
- Overrides:
populateXObjectDictionary
in classAbstractImageAdapter
- Parameters:
dict
- the dictionary to fill
-
issRGB
protected boolean issRGB()
- Overrides:
issRGB
in classAbstractImageAdapter
-
-