Interface PDImage

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      InputStream createInputStream()
      Returns an InputStream containing the image data, irrespective of whether this is an inline image or an image XObject.
      InputStream createInputStream​(List<String> stopFilters)
      Returns an InputStream containing the image data, irrespective of whether this is an inline image or an image XObject.
      int getBitsPerComponent()
      Returns bits per component of this image, or -1 if one has not been set.
      PDColorSpace getColorSpace()
      Returns the image's color space.
      COSArray getDecode()
      Returns the decode array.
      int getHeight()
      Returns height of this image, or -1 if one has not been set.
      android.graphics.Bitmap getImage()
      Returns the content of this image as a Bitmap with ARGB_888.
      boolean getInterpolate()
      Returns true if the image should be interpolated when rendered.
      android.graphics.Bitmap getStencilImage​(android.graphics.Paint paint)
      Returns an ARGB image filled with the given paint and using this image as a mask.
      PDStream getStream()
      Returns a stream containing this image's data.
      String getSuffix()
      Returns the suffix for this image type, e.g.
      int getWidth()
      Returns the width of this image, or -1 if one has not been set.
      boolean isEmpty()
      Returns true if the image has no data.
      boolean isStencil()
      Returns true if the image is a stencil mask.
      void setBitsPerComponent​(int bitsPerComponent)
      Set the number of bits per component.
      void setColorSpace​(PDColorSpace colorSpace)
      Sets the color space for this image.
      void setDecode​(COSArray decode)
      Sets the decode array.
      void setHeight​(int height)
      Sets the height of the image.
      void setInterpolate​(boolean value)
      Sets the Interpolate flag, true for high-quality image scaling.
      void setStencil​(boolean isStencil)
      Sets whether or not the image is a stencil.
      void setWidth​(int width)
      Sets the width of the image.
    • Method Detail

      • getImage

        android.graphics.Bitmap getImage()
                                  throws IOException
        Returns the content of this image as a Bitmap with ARGB_888. The size of the returned image is the larger of the size of the image itself or its mask.
        Returns:
        content of this image as a buffered image.
        Throws:
        IOException
      • getStencilImage

        android.graphics.Bitmap getStencilImage​(android.graphics.Paint paint)
                                         throws IOException
        Returns an ARGB image filled with the given paint and using this image as a mask.
        Parameters:
        paint - the paint to fill the visible portions of the image with
        Returns:
        a masked image filled with the given paint
        Throws:
        IOException - if the image cannot be read
        IllegalStateException - if the image is not a stencil.
      • getStream

        PDStream getStream()
                    throws IOException
        Returns a stream containing this image's data. Null for inline images.
        Throws:
        IOException - if the stream could not be read.
      • createInputStream

        InputStream createInputStream()
                               throws IOException
        Returns an InputStream containing the image data, irrespective of whether this is an inline image or an image XObject.
        Returns:
        Decoded stream\
        Throws:
        IOException - if the data could not be read.
      • createInputStream

        InputStream createInputStream​(List<String> stopFilters)
                               throws IOException
        Returns an InputStream containing the image data, irrespective of whether this is an inline image or an image XObject. The given filters will not be decoded.
        Returns:
        Decoded stream
        Throws:
        IOException - if the data could not be read.
      • isEmpty

        boolean isEmpty()
        Returns true if the image has no data.
      • isStencil

        boolean isStencil()
        Returns true if the image is a stencil mask.
      • setStencil

        void setStencil​(boolean isStencil)
        Sets whether or not the image is a stencil. This corresponds to the ImageMask entry in the image stream's dictionary.
        Parameters:
        isStencil - True to make the image a stencil.
      • getBitsPerComponent

        int getBitsPerComponent()
        Returns bits per component of this image, or -1 if one has not been set.
      • setBitsPerComponent

        void setBitsPerComponent​(int bitsPerComponent)
        Set the number of bits per component.
        Parameters:
        bitsPerComponent - The number of bits per component.
      • setColorSpace

        void setColorSpace​(PDColorSpace colorSpace)
        Sets the color space for this image.
        Parameters:
        colorSpace - The color space for this image.
      • getHeight

        int getHeight()
        Returns height of this image, or -1 if one has not been set.
      • setHeight

        void setHeight​(int height)
        Sets the height of the image.
        Parameters:
        height - The height of the image.
      • getWidth

        int getWidth()
        Returns the width of this image, or -1 if one has not been set.
      • setWidth

        void setWidth​(int width)
        Sets the width of the image.
        Parameters:
        width - The width of the image.
      • setDecode

        void setDecode​(COSArray decode)
        Sets the decode array.
        Parameters:
        decode - the new decode array.
      • getDecode

        COSArray getDecode()
        Returns the decode array.
      • getInterpolate

        boolean getInterpolate()
        Returns true if the image should be interpolated when rendered.
      • setInterpolate

        void setInterpolate​(boolean value)
        Sets the Interpolate flag, true for high-quality image scaling.
      • getSuffix

        String getSuffix()
        Returns the suffix for this image type, e.g. "jpg"