/ CoreGraphics / include / CoreGraphics / CGDataProvider.h
CGDataProvider.h
 1  /* Copyright (c) 2007 Christopher J. W. Lloyd
 2  
 3  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 4  
 5  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 6  
 7  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
 8  
 9  #import <CoreFoundation/CFData.h>
10  #import <CoreGraphics/CoreGraphicsExport.h>
11  
12  typedef struct CF_BRIDGED_TYPE(id) O2DataProvider *CGDataProviderRef;
13  
14  typedef void (*CGDataProviderReleaseDataCallback)(void *info, const void *data, size_t size);
15  
16  typedef size_t (*CGDataProviderGetBytesCallback)(void* info, void* buffer, size_t count);
17  typedef off_t (*CGDataProviderSkipForwardCallback)(void* info, off_t count);
18  typedef void (*CGDataProviderRewindCallback)(void* info);
19  typedef void (*CGDataProviderReleaseInfoCallback)(void* info);
20  
21  typedef struct CGDataProviderSequentialCallbacks {
22  	unsigned int version;
23  	CGDataProviderGetBytesCallback getBytes;
24  	CGDataProviderSkipForwardCallback skipForward;
25  	CGDataProviderRewindCallback rewind;
26  	CGDataProviderReleaseInfoCallback releaseInfo;
27  } CGDataProviderSequentialCallbacks;
28  
29  CF_IMPLICIT_BRIDGING_ENABLED
30  
31  COREGRAPHICS_EXPORT CGDataProviderRef CGDataProviderRetain(CGDataProviderRef provider);
32  COREGRAPHICS_EXPORT void CGDataProviderRelease(CGDataProviderRef provider);
33  
34  COREGRAPHICS_EXPORT CGDataProviderRef CGDataProviderCreateWithCFData(CFDataRef data);
35  
36  COREGRAPHICS_EXPORT CGDataProviderRef CGDataProviderCreateWithData(void *info, const void *data, size_t size, CGDataProviderReleaseDataCallback releaseCallback);
37  
38  COREGRAPHICS_EXPORT CGDataProviderRef __nullable CGDataProviderCreateSequential(void* info, const CGDataProviderSequentialCallbacks* callbacks);
39  
40  COREGRAPHICS_EXPORT CFDataRef CGDataProviderCopyData(CGDataProviderRef self);
41  
42  CF_IMPLICIT_BRIDGING_DISABLED