org.apache.pdfbox.pdmodel.graphics.pattern

## Class PDAbstractPattern

- java.lang.Object
- - org.apache.pdfbox.pdmodel.graphics.pattern.PDAbstractPattern

All Implemented Interfaces:
  COSObjectable

Direct Known Subclasses:
  PDShadingPattern, PDTilingPattern

    public abstract class PDAbstractPattern
    extends Object
    implements COSObjectable

This class wraps a pattern dictionary. Patterns can be found in resource dictionaries.

### Field Summary

Fields
`static int` `TYPE_SHADING_PATTERN` Shading pattern type.
`static int` `TYPE_TILING_PATTERN` Tiling pattern type.

### Constructor Summary

Constructors
Constructor and Description
`PDAbstractPattern()` Creates a new Pattern dictionary.
`PDAbstractPattern(COSDictionary dictionary)` Creates a new Pattern dictionary from the given COS dictionary.

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`static PDAbstractPattern` `create(COSDictionary dictionary)` Create the correct PD Model pattern based on the COS base pattern.
`static PDAbstractPattern` `create(COSDictionary dictionary, ResourceCache resourceCache)` Create the correct PD Model pattern based on the COS base pattern.
`COSDictionary` `getCOSObject()` This will get the underlying dictionary.
`Matrix` `getMatrix()` Returns the pattern matrix, or the identity matrix is none is available.
`abstract int` `getPatternType()` This will return the pattern type.
`String` `getType()` This will return the paint type.
`void` `setMatrix(AffineTransform transform)` Sets the optional Matrix entry for the Pattern.
`void` `setPaintType(int paintType)` This will set the paint type.
`void` `setPatternType(int patternType)` This will set the pattern type.

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

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

### Field Detail

#### TYPE_TILING_PATTERN

    public static final int TYPE_TILING_PATTERN

Tiling pattern type.

See Also:
  Constant Field Values

#### TYPE_SHADING_PATTERN

    public static final int TYPE_SHADING_PATTERN

Shading pattern type.

See Also:
  Constant Field Values

### Constructor Detail

#### PDAbstractPattern

    public PDAbstractPattern()

Creates a new Pattern dictionary.

#### PDAbstractPattern

    public PDAbstractPattern(COSDictionary dictionary)

Creates a new Pattern dictionary from the given COS dictionary.

Parameters:
  `dictionary` - The COSDictionary for this pattern.

### Method Detail

#### create

    public static PDAbstractPattern create(COSDictionary dictionary)
                                    throws IOException

Create the correct PD Model pattern based on the COS base pattern.

Parameters:
  `dictionary` - the COS pattern dictionary
Returns:
  the newly created pattern object
Throws:
  `IOException` - If we are unable to create the PDPattern object.

#### create

    public static PDAbstractPattern create(COSDictionary dictionary,
                                           ResourceCache resourceCache)
                                    throws IOException

Create the correct PD Model pattern based on the COS base pattern.

Parameters:
  `dictionary` - the COS pattern dictionary
  `resourceCache` - the resource cache, may be null, useful for tiling patterns.
Returns:
  the newly created pattern object
Throws:
  `IOException` - If we are unable to create the PDPattern object.

#### getCOSObject

    public COSDictionary getCOSObject()

This will get the underlying dictionary.

Specified by:
  `getCOSObject` in interface `COSObjectable`
Returns:
  The dictionary for this pattern.

#### setPaintType

    public void setPaintType(int paintType)

This will set the paint type.

Parameters:
  `paintType` - The new paint type.

#### getType

    public String getType()

This will return the paint type.

Returns:
  The type of object that this is.

#### setPatternType

    public void setPatternType(int patternType)

This will set the pattern type.

Parameters:
  `patternType` - The new pattern type.

#### getPatternType

    public abstract int getPatternType()

This will return the pattern type.

Returns:
  The pattern type

#### getMatrix

    public Matrix getMatrix()

Returns the pattern matrix, or the identity matrix is none is available.

#### setMatrix

    public void setMatrix(AffineTransform transform)

Sets the optional Matrix entry for the Pattern.

Parameters:
  `transform` - the transformation matrix