Contents

CGDataProviderGetBytesCallback

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

Declaration

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:).

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

See Also

Creating Sequential-Access Data Providers