<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilterShape/init(rect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilterShape(im)initWithRect:"
  },
  "title" : "init(rect:)"
}
-->

# init(rect:)

Initializes a filter shape object with a rectangle.

```
init(rect r: CGRect)
```

## Parameters

`r`

A rectangle. Core Image uses the rectangle specified by integer parts of the values in the `CGRect` data structure.

## Return Value

An initialized CIFilterShape object, or `nil` if the method fails.

## See Also

[`+  shapeWithRect:`](/documentation/CoreImage/CIFilterShape/shapeWithRect:)

Creates a filter shape object and initializes it with a rectangle.



---

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)