Class ImageRawPNGAdapter

    • Constructor Detail

      • ImageRawPNGAdapter

        public ImageRawPNGAdapter​(org.apache.xmlgraphics.image.loader.impl.ImageRawPNG image,
                                  java.lang.String key)
        Creates a new PDFImage from an Image instance.
        Parameters:
        image - the image
        key - XObject key
    • 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 interface PDFImage
        Overrides:
        setup in class AbstractImageAdapter
        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 as PDFImageXObject rely on this simple binary model of transparency (e.g. compare to Transparency) 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 interface PDFImage
        Overrides:
        isTransparent in class AbstractImageAdapter
        Returns:
        true if it has at least one fully transparent color
      • getMask

        public java.lang.String getMask()
        Get the PDF reference for a bitmap mask.
        Specified by:
        getMask in interface PDFImage
        Overrides:
        getMask in class AbstractImageAdapter
        Returns:
        the PDF reference for the mask image
      • 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 interface PDFImage
        Overrides:
        populateXObjectDictionary in class AbstractImageAdapter
        Parameters:
        dict - the dictionary to fill