org.icepdf.core.pobjects.graphics
Class TilingPattern

java.lang.Object
  extended by org.icepdf.core.pobjects.Dictionary
      extended by org.icepdf.core.pobjects.Stream
          extended by org.icepdf.core.pobjects.graphics.TilingPattern
All Implemented Interfaces:
Pattern

public class TilingPattern
extends Stream
implements Pattern

Tiling patterns consist of a small graphical figure (called a pattern cell) that is replicated at fixed horizontal and vertical intervals to fill the area to be painted. The graphics objects to use for tiling are described by a content stream. (PDF 1.2)

Since:
3.0
Author:
ICEsoft Technologies Inc.

Field Summary
 java.awt.Color fillColour
           
static int PAINTING_TYPE_COLORED_TILING_PATTERN
          Colored tiling pattern.
static int PAINTING_TYPE_UNCOLORED_TILING_PATTERN
          Uncolored tiling pattern.
static int TILING_TYPE_CONSTANT_SPACING
          Spacing of tiles relative to the device grid: Pattern cells are spaced consistently-that is, by a multiple of a device pixel.
static int TILING_TYPE_CONSTANT_SPACING_FASTER
          Pattern cells are spaced consistently as in tiling type 1, but with additional distortion permitted to enable a more efficient implementation.
static int TILING_TYPE_NO_DISTORTION
          The pattern cell is not distorted, but the spacing between pattern cells may vary by as much as 1 device pixel, both horizontally and vertically, when the pattern is painted.
 
Fields inherited from class org.icepdf.core.pobjects.Dictionary
entries, isDeleted, isNew, library, SUBTYPE_KEY, TYPE_KEY
 
Fields inherited from interface org.icepdf.core.pobjects.graphics.Pattern
PATTERN_TYPE_SHADING, PATTERN_TYPE_TILING
 
Constructor Summary
TilingPattern(Library l, java.util.Hashtable h, SeekableInputConstrainedWrapper streamInputWrapper)
           
TilingPattern(Stream stream)
           
 
Method Summary
 java.awt.geom.Rectangle2D getBBox()
           
 java.awt.Color getFirstColor()
           
 java.awt.geom.AffineTransform getInvMatrix()
           
 java.awt.geom.AffineTransform getMatrix()
           
 java.awt.Paint getPaint()
           
 int getPaintType()
           
 GraphicsState getParentGraphicState()
           
 int getPatternType()
           
 Shapes getShapes()
           
 int getTilingType()
           
 java.lang.String getType()
           
 java.awt.Color getUnColored()
           
 float getXStep()
           
 float getYStep()
           
 void init()
          Initiate the Dictionary.
 void paintPattern(java.awt.Graphics2D g, Page parentPage)
          Applies the pattern paint specified by this TilingPattern instance.
 void setMatrix(java.awt.geom.AffineTransform matrix)
           
 void setPaintType(int paintType)
           
 void setParentGraphicState(GraphicsState graphicsState)
           
 void setPatternType(int patternType)
           
 void setShapes(Shapes shapes)
           
 void setTilingType(int tilingType)
           
 void setUnColored(java.awt.Color unColored)
           
 java.lang.String toString()
          Return a string description of the object.
 
Methods inherited from class org.icepdf.core.pobjects.Stream
dispose, getBlackIs1, getBlackIs1OrNull, getBytes, getImage, getInputStreamForDecodedStreamBytes, getPObjectReference, getStreamInput, isImageMask, isInlineImage, setInlineImage, setPObjectReference
 
Methods inherited from class org.icepdf.core.pobjects.Dictionary
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, getObject, isDeleted, isNew, setDeleted, setNew
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PAINTING_TYPE_COLORED_TILING_PATTERN

public static final int PAINTING_TYPE_COLORED_TILING_PATTERN
Colored tiling pattern. The pattern's content stream itself specifies the colors used to paint the pattern cell. When the content stream begins execution, the current color is the one that was initially in effect in the pattern's parent content stream.

See Also:
Constant Field Values

PAINTING_TYPE_UNCOLORED_TILING_PATTERN

public static final int PAINTING_TYPE_UNCOLORED_TILING_PATTERN
Uncolored tiling pattern. The pattern's content stream does not specify any color information. Instead, the entire pattern cell is painted with a separately specified color each time the pattern is used. Essentially, the content stream describes a stencil through which the current color is to be poured. The content stream must not invoke operators that specify colors or other color-related parameters in the graphics state; otherwise, an error will occur

See Also:
Constant Field Values

TILING_TYPE_CONSTANT_SPACING

public static final int TILING_TYPE_CONSTANT_SPACING
Spacing of tiles relative to the device grid: Pattern cells are spaced consistently-that is, by a multiple of a device pixel. To achieve this, the viewer application may need to distort the pattern cell slightly by making small adjustments to XStep, YStep, and the transformation matrix. The amount of distortion does not exceed 1 device pixel.

See Also:
Constant Field Values

TILING_TYPE_NO_DISTORTION

public static final int TILING_TYPE_NO_DISTORTION
The pattern cell is not distorted, but the spacing between pattern cells may vary by as much as 1 device pixel, both horizontally and vertically, when the pattern is painted. This achieves the spacing requested by XStep and YStep on average, but not necessarily for each individual pattern cell.

See Also:
Constant Field Values

TILING_TYPE_CONSTANT_SPACING_FASTER

public static final int TILING_TYPE_CONSTANT_SPACING_FASTER
Pattern cells are spaced consistently as in tiling type 1, but with additional distortion permitted to enable a more efficient implementation.

See Also:
Constant Field Values

fillColour

public java.awt.Color fillColour
Constructor Detail

TilingPattern

public TilingPattern(Stream stream)

TilingPattern

public TilingPattern(Library l,
                     java.util.Hashtable h,
                     SeekableInputConstrainedWrapper streamInputWrapper)
Parameters:
l -
h -
streamInputWrapper -
Method Detail

getType

public java.lang.String getType()
Specified by:
getType in interface Pattern

getFirstColor

public java.awt.Color getFirstColor()

init

public void init()
Description copied from class: Dictionary
Initiate the Dictionary. Retrieve any needed attributes.

Specified by:
init in interface Pattern
Overrides:
init in class Dictionary

paintPattern

public void paintPattern(java.awt.Graphics2D g,
                         Page parentPage)
Applies the pattern paint specified by this TilingPattern instance. Handles both uncoloured and coloured pattern types.

Parameters:
g - graphics context to apply textured paint too.
parentPage - parent page used to lookup any resources.

getPaint

public java.awt.Paint getPaint()
Specified by:
getPaint in interface Pattern

getPatternType

public int getPatternType()
Specified by:
getPatternType in interface Pattern

setPatternType

public void setPatternType(int patternType)

getPaintType

public int getPaintType()

setPaintType

public void setPaintType(int paintType)

getTilingType

public int getTilingType()

setTilingType

public void setTilingType(int tilingType)

getBBox

public java.awt.geom.Rectangle2D getBBox()
Specified by:
getBBox in interface Pattern

getXStep

public float getXStep()

getYStep

public float getYStep()

getMatrix

public java.awt.geom.AffineTransform getMatrix()
Specified by:
getMatrix in interface Pattern

getInvMatrix

public java.awt.geom.AffineTransform getInvMatrix()

setMatrix

public void setMatrix(java.awt.geom.AffineTransform matrix)
Specified by:
setMatrix in interface Pattern

getShapes

public Shapes getShapes()

setShapes

public void setShapes(Shapes shapes)

setParentGraphicState

public void setParentGraphicState(GraphicsState graphicsState)
Specified by:
setParentGraphicState in interface Pattern

getParentGraphicState

public GraphicsState getParentGraphicState()

getUnColored

public java.awt.Color getUnColored()

setUnColored

public void setUnColored(java.awt.Color unColored)

toString

public java.lang.String toString()
Description copied from class: Stream
Return a string description of the object. Primarly used for debugging.

Overrides:
toString in class Stream
Returns: