<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/centerScanRect(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)centerScanRect:"
  },
  "title" : "centerScanRect(_:)"
}
-->

# centerScanRect(_:)

Converts the corners of a specified rectangle to lie on the center of device pixels, which is useful in compensating for rendering overscanning when the coordinate system has been scaled.

```
func centerScanRect(_ rect: NSRect) -> NSRect
```

## Parameters

`rect`

The rectangle whose corners are to be converted.

## Return Value

The adjusted rectangle.

## Discussion

This method converts the given rectangle to device coordinates, adjusts the rectangle to lie in the center of the pixels, and converts the resulting rectangle back to the view’s coordinate system. Note that this method does not take into account any transformations performed using the <doc://com.apple.documentation/documentation/Foundation/NSAffineTransform> class or Quartz 2D routines.

## See Also

[`rotatedOrScaledFromBase`](/documentation/AppKit/NSView/isRotatedOrScaledFromBase)

A Boolean value indicating whether the view or any of its ancestors has ever had a rotation factor applied to its frame or bounds, or has been scaled from the window’s base coordinate system.



---

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)