Class PdfPattern
- java.lang.Object
-
- com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
-
- com.itextpdf.kernel.pdf.colorspace.PdfPattern
-
- Direct Known Subclasses:
PdfPattern.Shading,PdfPattern.Tiling
public abstract class PdfPattern extends PdfObjectWrapper<PdfDictionary>
Dictionary wrapper that represent special type of color space, that uses pattern objects as the equivalent of colour values instead of the numeric component values used with other spaces. A pattern object shall be a dictionary or a stream, depending on the type of pattern. For mor information see paragraph 8.7 in ISO-32000-1.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPdfPattern.ShadingShading pattern provides a smooth transition between colors across an area to be painted, independent of the resolution of any particular output device and without specifying the number of steps in the color transition.static classPdfPattern.TilingWrapper that represents tiling pattern of color space.
-
Constructor Summary
Constructors Modifier Constructor Description protectedPdfPattern(PdfDictionary pdfObject)Wraps the passedPdfDictionary.
-
Method Summary
All Methods Static 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.PdfArraygetMatrix()Gets a transformation matrix that maps the pattern’s internal coordinate system to the default coordinate system of the pattern’s parent content stream.static PdfPatterngetPatternInstance(PdfDictionary pdfObject)Creates the instance wrapper of correct type from thePdfDictionaryprotected booleanisWrappedObjectMustBeIndirect()Defines if the object behind this wrapper must be an indirect object in the resultant document.voidsetMatrix(PdfArray matrix)Sets a transformation matrix that maps the pattern’s internal coordinate system to the default coordinate system of the pattern’s parent content stream.-
Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
-
-
-
Constructor Detail
-
PdfPattern
protected PdfPattern(PdfDictionary pdfObject)
Wraps the passedPdfDictionary.- Parameters:
pdfObject- thePdfDictionarythat represent Pattern
-
-
Method Detail
-
getPatternInstance
public static PdfPattern getPatternInstance(PdfDictionary pdfObject)
Creates the instance wrapper of correct type from thePdfDictionary- Parameters:
pdfObject- thePdfDictionarythat represent Pattern- Returns:
- new wrapper instance.
-
getMatrix
public PdfArray getMatrix()
Gets a transformation matrix that maps the pattern’s internal coordinate system to the default coordinate system of the pattern’s parent content stream. The concatenation of the pattern matrix with that of the parent content stream establishes the pattern coordinate space, within which all graphics objects in the pattern shall be interpreted.- Returns:
- pattern matrix
-
setMatrix
public void setMatrix(PdfArray matrix)
Sets a transformation matrix that maps the pattern’s internal coordinate system to the default coordinate system of the pattern’s parent content stream. The concatenation of the pattern matrix with that of the parent content stream establishes the pattern coordinate space, within which all graphics objects in the pattern shall be interpreted.- Parameters:
matrix- pattern matrix to set
-
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 classPdfObjectWrapper<PdfDictionary>
-
isWrappedObjectMustBeIndirect
protected boolean isWrappedObjectMustBeIndirect()
Description copied from class:PdfObjectWrapperDefines if the object behind this wrapper must be an indirect object in the resultant document.
If this method returns true it doesn't necessarily mean that object must be in the indirect state at any moment, but rather defines that when the object will be written to the document it will be transformed into indirect object if it's not indirect yet.
Return value of this method shouldn't depend on any logic, it should return always true or false.- Specified by:
isWrappedObjectMustBeIndirectin classPdfObjectWrapper<PdfDictionary>- Returns:
- true if in the resultant document the object behind the wrapper must be indirect, otherwise false.
-
-