Mac Developer Library

Developer

ApplicationServices Framework Reference CGDataProvider Reference

Options
Deployment Target:

On This Page
Language:

CGDataProvider Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import CoreGraphics

Objective-C

@import CoreGraphics;

The CGDataProvider header file declares a data type that supplies Quartz functions with data. Data provider objects abstract the data-access task and eliminate the need for applications to manage data through a raw memory buffer.

For information on how to use CGDataProvider functions, see Quartz 2D Programming Guide Programming Guide.

See also CGDataConsumer Reference.

Functions

  • CGDataProviderCreate CGDataProviderCreate Available in OS X v10.0 through OS X v10.7

    Creates a Quartz sequential-access data provider.

    Declaration

    Objective-C

    CGDataProviderRef CGDataProviderCreate ( void *info, const CGDataProviderCallbacks *callbacks );

    Parameters

    info

    A pointer to data of any type or NULL. When Quartz calls the functions specified in the callbacks parameter, it sends each of the functions this data.

    callbacks

    A pointer to a CGDataProviderCallbacks structure that specifies the callback functions you implement to handle the data provider’s basic memory management. For a complete description, see CGDataProviderCallbacks.

    Return Value

    A new data provider. You are responsible for releasing this object using CGDataProviderRelease.

    Discussion

    You use this function to create a sequential-access data provider that uses callback functions to read data from your program in a stream.

    Import Statement

    Objective-C

    @import ApplicationServices;

    Availability

    Available in OS X v10.0 through OS X v10.7.

    Deprecated in OS X v10.5.

  • CGDataProviderCreateDirectAccess CGDataProviderCreateDirectAccess Available in OS X v10.0 through OS X v10.7

    Creates a Quartz direct-access data provider.

    Declaration

    Objective-C

    CGDataProviderRef CGDataProviderCreateDirectAccess ( void *info, size_t size, const CGDataProviderDirectAccessCallbacks *callbacks );

    Parameters

    info

    A pointer to data of any type or NULL. When Quartz calls the functions specified in the callbacks parameter, it sends each of the functions this pointer.

    size

    A value that specifies the number of bytes that the data provider contains.

    callbacks

    A pointer to a CGDataProviderDirectAccessCallbacks structure that specifies the callback functions you implement to handle the data provider’s basic memory management. For a complete description, see CGDataProviderDirectAccessCallbacks.

    Return Value

    A new data provider. You are responsible for releasing this object using CGDataProviderRelease.

    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.

    Import Statement

    Objective-C

    @import ApplicationServices;

    Availability

    Available in OS X v10.0 through OS X v10.7.

    Deprecated in OS X v10.5.

  • Creates a Quartz direct-access data provider that uses data your program supplies.

    Declaration

    Swift

    func CGDataProviderCreateWithData(_ info: UnsafeMutablePointer<Void>, _ data: UnsafePointer<Void>, _ size: Int, _ releaseData: CGDataProviderReleaseDataCallback) -> CGDataProvider!

    Objective-C

    CGDataProviderRef CGDataProviderCreateWithData ( void *info, const void *data, size_t size, CGDataProviderReleaseDataCallback releaseData );

    Parameters

    info

    A pointer to data of any type, or NULL. When Quartz calls the function specified in the releaseData parameter, Quartz sends it this pointer as its first argument.

    data

    A pointer to the array of data that the provider contains.

    size

    A value that specifies the number of bytes that the data provider contains.

    releaseData

    A pointer to a release callback for the data provider, or NULL. Your release function is called when Quartz frees the data provider. For more information, see CGDataProviderReleaseDataCallback.

    Return Value

    A new data provider. You are responsible for releasing this object using CGDataProviderRelease.

    Discussion

    You use this function to create a direct-access data provider that uses callback functions to read data from your program an entire block at one time.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.0 and later.

  • Creates a Quartz direct-access data provider that uses a URL to supply data.

    Declaration

    Swift

    func CGDataProviderCreateWithURL(_ url: CFURL!) -> CGDataProvider!

    Objective-C

    CGDataProviderRef CGDataProviderCreateWithURL ( CFURLRef url );

    Parameters

    url

    A CFURL object to use for the data provider. When you supply Quartz data via the provider, it reads the data from the URL address.

    Return Value

    A new data provider or NULL if the data from the URL could not be accessed. You are responsible for releasing this object using CGDataProviderRelease.

    Discussion

    You use this function to create a direct-access data provider that supplies data from a URL. When you supply Quartz with a direct-access data provider, Quartz obtains data from your program in a single entire block.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.0 and later.

  • Creates a Quartz direct-access data provider that uses a file to supply data.

    Declaration

    Swift

    func CGDataProviderCreateWithFilename(_ filename: UnsafePointer<Int8>) -> CGDataProvider!

    Objective-C

    CGDataProviderRef CGDataProviderCreateWithFilename ( const char *filename );

    Parameters

    filename

    The full or relative pathname to use for the data provider. When you supply Quartz data via the provider, it reads the data from the specified file.

    Return Value

    A new data provider or NULL if the file could not be opened. You are responsible for releasing this object using CGDataProviderRelease.

    Discussion

    You use this function to create a direct-access data provider that supplies data from a file. When you supply Quartz with a direct-access data provider, Quartz obtains data from your program in a single block.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.0 and later.

  • Creates a Quartz data provider that reads from a CFData object.

    Declaration

    Swift

    func CGDataProviderCreateWithCFData(_ data: CFData!) -> CGDataProvider!

    Objective-C

    CGDataProviderRef CGDataProviderCreateWithCFData ( CFDataRef data );

    Parameters

    data

    The CFData object to read from.

    Return Value

    A new data provider. You are responsible for releasing this object using CGDataProviderRelease.

    Discussion

    You can use this function when you need to represent Quartz data as a CFData type. For example, you might create a CFData object when reading data from the pasteboard.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Returns the Core Foundation type identifier for Quartz data providers.

    Declaration

    Swift

    func CGDataProviderGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID CGDataProviderGetTypeID ( void );

    Return Value

    The identifier for the opaque type CGDataProviderRef.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.2 and later.

  • Returns a copy of the provider’s data.

    Declaration

    Swift

    func CGDataProviderCopyData(_ provider: CGDataProvider!) -> CFData!

    Objective-C

    CFDataRef CGDataProviderCopyData ( CGDataProviderRef provider );

    Parameters

    provider

    The data provider whose data you want to copy.

    Return Value

    A new data object containing a copy of the provider’s data. You are responsible for releasing this object.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Decrements the retain count of a data provider.

    Declaration

    Objective-C

    void CGDataProviderRelease ( CGDataProviderRef provider );

    Parameters

    provider

    The data provider to release.

    Discussion

    This function is equivalent to CFRelease, except that it does not cause an error if the provider parameter is NULL.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Availability

    Available in OS X v10.0 and later.

  • Increments the retain count of a data provider.

    Declaration

    Objective-C

    CGDataProviderRef CGDataProviderRetain ( CGDataProviderRef provider );

    Parameters

    provider

    The data provider to retain.

    Return Value

    The same data provider you passed in as the provider parameter.

    Discussion

    This function is equivalent to CFRetain, except that it does not cause an error if the provider parameter is NULL.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Availability

    Available in OS X v10.0 and later.

  • Creates a Quartz sequential-access data provider.

    Declaration

    Swift

    func CGDataProviderCreateSequential(_ info: UnsafeMutablePointer<Void>, _ callbacks: UnsafePointer<CGDataProviderSequentialCallbacks>) -> CGDataProvider!

    Objective-C

    CGDataProviderRef CGDataProviderCreateSequential ( void *info, const CGDataProviderSequentialCallbacks *callbacks );

    Parameters

    info

    A pointer to data of any type or NULL. When Quartz calls the functions specified in the callbacks parameter, it sends each of the functions this pointer.

    callbacks

    A pointer to a CGDataProviderSequentialCallbacks structure that specifies the callback functions you implement to handle the data provider’s basic memory management.

    Return Value

    A new data provider. You are responsible for releasing this object using CGDataProviderRelease.

    Discussion

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

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.5 and later.

  • Creates a Quartz direct-access data provider.

    Declaration

    Swift

    func CGDataProviderCreateDirect(_ info: UnsafeMutablePointer<Void>, _ size: off_t, _ callbacks: UnsafePointer<CGDataProviderDirectCallbacks>) -> CGDataProvider!

    Objective-C

    CGDataProviderRef CGDataProviderCreateDirect ( void *info, off_t size, const CGDataProviderDirectCallbacks *callbacks );

    Parameters

    info

    A pointer to data of any type or NULL. When Quartz 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 CGDataProviderDirectCallbacks structure that specifies the callback functions you implement to handle the data provider’s basic memory management.

    Return Value

    A new data provider. You are responsible for releasing this object using CGDataProviderRelease.

    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.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.5 and later.

Callbacks

  • A callback function that copies from a provider data stream into a Quartz-supplied buffer.

    Declaration

    Swift

    typealias CGDataProviderGetBytesCallback = CFunctionPointer<((UnsafeMutablePointer<Void>, UnsafeMutablePointer<Void>, Int) -> Int)>

    Objective-C

    size_t (*CGDataProviderGetBytesCallback) ( void *info, void *buffer, size_t count );

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreate.

    buffer

    The Quartz-supplied 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 Quartz 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 CGDataProviderCreate and CGDataProviderCallbacks.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • A callback function that releases any private data or resources associated with the data provider.

    Declaration

    Swift

    typealias CGDataProviderReleaseInfoCallback = CFunctionPointer<((UnsafeMutablePointer<Void>) -> Void)>

    Objective-C

    void (*CGDataProviderReleaseInfoCallback) ( void *info );

    Parameters

    info

    A generic pointer to private information shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreate.

    Discussion

    When Quartz frees a data provider that has an associated release function, the release function is called.

    For information on how to associate your callback function with a data provider, see CGDataProviderCreate and CGDataProviderCallbacks.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • A callback function that moves the current position in the data stream back to the beginning.

    Declaration

    Swift

    typealias CGDataProviderRewindCallback = CFunctionPointer<((UnsafeMutablePointer<Void>) -> Void)>

    Objective-C

    void (*CGDataProviderRewindCallback) ( void *info );

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreate.

    Discussion

    When Quartz needs to read from the beginning of the provider’s data stream, your function is called.

    For information on how to associate your callback function with a data provider, see CGDataProviderCreate and CGDataProviderCallbacks.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • A callback function that advances the current position in the data stream supplied by the provider.

    Declaration

    Objective-C

    void (*CGDataProviderSkipBytesCallback) ( void *info, size_t count );

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreate.

    count

    The number of bytes to skip.

    Discussion

    When Quartz needs to advance forward in the provider’s data stream, your function is called.

    For information on how to associate your callback function with a data provider, see CGDataProviderCreate and CGDataProviderCallbacks.

    Import Statement

    Objective-C

    @import ApplicationServices;

    Availability

    Available in OS X v10.3 through OS X v10.7.

  • A callback function that advances the current position in the data stream supplied by the provider.

    Declaration

    Swift

    typealias CGDataProviderSkipForwardCallback = CFunctionPointer<((UnsafeMutablePointer<Void>, off_t) -> off_t)>

    Objective-C

    off_t (*CGDataProviderSkipForwardCallback) ( void *info, off_t count );

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreate.

    count

    The number of bytes to skip.

    Return Value

    The number of bytes that were actually skipped.

    Discussion

    When Quartz needs to advance forward in the provider’s data stream, your function is called.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.5 and later.

  • A callback function that returns a generic pointer to the provider data.

    Declaration

    Swift

    typealias CGDataProviderGetBytePointerCallback = CFunctionPointer<((UnsafeMutablePointer<Void>) -> UnsafePointer<Void>)>

    Objective-C

    const void * (*CGDataProviderGetBytePointerCallback) ( void *info );

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreateDirectAccess.

    Return Value

    A generic pointer to your provider data. By suppling this pointer, you are giving Quartz read-only access to both the pointer and the underlying provider data. You must not move or modify the provider data until Quartz calls your CGDataProviderReleaseBytePointerCallback function.

    Discussion

    When Quartz needs direct access to your provider data, this function is called.

    For information on how to associate your function with a direct-access data provider, see CGDataProviderCreateDirectAccess and CGDataProviderDirectAccessCallbacks.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • A callback function that copies data from the provider into a Quartz buffer.

    Declaration

    Objective-C

    typedef size_t (*CGDataProviderGetBytesAtOffsetCallback) ( void *info, void *buffer, size_t offset, size_t count );

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreateDirectAccess.

    buffer

    The Quartz-supplied buffer into which you copy the specified number of bytes.

    offset

    Specifies the relative location in the data provider at which to begin copying data.

    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 Quartz is ready to receive data from the provider, your function is called.

    For information on how to associate your function with a direct-access data provider, see CGDataProviderCreateDirectAccess and CGDataProviderDirectAccessCallbacks.

    Import Statement

    Objective-C

    @import ApplicationServices;

    Availability

    Available in OS X v10.3 through OS X v10.7.

  • A callback function that releases the pointer Quartz obtained by calling CGDataProviderGetBytePointerCallback.

    Declaration

    Swift

    typealias CGDataProviderReleaseBytePointerCallback = CFunctionPointer<((UnsafeMutablePointer<Void>, UnsafePointer<Void>) -> Void)>

    Objective-C

    typedef void (*CGDataProviderReleaseBytePointerCallback) ( void *info, const void *pointer );

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreateDirectAccess.

    pointer

    A pointer to your provider data. This is the same pointer you returned in CGDataProviderGetBytePointerCallback.

    Discussion

    When Quartz no longer needs direct access to your provider data, your function is called. You may safely modify, move, or release your provider data at this time.

    For information on how to associate your function with a direct-access data provider, see CGDataProviderCreateDirectAccess and CGDataProviderDirectAccessCallbacks.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • A callback function that releases data you supply to the function CGDataProviderCreateWithData.

    Declaration

    Swift

    typealias CGDataProviderReleaseDataCallback = CFunctionPointer<((UnsafeMutablePointer<Void>, UnsafePointer<Void>, Int) -> Void)>

    Objective-C

    typedef void (*CGDataProviderReleaseDataCallback) ( void *info, const void *data, size_t size );

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreateWithData.

    data

    A pointer to your provider data.

    size

    The size of the data.

    Discussion

    When Quartz no longer needs direct access to your provider data, your function is called. You may safely modify, move, or release your provider data at this time.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.5 and later.

  • A callback function that copies data from the provider into a Quartz buffer.

    Declaration

    Swift

    typealias CGDataProviderGetBytesAtPositionCallback = CFunctionPointer<((UnsafeMutablePointer<Void>, UnsafeMutablePointer<Void>, off_t, Int) -> Int)>

    Objective-C

    typedef size_t (*CGDataProviderGetBytesAtPositionCallback) ( void *info, void *buffer, off_t position, size_t count );

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGDataProviderCreateDirect.

    buffer

    The Quartz-supplied 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

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

    Discussion

    When Quartz is ready to receive data from the provider, your function is called.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.5 and later.

Data Types

  • Defines an opaque type that supplies Quartz with data.

    Declaration

    Swift

    typealias CGDataProviderRef = CGDataProvider

    Objective-C

    typedef struct CGDataProvider *CGDataProviderRef;

    Discussion

    Some Quartz routines supply blocks of data to your program. Rather than reading through a raw memory buffer, data provider objects of type CGDataProviderRef allow you to supply Quartz functions with data.

    In OS X version 10.2 and later, CGDataProviderRef is derived from CFTypeRef and inherits the properties that all Core Foundation types have in common. For more information, see CFType Reference.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.0 and later.

  • Defines a structure containing pointers to client-defined callback functions that manage the sending of data for a sequential-access data provider.

    Declaration

    Objective-C

    struct CGDataProviderCallbacks { CGDataProviderGetBytesCallback getBytes; CGDataProviderSkipBytesCallback skipBytes; CGDataProviderRewindCallback rewind; CGDataProviderReleaseInfoCallback releaseProvider; }; typedef struct CGDataProviderCallbacks CGDataProviderCallbacks;

    Fields

    getBytes

    A pointer to a function that copies data from the provider. For more information, see CGDataProviderGetBytesCallback.

    skipBytes

    A pointer to a function that Quartz calls to advance the stream of data supplied by the provider. For more information, see CGDataProviderSkipBytesCallback.

    rewind

    A pointer to a function Quartz calls to return the provider to the beginning of the data stream. For more information, see CGDataProviderRewindCallback.

    releaseProvider

    A pointer to a function that handles clean-up for the data provider, or NULL. For more information, see CGDataProviderReleaseInfoCallback.

    Discussion

    The functions specified by the CGDataProviderCallbacks structure are responsible for sequentially copying data to a memory buffer for Quartz to use. The functions are also responsible for handling the data provider’s basic memory management. You supply a CGDataProviderCallbacks structure to the function CGDataProviderCreate to create a sequential-access data provider.

    Availability

    Available in OS X v10.0 through OS X v10.7.

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

    Declaration

    Objective-C

    struct CGDataProviderDirectAccessCallbacks { CGDataProviderGetBytePointerCallback getBytePointer; CGDataProviderReleaseBytePointerCallback releaseBytePointer; CGDataProviderGetBytesAtOffsetCallback getBytes; CGDataProviderReleaseInfoCallback releaseProvider; }; typedef struct CGDataProviderDirectAccessCallbacks CGDataProviderDirectAccessCallbacks;

    Fields

    getBytePointer

    A pointer to a function that returns a pointer to the provider’s data. For more information, see CGDataProviderGetBytePointerCallback.

    releaseBytePointer

    A pointer to a function that Quartz calls to release a pointer to the provider’s data. For more information, see CGDataProviderReleaseBytePointerCallback.

    getBytes

    A pointer to a function that copies data from the provider. For more information, see CGDataProviderGetBytesAtOffsetCallback.

    releaseProvider

    A pointer to a function that handles clean-up for the data provider, or NULL. For more information, see CGDataProviderReleaseInfoCallback.

    Discussion

    You supply a CGDataProviderDirectAccessCallbacks structure to the function CGDataProviderCreateDirectAccess to create a data provider for direct access. The functions specified by the CGDataProviderDirectAccessCallbacks structure are responsible for copying data a block at a time to a memory buffer for Quartz 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 getBytes parameters must be non-NULL. If both are non-NULL, then getBytePointer is used to access the data.

    Availability

    Available in OS X v10.0 through OS X v10.7.

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

    Declaration

    Swift

    struct CGDataProviderDirectCallbacks { var version: UInt32 var getBytePointer: CGDataProviderGetBytePointerCallback var releaseBytePointer: CGDataProviderReleaseBytePointerCallback var getBytesAtPosition: CGDataProviderGetBytesAtPositionCallback var releaseInfo: CGDataProviderReleaseInfoCallback init() init(version version: UInt32, getBytePointer getBytePointer: CGDataProviderGetBytePointerCallback, releaseBytePointer releaseBytePointer: CGDataProviderReleaseBytePointerCallback, getBytesAtPosition getBytesAtPosition: CGDataProviderGetBytesAtPositionCallback, releaseInfo releaseInfo: CGDataProviderReleaseInfoCallback) }

    Objective-C

    struct CGDataProviderDirectCallbacks { unsigned int version; CGDataProviderGetBytePointerCallback getBytePointer; CGDataProviderReleaseBytePointerCallback releaseBytePointer; CGDataProviderGetBytesAtPositionCallback getBytesAtPosition; CGDataProviderReleaseInfoCallback releaseInfo; }; typedef struct CGDataProviderDirectCallbacks CGDataProviderDirectCallbacks;

    Fields

    version

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

    getBytePointer

    A pointer to a function that returns a pointer to the provider’s data. For more information, see CGDataProviderGetBytePointerCallback.

    releaseBytePointer

    A pointer to a function that Quartz calls to release a pointer to the provider’s data. For more information, see CGDataProviderReleaseBytePointerCallback.

    getBytesAtPosition

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

    releaseInfo

    A pointer to a function that handles clean-up for the data provider, or NULL. For more information, see CGDataProviderReleaseInfoCallback.

    Discussion

    You supply a CGDataProviderDirectCallbacks structure to the function CGDataProviderCreateDirect to create a data provider for direct access. The functions specified by the CGDataProviderDirectCallbacks structure are responsible for copying data a block at a time to a memory buffer for Quartz 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.

    Availability

    Available in OS X v10.5 and later.

  • Defines a structure containing pointers to client-defined callback functions that manage the sending of data for a sequential-access data provider.

    Declaration

    Swift

    struct CGDataProviderSequentialCallbacks { var version: UInt32 var getBytes: CGDataProviderGetBytesCallback var skipForward: CGDataProviderSkipForwardCallback var rewind: CGDataProviderRewindCallback var releaseInfo: CGDataProviderReleaseInfoCallback init() init(version version: UInt32, getBytes getBytes: CGDataProviderGetBytesCallback, skipForward skipForward: CGDataProviderSkipForwardCallback, rewind rewind: CGDataProviderRewindCallback, releaseInfo releaseInfo: CGDataProviderReleaseInfoCallback) }

    Objective-C

    struct CGDataProviderSequentialCallbacks { unsigned int version; CGDataProviderGetBytesCallback getBytes; CGDataProviderSkipForwardCallback skipForward; CGDataProviderRewindCallback rewind; CGDataProviderReleaseInfoCallback releaseInfo; }; typedef struct CGDataProviderSequentialCallbacks CGDataProviderSequentialCallbacks;

    Fields

    version

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

    getBytes

    A pointer to a function that copies data from the provider. For more information, see CGDataProviderGetBytesCallback.

    skipForward

    A pointer to a function that Quartz calls to advance the stream of data supplied by the provider.

    rewind

    A pointer to a function Quartz calls to return the provider to the beginning of the data stream. For more information, see CGDataProviderRewindCallback.

    releaseInfo

    A pointer to a function that handles clean-up for the data provider, or NULL. For more information, see CGDataProviderReleaseInfoCallback.

    Discussion

    The functions specified by the CGDataProviderSequentialCallbacks structure are responsible for sequentially copying data to a memory buffer for Quartz to use. The functions are also responsible for handling the data provider’s basic memory management. You supply a CGDataProviderCallbacks structure to the function CGDataProviderCreateSequential to create a sequential-access data provider.

    Availability

    Available in OS X v10.5 and later.