xmlgraphics-commons 1.4

org.apache.xmlgraphics.java2d.ps
Class PSTilingPattern

java.lang.Object
  extended by org.apache.xmlgraphics.java2d.ps.PSTilingPattern

public class PSTilingPattern
extends java.lang.Object

This class is implementation of PostScript tiling pattern. It allows to make a pattern with defined PaintProc or texture.

Author:
Jiri Kunhart

Field Summary
protected  java.awt.geom.Rectangle2D bBox
          An array of four numbers in the pattern coordinate system, giving the coordinates of the left, bottom, right, and top edges, respectively, of the pattern cell's bounding box
protected  java.lang.StringBuffer paintProc
          A PostScript procedure for painting the pattern cell
protected  int paintType
          A code that determines how the color of the pattern cell is to be specified: 1 for colored pattern, 2 for uncolored pattern
static int PATTERN_TYPE_SHADING
          PostScript constant for a shading pattern (unsupported)
static int PATTERN_TYPE_TILING
          A code identifying the pattern type that this dictionary describes; must be 1 for a tiling pattern
protected  java.lang.String patternName
          The name of the pattern (for example: "Pattern1" )
protected  int patternType
          the pattern type of this pattern
protected  java.awt.TexturePaint texture
          A texture is used for filling shapes
protected  int tilingType
          A code that controls adjustments to the spacing of tiles relative to the device pixel grid: 1 for constant spacing, 2 for no distortion 3 for constant spacing and faster tiling.
protected  double xStep
          The desired horizontal spacing between pattern cells, measured in the pattern coordinate system
protected  java.util.List xUID
          The XUID is an extended unique ID ??? an array of integers that provides for distributed, hierarchical management of the space of unique ID numbers (optional)
protected  double yStep
          The desired vertical spacing between pattern cells, measured in the pattern coordinate system
 
Constructor Summary
PSTilingPattern(java.lang.String patternName, java.lang.StringBuffer paintProc, java.awt.Rectangle bBox, double xStep, double yStep, int paintType, int tilingType, java.util.List xUID)
          Constructor for the creation of pattern with defined PaintProc
PSTilingPattern(java.lang.String patternName, java.awt.TexturePaint texture, double xStep, double yStep, int tilingType, java.util.List xUID)
          Constructor for the creation of pattern with defined texture
 
Method Summary
 boolean equals(java.lang.Object pattern)
          Compares two patterns data (except their names).
 java.awt.geom.Rectangle2D getBoundingBox()
          Returns the bounding box.
 java.lang.String getName()
          Gets the name of the pattern
 java.lang.StringBuffer getPaintProc()
          Gets the postscript procedure PaintProc
 int getPaintType()
          Gets the code that determines how the color of the pattern cell is to be specified: 1 for colored pattern, 2 for uncolored pattern
 java.awt.TexturePaint getTexturePaint()
          Gets a texture which is used for filling shapes
 int getTilingType()
          Gets a code that controls adjustments to the spacing of tiles relative to the device pixel grid: 1 for constant spacing, 2 for no distortion 3 for constant spacing and faster tiling
 double getXStep()
          Gets the horizontal spacing between pattern cells
 java.util.List getXUID()
          Gets an extended unique ID that uniquely identifies the pattern
 double getYStep()
          Gets the vertical spacing between pattern cells
 void setBoundingBox(java.awt.geom.Rectangle2D bBox)
          Sets the bounding box.
 void setName(java.lang.String name)
          Sets the name of the pattern.
 void setPaintProc(java.lang.StringBuffer paintProc)
          Sets the postscript procedure PaintProc
 void setPaintType(int paintType)
          Sets the code that determines how the color of the pattern cell is to be specified: 1 for colored pattern, 2 for uncolored pattern
 void setTexturePaint(java.awt.TexturePaint texturePaint)
          Sets a texture which is used for filling shapes
 void setTilingType(int tilingType)
          Sets a code that controls adjustments to the spacing of tiles relative to the device pixel grid: 1 for constant spacing, 2 for no distortion 3 for constant spacing and faster tiling
 void setXStep(double xStep)
          Sets the horizontal spacing between pattern cells
 void setXUID(java.util.List xUID)
          Sets an extended unique ID that uniquely identifies the pattern
 void setYStep(double yStep)
          Sets the vertical spacing between pattern cells
 java.lang.String toString()
          Generates postscript code for a pattern
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PATTERN_TYPE_TILING

public static final int PATTERN_TYPE_TILING
A code identifying the pattern type that this dictionary describes; must be 1 for a tiling pattern

See Also:
Constant Field Values

PATTERN_TYPE_SHADING

public static final int PATTERN_TYPE_SHADING
PostScript constant for a shading pattern (unsupported)

See Also:
Constant Field Values

patternType

protected int patternType
the pattern type of this pattern


patternName

protected java.lang.String patternName
The name of the pattern (for example: "Pattern1" )


xUID

protected java.util.List xUID
The XUID is an extended unique ID ??? an array of integers that provides for distributed, hierarchical management of the space of unique ID numbers (optional)


paintProc

protected java.lang.StringBuffer paintProc
A PostScript procedure for painting the pattern cell


bBox

protected java.awt.geom.Rectangle2D bBox
An array of four numbers in the pattern coordinate system, giving the coordinates of the left, bottom, right, and top edges, respectively, of the pattern cell's bounding box


xStep

protected double xStep
The desired horizontal spacing between pattern cells, measured in the pattern coordinate system


yStep

protected double yStep
The desired vertical spacing between pattern cells, measured in the pattern coordinate system


paintType

protected int paintType
A code that determines how the color of the pattern cell is to be specified: 1 for colored pattern, 2 for uncolored pattern


tilingType

protected int tilingType
A code that controls adjustments to the spacing of tiles relative to the device pixel grid: 1 for constant spacing, 2 for no distortion 3 for constant spacing and faster tiling.


texture

protected java.awt.TexturePaint texture
A texture is used for filling shapes

Constructor Detail

PSTilingPattern

public PSTilingPattern(java.lang.String patternName,
                       java.lang.StringBuffer paintProc,
                       java.awt.Rectangle bBox,
                       double xStep,
                       double yStep,
                       int paintType,
                       int tilingType,
                       java.util.List xUID)
Constructor for the creation of pattern with defined PaintProc

Parameters:
patternName - the name of the pattern (for example: "Pattern1" ), if the name is null, the pattern should be stored in PSPatternStorage, where the pattern gets a name (the pattern without name cannot be use in PS file)
paintProc - a postscript procedure for painting the pattern cell
bBox - a pattern cell's bounding box
xStep - the desired horizontal spacing between pattern cells
yStep - the desired vertical spacing between pattern cells
paintType - 1 for colored pattern, 2 for uncolored pattern
tilingType - adjustments to the spacing of tiles relative to the device pixel grid (1,2 or 3)
xUID - an extended unique ID (optional)

PSTilingPattern

public PSTilingPattern(java.lang.String patternName,
                       java.awt.TexturePaint texture,
                       double xStep,
                       double yStep,
                       int tilingType,
                       java.util.List xUID)
Constructor for the creation of pattern with defined texture

Parameters:
patternName - the name of the pattern (for example: "Pattern1" ), if the name is null, the pattern should be stored in PSPatternStorage, where the pattern gets a name (a pattern without name cannot be use in PS file)
texture - a texture is used for filling a shape
xStep - the desired horizontal spacing between pattern cells
yStep - yStep the desired vertical spacing between pattern cells
tilingType - adjustments to the spacing of tiles relative to the device pixel grid (1,2 or 3)
xUID - xUID an extended unique ID (optional)
Method Detail

getName

public java.lang.String getName()
Gets the name of the pattern

Returns:
String representing the name of the pattern.

setName

public void setName(java.lang.String name)
Sets the name of the pattern.

Parameters:
name - the name of the pattern. Can be anything without spaces (for example "Pattern1").

getBoundingBox

public java.awt.geom.Rectangle2D getBoundingBox()
Returns the bounding box.

Returns:
a pattern cell's bounding box

setBoundingBox

public void setBoundingBox(java.awt.geom.Rectangle2D bBox)
Sets the bounding box.

Parameters:
bBox - a pattern cell's bounding box

getPaintProc

public java.lang.StringBuffer getPaintProc()
Gets the postscript procedure PaintProc

Returns:
the postscript procedure PaintProc

setPaintProc

public void setPaintProc(java.lang.StringBuffer paintProc)
Sets the postscript procedure PaintProc

Parameters:
paintProc - the postscript procedure PaintProc

getXStep

public double getXStep()
Gets the horizontal spacing between pattern cells

Returns:
the horizontal spacing between pattern cells

setXStep

public void setXStep(double xStep)
Sets the horizontal spacing between pattern cells

Parameters:
xStep - the horizontal spacing between pattern cells

getYStep

public double getYStep()
Gets the vertical spacing between pattern cells

Returns:
the vertical spacing between pattern cells

setYStep

public void setYStep(double yStep)
Sets the vertical spacing between pattern cells

Parameters:
yStep - the vertical spacing between pattern cells

getPaintType

public int getPaintType()
Gets the code that determines how the color of the pattern cell is to be specified: 1 for colored pattern, 2 for uncolored pattern

Returns:
the paint type

setPaintType

public void setPaintType(int paintType)
Sets the code that determines how the color of the pattern cell is to be specified: 1 for colored pattern, 2 for uncolored pattern

Parameters:
paintType - the paint type

getTilingType

public int getTilingType()
Gets a code that controls adjustments to the spacing of tiles relative to the device pixel grid: 1 for constant spacing, 2 for no distortion 3 for constant spacing and faster tiling

Returns:
the tiling type

setTilingType

public void setTilingType(int tilingType)
Sets a code that controls adjustments to the spacing of tiles relative to the device pixel grid: 1 for constant spacing, 2 for no distortion 3 for constant spacing and faster tiling

Parameters:
tilingType - the tiling type

getTexturePaint

public java.awt.TexturePaint getTexturePaint()
Gets a texture which is used for filling shapes

Returns:
the texture

setTexturePaint

public void setTexturePaint(java.awt.TexturePaint texturePaint)
Sets a texture which is used for filling shapes

Parameters:
texturePaint - the texture

getXUID

public java.util.List getXUID()
Gets an extended unique ID that uniquely identifies the pattern

Returns:
xUID the unique ID

setXUID

public void setXUID(java.util.List xUID)
Sets an extended unique ID that uniquely identifies the pattern

Parameters:
xUID - the unique ID

toString

public java.lang.String toString()
Generates postscript code for a pattern

Overrides:
toString in class java.lang.Object
Returns:
The string which contains postscript code of pattern definition

equals

public boolean equals(java.lang.Object pattern)
Compares two patterns data (except their names).

Overrides:
equals in class java.lang.Object

xmlgraphics-commons 1.4

Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.