---
title: CGDataProviderGetBytesCallback
framework: coregraphics
role: symbol
role_heading: Type Alias
path: coregraphics/cgdataprovidergetbytescallback
---

# CGDataProviderGetBytesCallback

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

## Declaration

```swift
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 doc://com.apple.coregraphics/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

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

## Discussion

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 and CGDataProviderSequentialCallbacks.

## See Also

### Creating Sequential-Access Data Providers

- [init(sequentialInfo:callbacks:)](coregraphics/cgdataprovider/init(sequentialinfo:callbacks:).md)
- [CGDataProviderSequentialCallbacks](coregraphics/cgdataprovidersequentialcallbacks.md)
- [CGDataProviderRewindCallback](coregraphics/cgdataproviderrewindcallback.md)
- [CGDataProviderSkipForwardCallback](coregraphics/cgdataproviderskipforwardcallback.md)
- [CGDataProviderReleaseInfoCallback](coregraphics/cgdataproviderreleaseinfocallback.md)
