<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGPattern/init(info:bounds:matrix:xStep:yStep:tiling:isColored:callbacks:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "c:@F@CGPatternCreate"
  },
  "title" : "init(info:bounds:matrix:xStep:yStep:tiling:isColored:callbacks:)"
}
-->

# init(info:bounds:matrix:xStep:yStep:tiling:isColored:callbacks:)

Creates a pattern object.

```
init?(info: UnsafeMutableRawPointer?, bounds: CGRect, matrix: CGAffineTransform, xStep: CGFloat, yStep: CGFloat, tiling: CGPatternTiling, isColored: Bool, callbacks: UnsafePointer<CGPatternCallbacks>)
```

## Parameters

`info`

A pointer to private storage used by your pattern drawing function, or `NULL`. For more information, see the discussion below.

`bounds`

The bounding box of the pattern cell, specified in pattern space. (Pattern space is an abstract space that maps to the default user space by the transformation matrix you specify with the `matrix` parameter.)The drawing done in your pattern drawing function is clipped to this rectangle.

`matrix`

A matrix that represents a transform from pattern space to the default user space of the context in which the pattern is used. If no transform is needed, pass the identity matrix.

`xStep`

The horizontal displacement between cells, specified in pattern space. For no additional horizontal space between cells (so that each pattern cells abuts the previous pattern cell in the horizontal direction), pass the width of the pattern cell.

`yStep`

The vertical displacement between cells, specified in pattern space. For no additional vertical space between cells(so that each pattern cells abuts the previous pattern cell in the vertical direction), pass the height of the pattern cell.

`tiling`

A [`CGPatternTiling`](/documentation/CoreGraphics/CGPatternTiling) constant that specifies the desired tiling method.

`isColored`

If you want to draw your pattern using its own intrinsic color, pass <doc://com.apple.documentation/documentation/Swift/true>. If you want to draw an uncolored (or masking) pattern that uses the fill or stroke color in the graphics state, pass <doc://com.apple.documentation/documentation/Swift/false>.

`callbacks`

A pointer to a pattern  callback function table—your pattern drawing function is an entry in this table. See [`CGPatternCallbacks`](/documentation/CoreGraphics/CGPatternCallbacks) for more information about callback function tables for patterns.

## Return Value

A new Core Graphics pattern. In Objective-C, you’re responsible for releasing this object using [`CGPatternRelease`](/documentation/CoreGraphics/CGPatternRelease).

## Discussion

Core Graphics calls your drawing function at the appropriate timeto draw the pattern cell. A pattern cell must be invariant—thatis, the pattern cell should be drawn exactly the same way each timethe drawing function is called.

The appearance of a pattern cell is unaffected by changesin the graphics state of the context in which the pattern is used.

See [`CGPatternDrawPatternCallback`](/documentation/CoreGraphics/CGPatternDrawPatternCallback) formore information about pattern drawing functions.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)