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

# draw()

Implemented by subclasses to draw the image in the current coordinate system.

```
func draw() -> Bool
```

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the image was successfully drawn; otherwise, <doc://com.apple.documentation/documentation/Swift/false> if there was a problem. The default version of this method simply returns <doc://com.apple.documentation/documentation/Swift/true>.

## Discussion

Subclass override this method to draw the image using the image data. By the time this method is called, the graphics state is already configured for you to draw the image at location (0.0, 0.0) in the current coordinate system.

The standard Application Kit subclasses all draw the image using the `NSCompositeCopy` composite operation defined in the `Constants` section of `NSImage`. Using the copy operator, the image data overwrites the destination without any blending effects. Transparent (alpha) regions in the source image appear black. To use other composite operations, you must place the representation into an `NSImage` object and use its [`draw(at:from:operation:fraction:)`](/documentation/AppKit/NSImage/draw(at:from:operation:fraction:)) or [`draw(in:from:operation:fraction:)`](/documentation/AppKit/NSImage/draw(in:from:operation:fraction:)) methods.

---

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)