<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGDataProviderGetBytesCallback",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@T@CGDataProviderGetBytesCallback"
  },
  "title" : "CGDataProviderGetBytesCallback"
}
-->

# CGDataProviderGetBytesCallback

A callback function that copies from a provider data stream into a Core Graphics buffer.

```
typealias CGDataProviderGetBytesCallback = (UnsafeMutableRawPointer?, UnsafeMutableRawPointer, Int) -> Int
```

## Parameters

`info`

A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to [`init(version:getBytes:skipForward:rewind:releaseInfo:)`](/documentation/CoreGraphics/CGDataProviderSequentialCallbacks/init(version:getBytes:skipForward:rewind:releaseInfo:)).

`buffer`

The Core Graphics buffer into which you copy the specified number of bytes.

`count`

The number of bytes to copy.

## Return Value

The number of bytes copied. If no more data can be written to the buffer, you should return `0`.

## Discussion

When Core Graphics is ready to receive data from the provider data stream, your function is called. It should copy the specified number of bytes into `buffer`.

For information on how to associate your callback function with a data provider, see [`CGDataProvider`](/documentation/CoreGraphics/CGDataProvider) and [`CGDataProviderSequentialCallbacks`](/documentation/CoreGraphics/CGDataProviderSequentialCallbacks).

---

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)