Class PdfPattern.Tiling
- java.lang.Object
-
- com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
-
- com.itextpdf.kernel.pdf.colorspace.PdfPattern
-
- com.itextpdf.kernel.pdf.colorspace.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPdfPattern.Tiling.PaintTypeA code that determines how the colour of the pattern cell shall be specifiedstatic classPdfPattern.Tiling.TilingTypeA code that controls adjustments to the spacing of tiles relative to the device pixel grid-
Nested classes/interfaces inherited from class com.itextpdf.kernel.pdf.colorspace.PdfPattern
PdfPattern.Shading, PdfPattern.Tiling
-
-
Field Summary
Fields Modifier and Type Field Description private PdfResourcesresources
-
Constructor Summary
Constructors Constructor Description Tiling(float width, float height)Creates a new Tiling Pattern instance.Tiling(float width, float height, boolean colored)Creates a new Tiling Pattern instance.Tiling(float width, float height, float xStep, float yStep)Creates a new Tiling Pattern instance.Tiling(float width, float height, float xStep, float yStep, boolean colored)Creates a new Tiling Pattern instance.Tiling(Rectangle bbox)Creates a new Tiling instance.Tiling(Rectangle bbox, boolean colored)Creates a new Tiling instance.Tiling(Rectangle bbox, float xStep, float yStep)Creates a new Tiling instance.Tiling(Rectangle bbox, float xStep, float yStep, boolean colored)Creates a new Tiling instance.Tiling(PdfStream pdfObject)Creates new instance from thePdfStreamobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()To manually flush aPdfObjectbehind this wrapper, you have to ensure that this object is added to the document, i.e.RectanglegetBBox()Gets the pattern cell's bounding box.PdfResourcesgetResources()Gets the Tiling Pattern's resources.intgetTilingType()Gets the tiling type.floatgetXStep()Gets the desired horizontal space between pattern cells.floatgetYStep()Gets the desired vertical space between pattern cells.booleanisColored()Checks if this pattern have colored paint type.voidsetBBox(Rectangle bbox)Sets the pattern cell's bounding box.voidsetColored(boolean colored)Sets the paint type.voidsetTilingType(int tilingType)Sets the tiling type.voidsetXStep(float xStep)Sets the desired horizontal space between pattern cells.voidsetYStep(float yStep)Sets the desired vertical space between pattern cells.-
Methods inherited from class com.itextpdf.kernel.pdf.colorspace.PdfPattern
getMatrix, getPatternInstance, isWrappedObjectMustBeIndirect, setMatrix
-
Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
-
-
-
Field Detail
-
resources
private PdfResources resources
-
-
Constructor Detail
-
Tiling
public Tiling(PdfStream pdfObject)
Creates new instance from thePdfStreamobject. This stream should have PatternType equals to 1.- Parameters:
pdfObject- thePdfStreamthat 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 boxheight- 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 boxheight- the height of the pattern cell's bounding boxcolored- 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 boxcolored- 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 boxheight- the height of the pattern cell's bounding boxxStep- the desired horizontal space between pattern cellsyStep- 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 boxheight- the height of the pattern cell's bounding boxxStep- the desired horizontal space between pattern cellsyStep- the desired vertical space between pattern cellscolored- 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 boxxStep- the desired horizontal space between pattern cellsyStep- 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 boxxStep- the desired horizontal space between pattern cellsyStep- the desired vertical space between pattern cellscolored- 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:
trueif this pattern's paint type isPdfPattern.Tiling.PaintType.COLOREDandfalseotherwise.
-
setColored
public void setColored(boolean colored)
Sets the paint type.- Parameters:
colored- iftruethen the paint type will be set asPdfPattern.Tiling.PaintType.COLORED, andPdfPattern.Tiling.PaintType.UNCOLOREDotherwise.
-
getTilingType
public int getTilingType()
Gets the tiling type.- Returns:
- int value of
PdfPattern.Tiling.TilingType
-
setTilingType
public void setTilingType(int tilingType)
Sets the tiling type.- Parameters:
tilingType- int value ofPdfPattern.Tiling.TilingTypeto 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 aPdfObjectbehind 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 callPdfObjectWrapper.makeIndirect(PdfDocument). For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation.- Overrides:
flushin classPdfPattern
-
-