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

# CGDataProviderDirectCallbacks

Defines pointers to client-defined callback functions that manage the sending of data for a direct-access data provider.

```
struct CGDataProviderDirectCallbacks
```

## Overview

You supply a [`CGDataProviderDirectCallbacks`](/documentation/CoreGraphics/CGDataProviderDirectCallbacks) structure to the function [`init(directInfo:size:callbacks:)`](/documentation/CoreGraphics/CGDataProvider/init(directInfo:size:callbacks:)) to create a data provider for direct access. The functions specified by the [`CGDataProviderDirectCallbacks`](/documentation/CoreGraphics/CGDataProviderDirectCallbacks) structure are responsible for copying data a block at a time to a memory buffer for Core Graphics to use. The functions are also responsible for handling the data provider’s basic memory management. For the callback to work, one of the `getBytePointer` and `getBytesAtPosition` parameters must be non-`NULL`. If both are non-`NULL`, then `getBytePointer` is used to access the data.

## Topics

### Initializers

[`init()`](/documentation/CoreGraphics/CGDataProviderDirectCallbacks/init())

[`init(version:getBytePointer:releaseBytePointer:getBytesAtPosition:releaseInfo:)`](/documentation/CoreGraphics/CGDataProviderDirectCallbacks/init(version:getBytePointer:releaseBytePointer:getBytesAtPosition:releaseInfo:))

### Instance Properties

[`getBytePointer`](/documentation/CoreGraphics/CGDataProviderDirectCallbacks/getBytePointer)

A pointer to a function that returns a pointer to the provider’s data. For more information, see [`CGDataProviderGetBytePointerCallback`](/documentation/CoreGraphics/CGDataProviderGetBytePointerCallback).

[`getBytesAtPosition`](/documentation/CoreGraphics/CGDataProviderDirectCallbacks/getBytesAtPosition)

A pointer to a function that copies data from the provider.

[`releaseBytePointer`](/documentation/CoreGraphics/CGDataProviderDirectCallbacks/releaseBytePointer)

A pointer to a function that Core Graphics calls to release a pointer to the provider’s data. For more information, see [`CGDataProviderReleaseBytePointerCallback`](/documentation/CoreGraphics/CGDataProviderReleaseBytePointerCallback).

[`releaseInfo`](/documentation/CoreGraphics/CGDataProviderDirectCallbacks/releaseInfo)

A pointer to a function that handles clean-up for the data provider, or `NULL`. For more information, see [`CGDataProviderReleaseInfoCallback`](/documentation/CoreGraphics/CGDataProviderReleaseInfoCallback).

[`version`](/documentation/CoreGraphics/CGDataProviderDirectCallbacks/version)

The version of this structure. It should be set to 0.



---

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)