<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSImage/compositeToPoint:fromRect:operation:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSImage(im)compositeToPoint:fromRect:operation:"
  },
  "title" : "compositeToPoint:fromRect:operation:"
}
-->

# compositeToPoint:fromRect:operation:

Composites a portion of the image to the specified point in the current coordinate system.

```
- (void) compositeToPoint:(NSPoint) point fromRect:(NSRect) rect operation:(NSCompositingOperation) operation;
```

## Parameters

`point`

The point at which to draw the image, specified in the current coordinate system.

`rect`

The portion of the image you want to draw, specified in the image’s coordinate system.

`operation`

The compositing operation to use when drawing the image to the screen. The supported compositing operations are described in `Constants`.

## Discussion

This method draws the specified portion of the image without checking the bounds rectangle you pass into the `srcRect` parameter. If you specify a source rectangle that strays outside of the image’s bounds rectangle, it is conceivable that you could composite parts of the offscreen cache window that do not belong to the receiver’s image. You can avoid this problem using the [`draw(at:from:operation:fraction:)`](/documentation/AppKit/NSImage/draw(at:from:operation:fraction:)) method, which checks the source rectangle before drawing.

During drawing, the image is composited from its offscreen window cache. Because the offscreen cache is not created until the image representation is first used, this method may need to render the image before compositing. Bitmap representations in particular are not cached until they are explicitly rendered. You can use the [`lockFocus()`](/documentation/AppKit/NSImage/lockFocus()) and [`unlockFocus()`](/documentation/AppKit/NSImage/unlockFocus()) methods to force the cached version to be created.

Compositing part of an image is as efficient as compositing the whole image, but printing just part of an image is not. When printing, it’s necessary to draw the whole image and rely on a clipping path to be sure that only the desired portion appears.

During printing, this method ignores the `op` parameter. Even though this parameter is ignored, this method attempts to render the image as close as possible to its appearance when the compositing operation is used on the screen. In either case, the best image representation is chosen for the printing context.

## See Also

[`- (void) dissolveToPoint:(NSPoint) point fromRect:(NSRect) rect fraction:(CGFloat) fraction;`](/documentation/AppKit/NSImage/dissolveToPoint:fromRect:fraction:)

Composites a portion of the image to the specified location using the source-over operator.

[`func draw(at: NSPoint, from: NSRect, operation: NSCompositingOperation, fraction: CGFloat)`](/documentation/AppKit/NSImage/draw(at:from:operation:fraction:))

Draws all or part of the image at the specified point in the current coordinate system.

[`func draw(in: NSRect, from: NSRect, operation: NSCompositingOperation, fraction: CGFloat)`](/documentation/AppKit/NSImage/draw(in:from:operation:fraction:))

Draws all or part of the image in the specified rectangle in the current 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)