Package org.apache.fop.pdf
Class BitmapImage
java.lang.Object
org.apache.fop.pdf.BitmapImage
- All Implemented Interfaces:
PDFImage
Bitmap image.
This is used to create a bitmap image that will be inserted
into pdf.
-
Constructor Summary
ConstructorsConstructorDescriptionBitmapImage(String k, int width, int height, byte[] data, PDFReference mask) Create a bitmap image. -
Method Summary
Modifier and TypeMethodDescriptionvoidDisallows multiple filters.intGet the bits per color component for this image.Get the color space for the image data.Returns a hint in form of a String (Possible values from PDFFilterList) indicating which filter setup should be used to encode the object.intGet the height of this image.Get the ICC stream.getKey()Get the key for this image.getMask()Get the bitmap mask reference for this image.Get the PDF Filter to be applied to the image.Get the PDF reference for a soft mask.Get the transparent color for this image.intgetWidth()Get the width of this image.booleanbooleanisPS()Check if this is a postscript image.booleanCheck if this image has a transparent color.booleanIndicates 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.voidWrites the raw, unencoded contents of the image to a given output stream.voidPopulates the XObject's dictionary with additional values.voidSet the color space for this image.voidsetPDFFilter(PDFFilter pdfFilter) voidSet the transparent color for this iamge.voidsetup(PDFDocument doc) Setup this image with the pdf document.
-
Constructor Details
-
BitmapImage
Create a bitmap image. Creates a new bitmap image with the given data.- Parameters:
k- the key to be used to lookup the imagewidth- the width of the imageheight- the height of the imagedata- the bitmap datamask- the transparency mask reference if any
-
-
Method Details
-
setup
Setup this image with the pdf document. -
getKey
Get the key for this image. This key is used by the pdf document so that it will only insert an image once. All other references to the same image will use the same XObject reference. -
getWidth
public int getWidth()Get the width of this image. -
getHeight
public int getHeight()Get the height of this image. -
setColorSpace
Set the color space for this image.- Parameters:
cs- the pdf color space
-
getColorSpace
Get the color space for the image data. Possible options are: DeviceGray, DeviceRGB, or DeviceCMYK- Specified by:
getColorSpacein interfacePDFImage- Returns:
- the pdf doclor space
-
getBitsPerComponent
public int getBitsPerComponent()Get the bits per color component for this image.- Specified by:
getBitsPerComponentin interfacePDFImage- Returns:
- the bits per component
-
setTransparent
Set the transparent color for this iamge.- Parameters:
t- the transparent color
-
isTransparent
public boolean isTransparent()Check if this image has a transparent color.- Specified by:
isTransparentin interfacePDFImage- Returns:
- true if it has a transparent color
-
getTransparentColor
Get the transparent color for this image.- Specified by:
getTransparentColorin interfacePDFImage- Returns:
- the transparent color if any
-
getMask
Get the bitmap mask reference for this image. Current not supported. -
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
-
outputContents
Writes the raw, unencoded contents of the image to a given output stream.- Specified by:
outputContentsin interfacePDFImage- Parameters:
out- OutputStream to write to- Throws:
IOException- if there creating stream
-
populateXObjectDictionary
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
-
getICCStream
Get the ICC stream.- Specified by:
getICCStreamin interfacePDFImage- Returns:
- always returns null since this has no icc color space
-
isPS
public boolean isPS()Check if this is a postscript image. -
getFilterHint
Returns a hint in form of a String (Possible values from PDFFilterList) indicating which filter setup should be used to encode the object.- Specified by:
getFilterHintin interfacePDFImage- Returns:
- the filter setup hint
-
getPDFFilter
Get the PDF Filter to be applied to the image.- Specified by:
getPDFFilterin interfacePDFImage- Returns:
- the PDF Filter or null
-
setPDFFilter
-
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.
-