Show / Hide Table of Contents

# Class PatternColor

Patterns are quite general, and have many uses; for example, they can be used to create various graphical textures, such as weaves, brick walls, sunbursts, and similar geometrical and chromatic effects. Patterns are specified in a special family of color spaces named Pattern, whose 'color values' are PatternColor objects instead of the numeric component values used with other spaces. Therefore PatternColor is to pattern color space what is ColorPt to all other color spaces.

A tiling pattern consists of a small graphical figure called a pattern cell. Painting with the pattern replicates the cell at fixed horizontal and vertical intervals to fill an area. The effect is as if the figure were painted on the surface of a clear glass tile, identical copies of which were then laid down in an array covering the area and trimmed to its boundaries. This is called tiling the area.

The pattern cell can include graphical elements such as filled areas, text, and sampled images. Its shape need not be rectangular, and the spacing of tiles can differ from the dimensions of the cell itself.

The order in which individual tiles (instances of the cell) are painted is unspecified and unpredictable; it is inadvisable for the figures on adjacent tiles to overlap.

##### Inheritance

object
PatternColor

##### Implements

IDisposable

##### Inherited Members

object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()

###### Namespace: pdftron.PDF

###### Assembly: PDFTronDotNet.dll

##### Syntax

    public class PatternColor : IDisposable

### Constructors

#### PatternColor(Obj)

Create a PatternColor from the given SDF/Cos object listed under Pattern entry in page Resource dictionary.

##### Declaration

    public PatternColor(Obj pattern)

##### Parameters

Type | Name | Description
--- | --- | ---
Obj | pattern | the pattern

### Methods

#### Destroy()

##### Declaration

    public void Destroy()

#### Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

##### Declaration

    public void Dispose()

#### Dispose(bool)

##### Declaration

    protected virtual void Dispose(bool disposing)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | disposing |

#### ~PatternColor()

Releases all resources used by the PatternColor

##### Declaration

    protected ~PatternColor()

#### GetBBox()

Gets the bounding box.

##### Declaration

    public virtual Rect GetBBox()

##### Returns

Type | Description
--- | ---
Rect | A rectangle in the pattern coordinate system giving the coordinates of the left, bottom, right, and top edges, respectively, of the pattern cell’s bounding box. These boundaries are used to clip the pattern cell.

##### Remarks

for patterns other than Tiling this method throws an exception.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetMatrix()

Gets the matrix.

##### Declaration

    public Matrix2D GetMatrix()

##### Returns

Type | Description
--- | ---
Matrix2D | pattern matrix, a transformation matrix that maps the pattern’s internal coordinate system to the default coordinate system of the pattern’s parent content stream (the content stream in which the pattern is defined as a resource). The concatenation of the pattern matrix with that of the parent content stream establishes the pattern coordinate space, within which all graphics objects in the pattern are interpreted.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetSDFObj()

Gets the SDFObj.

##### Declaration

    public Obj GetSDFObj()

##### Returns

Type | Description
--- | ---
Obj | the underlying SDF/Cos object

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetShading()

Gets the shading.

##### Declaration

    public virtual Shading GetShading()

##### Returns

Type | Description
--- | ---
Shading | The shading object defining the shading pattern’s gradient fill.

##### Remarks

for patterns other than Shading this method throws an exception.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetTilingType()

Gets the tiling type.

##### Declaration

    public virtual PatternColor.TilingType GetTilingType()

##### Returns

Type | Description
--- | ---
PatternColor.TilingType | the tiling type identifier that controls adjustments to the spacing of tiles relative to the device pixel grid:

##### Remarks

for patterns other than Tiling this method throws an exception.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetType()

Gets the type.

##### Declaration

    public virtual PatternColor.Type GetType()

##### Returns

Type | Description
--- | ---
PatternColor.Type | The Type of a given SDF/Cos color space, or e_null for if SDF object is not a valid pattern object

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetType(Obj)

Gets the type.

##### Declaration

    public static PatternColor.Type GetType(Obj pattern)

##### Parameters

Type | Name | Description
--- | --- | ---
Obj | pattern | the pattern

##### Returns

Type | Description
--- | ---
PatternColor.Type | The Type of a given SDF/Cos color space, or e_null for if SDF object is not a valid pattern object

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetXStep()

Gets the x step.

##### Declaration

    public virtual double GetXStep()

##### Returns

Type | Description
--- | ---
double | the desired horizontal spacing between pattern cells, measured in the pattern coordinate system.

##### Remarks

that XStep and YStep may differ from the dimensions of the pattern cell implied by the BBox entry. This allows tiling with irregularly shaped figures. XStep and YStep may be either positive or negative, but not zero. for patterns other than Tiling this method throws an exception.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetYStep()

Gets the y step.

##### Declaration

    public virtual double GetYStep()

##### Returns

Type | Description
--- | ---
double | the desired vertical spacing between pattern cells, measured in the pattern coordinate system.

##### Remarks

for patterns other than Tiling this method throws an exception.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

### Implements

IDisposable