Class PSTilingPattern
java.lang.Object
org.apache.xmlgraphics.java2d.ps.PSTilingPattern
This class is implementation of PostScript tiling pattern. It allows to make a pattern
with defined PaintProc or texture.
Originally authored by Jiri Kunhart.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Rectangle2DAn 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 boxprotected StringBufferA PostScript procedure for painting the pattern cellprotected intA code that determines how the color of the pattern cell is to be specified: 1 for colored pattern, 2 for uncolored patternstatic final intPostScript constant for a shading pattern (unsupported)static final intA code identifying the pattern type that this dictionary describes; must be 1 for a tiling patternprotected StringThe name of the pattern (for example: "Pattern1" )protected intthe pattern type of this patternprotected TexturePaintA texture is used for filling shapesprotected intA 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 doubleThe desired horizontal spacing between pattern cells, measured in the pattern coordinate systemprotected ListThe 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 doubleThe desired vertical spacing between pattern cells, measured in the pattern coordinate system -
Constructor Summary
ConstructorsConstructorDescriptionPSTilingPattern(String patternName, TexturePaint texture, double xStep, double yStep, int tilingType, List xUID) Constructor for the creation of pattern with defined texturePSTilingPattern(String patternName, StringBuffer paintProc, Rectangle bBox, double xStep, double yStep, int paintType, int tilingType, List xUID) Constructor for the creation of pattern with defined PaintProc -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares two patterns data (except their names).private BufferedImagegetAsRGB()Returns the bounding box.getName()Gets the name of the patternGets the postscript procedure PaintProcintGets the code that determines how the color of the pattern cell is to be specified: 1 for colored pattern, 2 for uncolored patternGets a texture which is used for filling shapesintGets 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 tilingdoublegetXStep()Gets the horizontal spacing between pattern cellsgetXUID()Gets an extended unique ID that uniquely identifies the patterndoublegetYStep()Gets the vertical spacing between pattern cellsinthashCode()voidsetBoundingBox(Rectangle2D bBox) Sets the bounding box.voidSets the name of the pattern.voidsetPaintProc(StringBuffer paintProc) Sets the postscript procedure PaintProcvoidsetPaintType(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 patternvoidsetTexturePaint(TexturePaint texturePaint) Sets a texture which is used for filling shapesvoidsetTilingType(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 tilingvoidsetXStep(double xStep) Sets the horizontal spacing between pattern cellsvoidSets an extended unique ID that uniquely identifies the patternvoidsetYStep(double yStep) Sets the vertical spacing between pattern cellstoString(boolean acrobatDownsample) Generates postscript code for a patternprivate voidwriteImage(StringBuffer sb, int[] argb, int width, int bits)
-
Field Details
-
PATTERN_TYPE_TILING
public static final int PATTERN_TYPE_TILINGA code identifying the pattern type that this dictionary describes; must be 1 for a tiling pattern- See Also:
-
PATTERN_TYPE_SHADING
public static final int PATTERN_TYPE_SHADINGPostScript constant for a shading pattern (unsupported)- See Also:
-
patternType
protected int patternTypethe pattern type of this pattern -
patternName
The name of the pattern (for example: "Pattern1" ) -
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
A PostScript procedure for painting the pattern cell -
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 xStepThe desired horizontal spacing between pattern cells, measured in the pattern coordinate system -
yStep
protected double yStepThe desired vertical spacing between pattern cells, measured in the pattern coordinate system -
paintType
protected int paintTypeA 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 tilingTypeA 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
A texture is used for filling shapes
-
-
Constructor Details
-
PSTilingPattern
public PSTilingPattern(String patternName, StringBuffer paintProc, Rectangle bBox, double xStep, double yStep, int paintType, int tilingType, 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 cellbBox- a pattern cell's bounding boxxStep- the desired horizontal spacing between pattern cellsyStep- the desired vertical spacing between pattern cellspaintType- 1 for colored pattern, 2 for uncolored patterntilingType- 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(String patternName, TexturePaint texture, double xStep, double yStep, int tilingType, 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 shapexStep- the desired horizontal spacing between pattern cellsyStep- yStep the desired vertical spacing between pattern cellstilingType- adjustments to the spacing of tiles relative to the device pixel grid (1,2 or 3)xUID- xUID an extended unique ID (optional)
-
-
Method Details
-
getName
Gets the name of the pattern- Returns:
- String representing the name of the pattern.
-
setName
Sets the name of the pattern.- Parameters:
name- the name of the pattern. Can be anything without spaces (for example "Pattern1").
-
getBoundingBox
Returns the bounding box.- Returns:
- a pattern cell's bounding box
-
setBoundingBox
Sets the bounding box.- Parameters:
bBox- a pattern cell's bounding box
-
getPaintProc
Gets the postscript procedure PaintProc- Returns:
- the postscript procedure PaintProc
-
setPaintProc
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
Gets a texture which is used for filling shapes- Returns:
- the texture
-
setTexturePaint
Sets a texture which is used for filling shapes- Parameters:
texturePaint- the texture
-
getXUID
Gets an extended unique ID that uniquely identifies the pattern- Returns:
- xUID the unique ID
-
setXUID
Sets an extended unique ID that uniquely identifies the pattern- Parameters:
xUID- the unique ID
-
toString
Generates postscript code for a pattern- Returns:
- The string which contains postscript code of pattern definition
-
writeImage
-
getAsRGB
-
hashCode
-
equals
-