---
title: "init(directInfo:size:callbacks:)"
framework: coregraphics
role: symbol
role_heading: Initializer
path: "coregraphics/cgdataprovider/init(directinfo:size:callbacks:)"
---

# init(directInfo:size:callbacks:)

Creates a direct-access data provider.

## Declaration

```swift
init?(directInfo info: UnsafeMutableRawPointer?, size: off_t, callbacks: UnsafePointer<CGDataProviderDirectCallbacks>)
```

## Parameters

- `info`: A pointer to data of any type or NULL. When Core Graphics calls the functions specified in the callbacks parameter, it sends each of the functions this pointer.
- `size`: The number of bytes of data to provide.
- `callbacks`: A pointer to a doc://com.apple.coregraphics/documentation/CoreGraphics/CGDataProviderDirectCallbacks structure that specifies the callback functions you implement to handle the data provider’s basic memory management.

## Return Value

Return Value A new data provider. In Objective-C, you’re responsible for releasing this object using CGDataProviderRelease.

## Discussion

Discussion You use this function to create a direct-access data provider that uses callback functions to read data from your program in a single block.

## See Also

### Creating Direct-Access Data Providers

- [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)
- [CGDataProviderGetBytesAtPositionCallback](coregraphics/cgdataprovidergetbytesatpositioncallback.md)
- [CGDataProviderReleaseBytePointerCallback](coregraphics/cgdataproviderreleasebytepointercallback.md)
- [CGDataProviderReleaseInfoCallback](coregraphics/cgdataproviderreleaseinfocallback.md)
- [CGDataProviderReleaseDataCallback](coregraphics/cgdataproviderreleasedatacallback.md)
