Package org.apache.fop.render.pdf
Class AbstractImageAdapter
- java.lang.Object
-
- org.apache.fop.render.pdf.AbstractImageAdapter
-
- All Implemented Interfaces:
PDFImage
- Direct Known Subclasses:
ImageRawCCITTFaxAdapter,ImageRawJPEGAdapter,ImageRawPNGAdapter,ImageRenderedAdapter
public abstract class AbstractImageAdapter extends java.lang.Object implements PDFImage
Abstract PDFImage implementation for the PDF renderer.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.xmlgraphics.image.loader.Imageimagethe image
-
Constructor Summary
Constructors Constructor Description AbstractImageAdapter(org.apache.xmlgraphics.image.loader.Image image, java.lang.String key)Creates a new PDFImage from an Image instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisallowMultipleFilters()Disallows multiple filters.protected java.awt.color.ICC_ProfilegetEffectiveICCProfile()Returns the effective ICC profile for the image.intgetHeight()Get the image height in pixels.PDFICCStreamgetICCStream()Get the ICC stream for this image.protected java.awt.color.ColorSpacegetImageColorSpace()Returns the image's color space.java.lang.StringgetKey()Key to look up XObject.java.lang.StringgetMask()Get the PDF reference for a bitmap mask.java.lang.StringgetSoftMask()PDFReferencegetSoftMaskReference()Get the PDF reference for a soft mask.PDFColorgetTransparentColor()Get the transparent color.intgetWidth()Get the image width in pixels.booleanisInverted()booleanisPS()Check if this image is a PostScript image.protected booleanissRGB()booleanisTransparent()Check if this image has a transparent color transparency.booleanmultipleFiltersAllowed()Indicates whether multiple image filters are allowed; this is implemented because Adobe Reader does not like multiple FlateDecode filters applied to an image even though that allowed by the PDF spec; this is probable due to security concerns since many PDF malware exploits, like zip bombs, make use of a chain of FlateDecode filters.voidpopulateXObjectDictionary(PDFDictionary dict)Populates the XObject's dictionary with additional values.protected voidpopulateXObjectDictionaryForIndexColorModel(PDFDictionary dict, java.awt.image.IndexColorModel icm)This is to be used by populateXObjectDictionary() when the image is palette based.voidsetup(PDFDocument doc)Setup the PDF image for the current document.static PDFDeviceColorSpacetoPDFColorSpace(java.awt.color.ColorSpace cs)Converts a ColorSpace object to a PDFColorSpace object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.fop.pdf.PDFImage
getBitsPerComponent, getColorSpace, getFilterHint, getPDFFilter, outputContents
-
-
-
-
Method Detail
-
getKey
public java.lang.String getKey()
Key to look up XObject. This should be a unique key to refer to the image.
-
getImageColorSpace
protected java.awt.color.ColorSpace getImageColorSpace()
Returns the image's color space.- Returns:
- the color space
-
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).
-
getEffectiveICCProfile
protected java.awt.color.ICC_Profile getEffectiveICCProfile()
Returns the effective ICC profile for the image.- Returns:
- an ICC profile or null
-
issRGB
protected boolean issRGB()
-
getWidth
public int getWidth()
Get the image width in pixels.
-
getHeight
public int getHeight()
Get the image height in pixels.
-
isTransparent
public boolean isTransparent()
Check if this image has a transparent color transparency. Classes such asPDFImageXObjectrely 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:
isTransparentin interfacePDFImage- Returns:
- true if it has at least one fully transparent color
-
getTransparentColor
public PDFColor getTransparentColor()
Get the transparent color.- Specified by:
getTransparentColorin interfacePDFImage- Returns:
- the transparent color for this image
-
getMask
public java.lang.String getMask()
Get the PDF reference for a bitmap mask.
-
getSoftMask
public java.lang.String getSoftMask()
- Returns:
- null (if not overridden)
-
getSoftMaskReference
public PDFReference getSoftMaskReference()
Get the PDF reference for a soft mask.- Specified by:
getSoftMaskReferencein interfacePDFImage- Returns:
- the PDF reference for a soft mask image (or null if there's no soft mask)
-
isInverted
public boolean isInverted()
- Specified by:
isInvertedin interfacePDFImage- Returns:
- true for CMYK images generated by Adobe Photoshop
-
isPS
public boolean isPS()
Check if this image is a PostScript image.
-
getICCStream
public PDFICCStream getICCStream()
Get the ICC stream for this image.- Specified by:
getICCStreamin interfacePDFImage- Returns:
- the ICC stream for this image if any
-
populateXObjectDictionary
public void populateXObjectDictionary(PDFDictionary dict)
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:
populateXObjectDictionaryin interfacePDFImage- Parameters:
dict- the dictionary to fill
-
populateXObjectDictionaryForIndexColorModel
protected void populateXObjectDictionaryForIndexColorModel(PDFDictionary dict, java.awt.image.IndexColorModel icm)
This is to be used by populateXObjectDictionary() when the image is palette based.- Parameters:
dict- the dictionary to fill inicm- the image color model
-
toPDFColorSpace
public static PDFDeviceColorSpace toPDFColorSpace(java.awt.color.ColorSpace cs)
Converts a ColorSpace object to a PDFColorSpace object.- Parameters:
cs- ColorSpace instance- Returns:
- PDFColorSpace new converted object
-
multipleFiltersAllowed
public boolean multipleFiltersAllowed()
Indicates whether multiple image filters are allowed; this is implemented because Adobe Reader does not like multiple FlateDecode filters applied to an image even though that allowed by the PDF spec; this is probable due to security concerns since many PDF malware exploits, like zip bombs, make use of a chain of FlateDecode filters.- Specified by:
multipleFiltersAllowedin interfacePDFImage
-
disallowMultipleFilters
public void disallowMultipleFilters()
Disallows multiple filters.
-
-