com.lowagie.text.pdf

## Class PdfPatternPainter

- java.lang.Object
- - com.lowagie.text.pdf.PdfContentByte
  - - com.lowagie.text.pdf.PdfTemplate
    - - com.lowagie.text.pdf.PdfPatternPainter

    public final class PdfPatternPainter
    extends PdfTemplate

Implements the pattern.

### Nested Class Summary

### Nested classes/interfaces inherited from class com.lowagie.text.pdf.PdfContentByte

`PdfContentByte.GraphicState`

### Field Summary

Fields
`(package private) java.awt.Color` `defaultColor`
`(package private) boolean` `stencil`
`(package private) float` `xstep`
`(package private) float` `ystep`

### Fields inherited from class com.lowagie.text.pdf.PdfTemplate

`bBox, group, layer, matrix, pageResources, thisReference, type, TYPE_IMPORTED, TYPE_PATTERN, TYPE_TEMPLATE`

### Fields inherited from class com.lowagie.text.pdf.PdfContentByte

`ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, content, layerDepth, LINE_CAP_BUTT, LINE_CAP_PROJECTING_SQUARE, LINE_CAP_ROUND, LINE_JOIN_BEVEL, LINE_JOIN_MITER, LINE_JOIN_ROUND, pdf, separator, state, stateList, TEXT_RENDER_MODE_CLIP, TEXT_RENDER_MODE_FILL, TEXT_RENDER_MODE_FILL_CLIP, TEXT_RENDER_MODE_FILL_STROKE, TEXT_RENDER_MODE_FILL_STROKE_CLIP, TEXT_RENDER_MODE_INVISIBLE, TEXT_RENDER_MODE_STROKE, TEXT_RENDER_MODE_STROKE_CLIP, writer`

### Constructor Summary

Constructors
`private` `PdfPatternPainter()` Creates a `PdfPattern`.
`(package private)` `PdfPatternPainter(PdfWriter wr)` Creates new PdfPattern
`(package private)` `PdfPatternPainter(PdfWriter wr, java.awt.Color defaultColor)`

### Method Summary

Methods
`void` `addImage(Image image, float a, float b, float c, float d, float e, float f)` Adds an `Image` to the page.
`(package private) void` `checkNoColor()`
`java.awt.Color` `getDefaultColor()` Returns the default color of the pattern.
`PdfContentByte` `getDuplicate()` Gets a duplicate of this `PdfPatternPainter`.
`(package private) PdfPattern` `getPattern()` Gets the stream representing this pattern
`(package private) PdfPattern` `getPattern(int compressionLevel)` Gets the stream representing this pattern
`float` `getXStep()` Returns the horizontal interval when repeating the pattern.
`float` `getYStep()` Returns the vertical interval when repeating the pattern.
`boolean` `isStencil()` Tells you if this pattern is colored/uncolored (stencil = uncolored, you need to set a default color).
`void` `resetCMYKColorFill()` Changes the current color for filling paths to black.
`void` `resetCMYKColorStroke()` Changes the current color for stroking paths to black.
`void` `resetGrayFill()` Changes the current gray tint for filling paths to black.
`void` `resetGrayStroke()` Changes the current gray tint for stroking paths to black.
`void` `resetRGBColorFill()` Changes the current color for filling paths to black.
`void` `resetRGBColorStroke()` Changes the current color for stroking paths to black.
`void` `setCMYKColorFill(int cyan, int magenta, int yellow, int black)` Changes the current color for filling paths (device dependent colors!).
`void` `setCMYKColorFillF(float cyan, float magenta, float yellow, float black)` Changes the current color for filling paths (device dependent colors!).
`void` `setCMYKColorStroke(int cyan, int magenta, int yellow, int black)` Changes the current color for stroking paths (device dependent colors!).
`void` `setCMYKColorStrokeF(float cyan, float magenta, float yellow, float black)` Changes the current color for stroking paths (device dependent colors!).
`void` `setColorFill(java.awt.Color color)` Sets the fill color.
`void` `setColorFill(PdfSpotColor sp, float tint)` Sets the fill color to a spot color.
`void` `setColorStroke(java.awt.Color color)` Sets the stroke color.
`void` `setColorStroke(PdfSpotColor sp, float tint)` Sets the stroke color to a spot color.
`void` `setGrayFill(float gray)` Changes the currentgray tint for filling paths (device dependent colors!).
`void` `setGrayStroke(float gray)` Changes the currentgray tint for stroking paths (device dependent colors!).
`void` `setPatternFill(PdfPatternPainter p)` Sets the fill color to a pattern.
`void` `setPatternFill(PdfPatternPainter p, java.awt.Color color, float tint)` Sets the fill color to an uncolored pattern.
`void` `setPatternMatrix(float a, float b, float c, float d, float e, float f)` Sets the transformation matrix for the pattern.
`void` `setPatternStroke(PdfPatternPainter p)` Sets the stroke color to a pattern.
`void` `setPatternStroke(PdfPatternPainter p, java.awt.Color color, float tint)` Sets the stroke color to an uncolored pattern.
`void` `setRGBColorFill(int red, int green, int blue)` Changes the current color for filling paths (device dependent colors!).
`void` `setRGBColorFillF(float red, float green, float blue)` Changes the current color for filling paths (device dependent colors!).
`void` `setRGBColorStroke(int red, int green, int blue)` Changes the current color for stroking paths (device dependent colors!).
`void` `setRGBColorStrokeF(float red, float green, float blue)` Changes the current color for stroking paths (device dependent colors!).
`void` `setXStep(float xstep)` Sets the horizontal interval of this pattern.
`void` `setYStep(float ystep)` Sets the vertical interval of this pattern.

### Methods inherited from class com.lowagie.text.pdf.PdfTemplate

`beginVariableText, createTemplate, createTemplate, endVariableText, getBoundingBox, getFormXObject, getGroup, getHeight, getIndirectReference, getLayer, getMatrix, getPageResources, getResources, getType, getWidth, setBoundingBox, setGroup, setHeight, setLayer, setMatrix, setWidth`

### Methods inherited from class com.lowagie.text.pdf.PdfContentByte

`add, addAnnotation, addImage, addImage, addImage, addOutline, addPSXObject, addTemplate, addTemplate, addTemplateReference, arc, beginLayer, beginMarkedContentSequence, beginMarkedContentSequence, beginMarkedContentSequence, beginText, bezierArc, checkNoPattern, checkWriter, circle, clip, closePath, closePathEoFillStroke, closePathFillStroke, closePathStroke, concatCTM, createAppearance, createAppearance, createGraphics, createGraphics, createGraphics, createGraphics, createGraphicsShapes, createGraphicsShapes, createPattern, createPattern, createPattern, createPattern, createPrinterGraphics, createPrinterGraphics, createPrinterGraphics, createPrinterGraphics, createPrinterGraphicsShapes, createPrinterGraphicsShapes, createTemplate, createTemplate, curveFromTo, curveTo, curveTo, drawButton, drawRadioField, drawTextField, ellipse, endLayer, endMarkedContentSequence, endText, eoClip, eoFill, eoFillStroke, escapeString, escapeString, fill, fillStroke, getCharacterSpacing, getEffectiveStringWidth, getHorizontalScaling, getInternalBuffer, getKernArray, getLeading, getPdfDocument, getPdfWriter, getRootOutline, getWordSpacing, getXTLM, getYTLM, lineTo, localDestination, localGoto, moveText, moveTextWithLeading, moveTo, newlineShowText, newlineShowText, newlineText, newPath, outputColorNumbers, paintShading, paintShading, rectangle, rectangle, remoteGoto, remoteGoto, reset, reset, restoreState, roundRectangle, sanityCheck, saveState, setAction, setCharacterSpacing, setDefaultColorspace, setFlatness, setFontAndSize, setGState, setHorizontalScaling, setLeading, setLineCap, setLineDash, setLineDash, setLineDash, setLineDash, setLineJoin, setLineWidth, setLiteral, setLiteral, setLiteral, setMiterLimit, setPatternFill, setPatternStroke, setShadingFill, setShadingStroke, setTextMatrix, setTextMatrix, setTextRenderingMode, setTextRise, setWordSpacing, showText, showText, showTextAligned, showTextAlignedKerned, showTextKerned, size, stroke, toPdf, toString, transform, variableRectangle`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### xstep

    float xstep

#### ystep

    float ystep

#### stencil

    boolean stencil

#### defaultColor

    java.awt.Color defaultColor

### Constructor Detail

#### PdfPatternPainter

    private PdfPatternPainter()

Creates a `PdfPattern`.

#### PdfPatternPainter

    PdfPatternPainter(PdfWriter wr)

Creates new PdfPattern

Parameters:
  `wr` - the `PdfWriter`

#### PdfPatternPainter

    PdfPatternPainter(PdfWriter wr,
                     java.awt.Color defaultColor)

### Method Detail

#### setXStep

    public void setXStep(float xstep)

Sets the horizontal interval of this pattern.

Parameters:
  `xstep` - the xstep in horizontal painting

#### setYStep

    public void setYStep(float ystep)

Sets the vertical interval of this pattern.

Parameters:
  `ystep` - in vertical painting

#### getXStep

    public float getXStep()

Returns the horizontal interval when repeating the pattern.

Returns:
  a value

#### getYStep

    public float getYStep()

Returns the vertical interval when repeating the pattern.

Returns:
  a value

#### isStencil

    public boolean isStencil()

Tells you if this pattern is colored/uncolored (stencil = uncolored, you need to set a default color).

Returns:
  true if the pattern is an uncolored tiling pattern (stencil).

#### setPatternMatrix

    public void setPatternMatrix(float a,
                        float b,
                        float c,
                        float d,
                        float e,
                        float f)

Sets the transformation matrix for the pattern.

Parameters:
  `a` -
  `b` -
  `c` -
  `d` -
  `e` -
  `f` -

#### getPattern

    PdfPattern getPattern()

Gets the stream representing this pattern

Returns:
  the stream representing this pattern

#### getPattern

    PdfPattern getPattern(int compressionLevel)

Gets the stream representing this pattern

Parameters:
  `compressionLevel` - the compression level of the stream
Returns:
  the stream representing this pattern
Since:
  2.1.3

#### getDuplicate

    public PdfContentByte getDuplicate()

Gets a duplicate of this `PdfPatternPainter`. All the members are copied by reference but the buffer stays different.

Overrides:
  `getDuplicate` in class `PdfTemplate`
Returns:
  a copy of this `PdfPatternPainter`

#### getDefaultColor

    public java.awt.Color getDefaultColor()

Returns the default color of the pattern.

Returns:
  a Color

#### setGrayFill

    public void setGrayFill(float gray)

Description copied from class: `PdfContentByte`
Changes the currentgray tint for filling paths (device dependent colors!).

Sets the color space to DeviceGray (or the DefaultGray color space), and sets the gray tint to use for filling paths.

Overrides:
  `setGrayFill` in class `PdfContentByte`
Parameters:
  `gray` - a value between 0 (black) and 1 (white)
See Also:
  `PdfContentByte.setGrayFill(float)`

#### resetGrayFill

    public void resetGrayFill()

Description copied from class: `PdfContentByte`
Changes the current gray tint for filling paths to black.

Overrides:
  `resetGrayFill` in class `PdfContentByte`
See Also:
  `PdfContentByte.resetGrayFill()`

#### setGrayStroke

    public void setGrayStroke(float gray)

Description copied from class: `PdfContentByte`
Changes the currentgray tint for stroking paths (device dependent colors!).

Sets the color space to DeviceGray (or the DefaultGray color space), and sets the gray tint to use for stroking paths.

Overrides:
  `setGrayStroke` in class `PdfContentByte`
Parameters:
  `gray` - a value between 0 (black) and 1 (white)
See Also:
  `PdfContentByte.setGrayStroke(float)`

#### resetGrayStroke

    public void resetGrayStroke()

Description copied from class: `PdfContentByte`
Changes the current gray tint for stroking paths to black.

Overrides:
  `resetGrayStroke` in class `PdfContentByte`
See Also:
  `PdfContentByte.resetGrayStroke()`

#### setRGBColorFillF

    public void setRGBColorFillF(float red,
                        float green,
                        float blue)

Description copied from class: `PdfContentByte`
Changes the current color for filling paths (device dependent colors!).

Sets the color space to DeviceRGB (or the DefaultRGB color space), and sets the color to use for filling paths.

Following the PDF manual, each operand must be a number between 0 (minimum intensity) and 1 (maximum intensity).

Overrides:
  `setRGBColorFillF` in class `PdfContentByte`
Parameters:
  `red` - the intensity of red. A value between 0 and 1
  `green` - the intensity of green. A value between 0 and 1
  `blue` - the intensity of blue. A value between 0 and 1
See Also:
  `PdfContentByte.setRGBColorFillF(float, float, float)`

#### resetRGBColorFill

    public void resetRGBColorFill()

Description copied from class: `PdfContentByte`
Changes the current color for filling paths to black.

Overrides:
  `resetRGBColorFill` in class `PdfContentByte`
See Also:
  `PdfContentByte.resetRGBColorFill()`

#### setRGBColorStrokeF

    public void setRGBColorStrokeF(float red,
                          float green,
                          float blue)

Description copied from class: `PdfContentByte`
Changes the current color for stroking paths (device dependent colors!).

Sets the color space to DeviceRGB (or the DefaultRGB color space), and sets the color to use for stroking paths.

Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and 1 (maximum intensity).

Overrides:
  `setRGBColorStrokeF` in class `PdfContentByte`
Parameters:
  `red` - the intensity of red. A value between 0 and 1
  `green` - the intensity of green. A value between 0 and 1
  `blue` - the intensity of blue. A value between 0 and 1
See Also:
  `PdfContentByte.setRGBColorStrokeF(float, float, float)`

#### resetRGBColorStroke

    public void resetRGBColorStroke()

Description copied from class: `PdfContentByte`
Changes the current color for stroking paths to black.

Overrides:
  `resetRGBColorStroke` in class `PdfContentByte`
See Also:
  `PdfContentByte.resetRGBColorStroke()`

#### setCMYKColorFillF

    public void setCMYKColorFillF(float cyan,
                         float magenta,
                         float yellow,
                         float black)

Description copied from class: `PdfContentByte`
Changes the current color for filling paths (device dependent colors!).

Sets the color space to DeviceCMYK (or the DefaultCMYK color space), and sets the color to use for filling paths.

Following the PDF manual, each operand must be a number between 0 (no ink) and 1 (maximum ink).

Overrides:
  `setCMYKColorFillF` in class `PdfContentByte`
Parameters:
  `cyan` - the intensity of cyan. A value between 0 and 1
  `magenta` - the intensity of magenta. A value between 0 and 1
  `yellow` - the intensity of yellow. A value between 0 and 1
  `black` - the intensity of black. A value between 0 and 1
See Also:
  `PdfContentByte.setCMYKColorFillF(float, float, float, float)`

#### resetCMYKColorFill

    public void resetCMYKColorFill()

Description copied from class: `PdfContentByte`
Changes the current color for filling paths to black.

Overrides:
  `resetCMYKColorFill` in class `PdfContentByte`
See Also:
  `PdfContentByte.resetCMYKColorFill()`

#### setCMYKColorStrokeF

    public void setCMYKColorStrokeF(float cyan,
                           float magenta,
                           float yellow,
                           float black)

Description copied from class: `PdfContentByte`
Changes the current color for stroking paths (device dependent colors!).

Sets the color space to DeviceCMYK (or the DefaultCMYK color space), and sets the color to use for stroking paths.

Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and 1 (maximum intensity).

Overrides:
  `setCMYKColorStrokeF` in class `PdfContentByte`
Parameters:
  `cyan` - the intensity of cyan. A value between 0 and 1
  `magenta` - the intensity of magenta. A value between 0 and 1
  `yellow` - the intensity of yellow. A value between 0 and 1
  `black` - the intensity of black. A value between 0 and 1
See Also:
  `PdfContentByte.setCMYKColorStrokeF(float, float, float, float)`

#### resetCMYKColorStroke

    public void resetCMYKColorStroke()

Description copied from class: `PdfContentByte`
Changes the current color for stroking paths to black.

Overrides:
  `resetCMYKColorStroke` in class `PdfContentByte`
See Also:
  `PdfContentByte.resetCMYKColorStroke()`

#### addImage

    public void addImage(Image image,
                float a,
                float b,
                float c,
                float d,
                float e,
                float f)
                  throws DocumentException

Description copied from class: `PdfContentByte`
Adds an `Image` to the page. The positioning of the `Image` is done with the transformation matrix. To position an `image` at (x,y) use addImage(image, image_width, 0, 0, image_height, x, y).

Overrides:
  `addImage` in class `PdfContentByte`
Parameters:
  `image` - the `Image` object
  `a` - an element of the transformation matrix
  `b` - an element of the transformation matrix
  `c` - an element of the transformation matrix
  `d` - an element of the transformation matrix
  `e` - an element of the transformation matrix
  `f` - an element of the transformation matrix
Throws:
  `DocumentException` - on error
See Also:
  `PdfContentByte.addImage(com.lowagie.text.Image, float, float, float, float, float, float)`

#### setCMYKColorFill

    public void setCMYKColorFill(int cyan,
                        int magenta,
                        int yellow,
                        int black)

Description copied from class: `PdfContentByte`
Changes the current color for filling paths (device dependent colors!).

Sets the color space to DeviceCMYK (or the DefaultCMYK color space), and sets the color to use for filling paths.

This method is described in the 'Portable Document Format Reference Manual version 1.3' section 8.5.2.1 (page 331).

Following the PDF manual, each operand must be a number between 0 (no ink) and 1 (maximum ink). This method however accepts only integers between 0x00 and 0xFF.

Overrides:
  `setCMYKColorFill` in class `PdfContentByte`
Parameters:
  `cyan` - the intensity of cyan
  `magenta` - the intensity of magenta
  `yellow` - the intensity of yellow
  `black` - the intensity of black
See Also:
  `PdfContentByte.setCMYKColorFill(int, int, int, int)`

#### setCMYKColorStroke

    public void setCMYKColorStroke(int cyan,
                          int magenta,
                          int yellow,
                          int black)

Description copied from class: `PdfContentByte`
Changes the current color for stroking paths (device dependent colors!).

Sets the color space to DeviceCMYK (or the DefaultCMYK color space), and sets the color to use for stroking paths.

This method is described in the 'Portable Document Format Reference Manual version 1.3' section 8.5.2.1 (page 331).

Following the PDF manual, each operand must be a number between 0 (minimum intensity) and 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.

Overrides:
  `setCMYKColorStroke` in class `PdfContentByte`
Parameters:
  `cyan` - the intensity of red
  `magenta` - the intensity of green
  `yellow` - the intensity of blue
  `black` - the intensity of black
See Also:
  `PdfContentByte.setCMYKColorStroke(int, int, int, int)`

#### setRGBColorFill

    public void setRGBColorFill(int red,
                       int green,
                       int blue)

Description copied from class: `PdfContentByte`
Changes the current color for filling paths (device dependent colors!).

Sets the color space to DeviceRGB (or the DefaultRGB color space), and sets the color to use for filling paths.

This method is described in the 'Portable Document Format Reference Manual version 1.3' section 8.5.2.1 (page 331).

Following the PDF manual, each operand must be a number between 0 (minimum intensity) and 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.

Overrides:
  `setRGBColorFill` in class `PdfContentByte`
Parameters:
  `red` - the intensity of red
  `green` - the intensity of green
  `blue` - the intensity of blue
See Also:
  `PdfContentByte.setRGBColorFill(int, int, int)`

#### setRGBColorStroke

    public void setRGBColorStroke(int red,
                         int green,
                         int blue)

Description copied from class: `PdfContentByte`
Changes the current color for stroking paths (device dependent colors!).

Sets the color space to DeviceRGB (or the DefaultRGB color space), and sets the color to use for stroking paths.

This method is described in the 'Portable Document Format Reference Manual version 1.3' section 8.5.2.1 (page 331).

Following the PDF manual, each operand must be a number between 0 (minimum intensity) and 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.

Overrides:
  `setRGBColorStroke` in class `PdfContentByte`
Parameters:
  `red` - the intensity of red
  `green` - the intensity of green
  `blue` - the intensity of blue
See Also:
  `PdfContentByte.setRGBColorStroke(int, int, int)`

#### setColorStroke

    public void setColorStroke(java.awt.Color color)

Description copied from class: `PdfContentByte`
Sets the stroke color. `color` can be an `ExtendedColor`.

Overrides:
  `setColorStroke` in class `PdfContentByte`
Parameters:
  `color` - the color
See Also:
  `PdfContentByte.setColorStroke(java.awt.Color)`

#### setColorFill

    public void setColorFill(java.awt.Color color)

Description copied from class: `PdfContentByte`
Sets the fill color. `color` can be an `ExtendedColor`.

Overrides:
  `setColorFill` in class `PdfContentByte`
Parameters:
  `color` - the color
See Also:
  `PdfContentByte.setColorFill(java.awt.Color)`

#### setColorFill

    public void setColorFill(PdfSpotColor sp,
                    float tint)

Description copied from class: `PdfContentByte`
Sets the fill color to a spot color.

Overrides:
  `setColorFill` in class `PdfContentByte`
Parameters:
  `sp` - the spot color
  `tint` - the tint for the spot color. 0 is no color and 1 is 100% color
See Also:
  `PdfContentByte.setColorFill(com.lowagie.text.pdf.PdfSpotColor, float)`

#### setColorStroke

    public void setColorStroke(PdfSpotColor sp,
                      float tint)

Description copied from class: `PdfContentByte`
Sets the stroke color to a spot color.

Overrides:
  `setColorStroke` in class `PdfContentByte`
Parameters:
  `sp` - the spot color
  `tint` - the tint for the spot color. 0 is no color and 1 is 100% color
See Also:
  `PdfContentByte.setColorStroke(com.lowagie.text.pdf.PdfSpotColor, float)`

#### setPatternFill

    public void setPatternFill(PdfPatternPainter p)

Description copied from class: `PdfContentByte`
Sets the fill color to a pattern. The pattern can be colored or uncolored.

Overrides:
  `setPatternFill` in class `PdfContentByte`
Parameters:
  `p` - the pattern
See Also:
  `PdfContentByte.setPatternFill(com.lowagie.text.pdf.PdfPatternPainter)`

#### setPatternFill

    public void setPatternFill(PdfPatternPainter p,
                      java.awt.Color color,
                      float tint)

Description copied from class: `PdfContentByte`
Sets the fill color to an uncolored pattern.

Overrides:
  `setPatternFill` in class `PdfContentByte`
Parameters:
  `p` - the pattern
  `color` - the color of the pattern
  `tint` - the tint if the color is a spot color, ignored otherwise
See Also:
  `PdfContentByte.setPatternFill(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float)`

#### setPatternStroke

    public void setPatternStroke(PdfPatternPainter p,
                        java.awt.Color color,
                        float tint)

Description copied from class: `PdfContentByte`
Sets the stroke color to an uncolored pattern.

Overrides:
  `setPatternStroke` in class `PdfContentByte`
Parameters:
  `p` - the pattern
  `color` - the color of the pattern
  `tint` - the tint if the color is a spot color, ignored otherwise
See Also:
  `PdfContentByte.setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float)`

#### setPatternStroke

    public void setPatternStroke(PdfPatternPainter p)

Description copied from class: `PdfContentByte`
Sets the stroke color to a pattern. The pattern can be colored or uncolored.

Overrides:
  `setPatternStroke` in class `PdfContentByte`
Parameters:
  `p` - the pattern
See Also:
  `PdfContentByte.setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter)`

#### checkNoColor

    void checkNoColor()