Class PDPattern

  • All Implemented Interfaces:
    COSObjectable

    public final class PDPattern
    extends PDSpecialColorSpace
    A Pattern color space is either a Tiling pattern or a Shading pattern.
    • Field Detail

      • EMPTY_PATTERN

        private static PDColor EMPTY_PATTERN
        A pattern which leaves no marks on the page.
      • underlyingColorSpace

        private PDColorSpace underlyingColorSpace
    • Constructor Detail

      • PDPattern

        public PDPattern​(PDResources resources)
        Creates a new pattern color space.
        Parameters:
        resources - The current resources.
      • PDPattern

        public PDPattern​(PDResources resources,
                         PDColorSpace colorSpace)
        Creates a new uncolored tiling pattern color space.
        Parameters:
        resources - The current resources.
        colorSpace - The underlying color space.
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from class: PDColorSpace
        Returns the name of the color space.
        Specified by:
        getName in class PDColorSpace
        Returns:
        the name of the color space
      • getNumberOfComponents

        public int getNumberOfComponents()
        Description copied from class: PDColorSpace
        Returns the number of components in this color space
        Specified by:
        getNumberOfComponents in class PDColorSpace
        Returns:
        the number of components in this color space
      • getDefaultDecode

        public float[] getDefaultDecode​(int bitsPerComponent)
        Description copied from class: PDColorSpace
        Returns the default decode array for this color space.
        Specified by:
        getDefaultDecode in class PDColorSpace
        Parameters:
        bitsPerComponent - the number of bits per component.
        Returns:
        the default decode array
      • getInitialColor

        public PDColor getInitialColor()
        Description copied from class: PDColorSpace
        Returns the initial color value for this color space.
        Specified by:
        getInitialColor in class PDColorSpace
        Returns:
        the initial color value for this color space
      • toRGB

        public float[] toRGB​(float[] value)
        Description copied from class: PDColorSpace
        Returns the RGB equivalent of the given color value.
        Specified by:
        toRGB in class PDColorSpace
        Parameters:
        value - a color value with component values between 0 and 1
        Returns:
        an array of R,G,B value between 0 and 255
      • toRGBImage

        public java.awt.image.BufferedImage toRGBImage​(java.awt.image.WritableRaster raster)
                                                throws java.io.IOException
        Description copied from class: PDColorSpace
        Returns the (A)RGB equivalent of the given raster.
        Specified by:
        toRGBImage in class PDColorSpace
        Parameters:
        raster - the source raster
        Returns:
        an (A)RGB buffered image
        Throws:
        java.io.IOException - if the color conversion fails
      • getPattern

        public PDAbstractPattern getPattern​(PDColor color)
                                     throws java.io.IOException
        Returns the pattern for the given color.
        Parameters:
        color - color containing a pattern name
        Returns:
        pattern for the given color
        Throws:
        java.io.IOException - if the pattern name was not found.
      • getUnderlyingColorSpace

        public PDColorSpace getUnderlyingColorSpace()
        Returns the underlying color space, if this is an uncolored tiling pattern, otherwise null.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object