Class PdfPattern.Tiling

  • Enclosing class:
    PdfPattern

    public static class PdfPattern.Tiling
    extends PdfPattern
    Wrapper that represents tiling pattern of color space. This pattern consists of a small graphical figure (cells). Painting with the pattern replicates the cell at fixed horizontal and vertical intervals to fill an area. The pattern cell can include graphical elements such as filled areas, text, and sampled images. Its shape need not be rectangular, and the spacing of tiles can differ from the dimensions of the cell itself. The appearance of the pattern cell shall be defined by a content stream containing the painting operators needed to paint one instance of the cell
    • Constructor Detail

      • Tiling

        public Tiling​(PdfStream pdfObject)
        Creates new instance from the PdfStream object. This stream should have PatternType equals to 1.
        Parameters:
        pdfObject - the PdfStream that represents Tiling Pattern.
      • Tiling

        public Tiling​(float width,
                      float height)
        Creates a new Tiling Pattern instance.

        By default the pattern will be colored.

        Parameters:
        width - the width of the pattern cell's bounding box
        height - the height of the pattern cell's bounding box
      • Tiling

        public Tiling​(float width,
                      float height,
                      boolean colored)
        Creates a new Tiling Pattern instance.
        Parameters:
        width - the width of the pattern cell's bounding box
        height - the height of the pattern cell's bounding box
        colored - defines whether the Tiling Pattern will be colored or not
      • Tiling

        public Tiling​(Rectangle bbox)
        Creates a new Tiling instance.

        By default the pattern will be colored.

        Parameters:
        bbox - the pattern cell's bounding box
      • Tiling

        public Tiling​(Rectangle bbox,
                      boolean colored)
        Creates a new Tiling instance.
        Parameters:
        bbox - the pattern cell's bounding box
        colored - defines whether the Tiling Pattern will be colored or not
      • Tiling

        public Tiling​(float width,
                      float height,
                      float xStep,
                      float yStep)
        Creates a new Tiling Pattern instance.

        By default the pattern will be colored.

        Parameters:
        width - the width of the pattern cell's bounding box
        height - the height of the pattern cell's bounding box
        xStep - the desired horizontal space between pattern cells
        yStep - the desired vertical space between pattern cells
      • Tiling

        public Tiling​(float width,
                      float height,
                      float xStep,
                      float yStep,
                      boolean colored)
        Creates a new Tiling Pattern instance.
        Parameters:
        width - the width of the pattern cell's bounding box
        height - the height of the pattern cell's bounding box
        xStep - the desired horizontal space between pattern cells
        yStep - the desired vertical space between pattern cells
        colored - defines whether the Tiling Pattern will be colored or not
      • Tiling

        public Tiling​(Rectangle bbox,
                      float xStep,
                      float yStep)
        Creates a new Tiling instance.

        By default the pattern will be colored.

        Parameters:
        bbox - the pattern cell's bounding box
        xStep - the desired horizontal space between pattern cells
        yStep - the desired vertical space between pattern cells
      • Tiling

        public Tiling​(Rectangle bbox,
                      float xStep,
                      float yStep,
                      boolean colored)
        Creates a new Tiling instance.
        Parameters:
        bbox - the pattern cell's bounding box
        xStep - the desired horizontal space between pattern cells
        yStep - the desired vertical space between pattern cells
        colored - defines whether the Tiling Pattern will be colored or not
    • Method Detail

      • isColored

        public boolean isColored()
        Checks if this pattern have colored paint type.
        Returns:
        true if this pattern's paint type is PdfPattern.Tiling.PaintType.COLORED and false otherwise.
      • setTilingType

        public void setTilingType​(int tilingType)
        Sets the tiling type.
        Parameters:
        tilingType - int value of PdfPattern.Tiling.TilingType to set.
        Throws:
        java.lang.IllegalArgumentException - in case of wrong value.
      • getBBox

        public Rectangle getBBox()
        Gets the pattern cell's bounding box. These boundaries shall be used to clip the pattern cell.
        Returns:
        pattern cell's bounding box.
      • setBBox

        public void setBBox​(Rectangle bbox)
        Sets the pattern cell's bounding box. These boundaries shall be used to clip the pattern cell.
        Parameters:
        bbox - pattern cell's bounding box to set.
      • getXStep

        public float getXStep()
        Gets the desired horizontal space between pattern cells.
        Returns:
        the desired horizontal space between pattern cells
      • setXStep

        public void setXStep​(float xStep)
        Sets the desired horizontal space between pattern cells.
        Parameters:
        xStep - the desired horizontal space between pattern cells
      • getYStep

        public float getYStep()
        Gets the desired vertical space between pattern cells.
        Returns:
        the desired vertical space between pattern cells
      • setYStep

        public void setYStep​(float yStep)
        Sets the desired vertical space between pattern cells.
        Parameters:
        yStep - the desired vertical space between pattern cells
      • getResources

        public PdfResources getResources()
        Gets the Tiling Pattern's resources.
        Returns:
        the Tiling Pattern's resources
      • flush

        public void flush()
        To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. Basically this means that before flushing you need to explicitly call PdfObjectWrapper.makeIndirect(PdfDocument). For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation.
        Overrides:
        flush in class PdfPattern