---
title: CGDataProviderGetBytesAtPositionCallback
framework: coregraphics
role: symbol
role_heading: Type Alias
path: coregraphics/cgdataprovidergetbytesatpositioncallback
---

# CGDataProviderGetBytesAtPositionCallback

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

## Declaration

```swift
typealias CGDataProviderGetBytesAtPositionCallback = (UnsafeMutableRawPointer?, UnsafeMutableRawPointer, off_t, 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/CGDataProvider/init(directInfo:size:callbacks:).
- `buffer`: The Core Graphics buffer into which you copy the specified number of bytes.
- `position`: Specifies the relative location in the data provider at which to begin copying data.
- `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, your function is called.

## See Also

### Creating Direct-Access Data Providers

- [init(directInfo:size:callbacks:)](coregraphics/cgdataprovider/init(directinfo:size:callbacks:).md)
- [init(data:)](coregraphics/cgdataprovider/init(data:).md)
- [init(url:)](coregraphics/cgdataprovider/init(url:).md)
- [init(dataInfo:data:size:releaseData:)](coregraphics/cgdataprovider/init(datainfo:data:size:releasedata:).md)
- [init(filename:)](coregraphics/cgdataprovider/init(filename:).md)
- [CGDataProviderDirectCallbacks](coregraphics/cgdataproviderdirectcallbacks.md)
- [CGDataProviderGetBytePointerCallback](coregraphics/cgdataprovidergetbytepointercallback.md)
- [CGDataProviderReleaseBytePointerCallback](coregraphics/cgdataproviderreleasebytepointercallback.md)
- [CGDataProviderReleaseInfoCallback](coregraphics/cgdataproviderreleaseinfocallback.md)
- [CGDataProviderReleaseDataCallback](coregraphics/cgdataproviderreleasedatacallback.md)
