Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

203 lines
6.0 KiB

  1. /*
  2. File: CGDataProvider.h
  3. Contains: CoreGraphics data provider
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2000-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef CGDATAPROVIDER_H_
  11. #define CGDATAPROVIDER_H_
  12. #ifndef __CGBASE__
  13. #include <CGBase.h>
  14. #endif
  15. #ifndef __CFURL__
  16. #include <CFURL.h>
  17. #endif
  18. #if PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #if PRAGMA_IMPORT
  25. #pragma import on
  26. #endif
  27. #if PRAGMA_STRUCT_ALIGN
  28. #pragma options align=mac68k
  29. #elif PRAGMA_STRUCT_PACKPUSH
  30. #pragma pack(push, 2)
  31. #elif PRAGMA_STRUCT_PACK
  32. #pragma pack(2)
  33. #endif
  34. typedef struct CGDataProvider* CGDataProviderRef;
  35. typedef CALLBACK_API_C( size_t , CGGetBytesProcPtr )(void *info, void *buffer, size_t count);
  36. typedef CALLBACK_API_C( void , CGSkipBytesProcPtr )(void *info, size_t count);
  37. typedef CALLBACK_API_C( void , CGRewindProcPtr )(void * info);
  38. typedef CALLBACK_API_C( void , CGReleaseProviderProcPtr )(void * info);
  39. /* Callbacks for sequentially accessing data.
  40. * `getBytes' is called to copy `count' bytes from the provider's data to
  41. * `buffer'. It should return the number of bytes copied, or 0 if there's
  42. * no more data.
  43. * `skipBytes' is called to skip ahead in the provider's data by `count' bytes.
  44. * `rewind' is called to rewind the provider to the beginning of the data.
  45. * `releaseProvider', if non-NULL, is called when the provider is freed. */
  46. struct CGDataProviderCallbacks {
  47. CGGetBytesProcPtr getBytes;
  48. CGSkipBytesProcPtr skipBytes;
  49. CGRewindProcPtr rewind;
  50. CGReleaseProviderProcPtr releaseProvider;
  51. };
  52. typedef struct CGDataProviderCallbacks CGDataProviderCallbacks;
  53. typedef CALLBACK_API_C( void *, CGGetBytePointerProcPtr )(void * info);
  54. typedef CALLBACK_API_C( void , CGReleaseByteProcPtr )(void *info, const void *pointer);
  55. typedef CALLBACK_API_C( size_t , CGGetBytesDirectProcPtr )(void *info, void *buffer, size_t offset, size_t count);
  56. /* Callbacks for directly accessing data.
  57. * `getBytePointer', if non-NULL, is called to return a pointer to the
  58. * provider's entire block of data.
  59. * `releaseBytePointer', if non-NULL, is called to release a pointer to
  60. * the provider's entire block of data.
  61. * `getBytes', if non-NULL, is called to copy `count' bytes at offset
  62. * `offset' from the provider's data to `buffer'. It should return the
  63. * number of bytes copied, or 0 if there's no more data.
  64. * `releaseProvider', if non-NULL, is called when the provider is freed.
  65. * At least one of `getBytePointer' or `getBytes' must be non-NULL. */
  66. struct CGDataProviderDirectAccessCallbacks {
  67. CGGetBytePointerProcPtr getBytePointer;
  68. CGReleaseByteProcPtr releaseBytePointer;
  69. CGGetBytesDirectProcPtr getBytes;
  70. CGReleaseProviderProcPtr releaseProvider;
  71. };
  72. typedef struct CGDataProviderDirectAccessCallbacks CGDataProviderDirectAccessCallbacks;
  73. typedef CALLBACK_API_C( void , CGReleaseDataProcPtr )(void *info, const void *data, size_t size);
  74. /* Create a sequential-access data provider using `callbacks' to provide
  75. * the data. `info' is passed to each of the callback functions. */
  76. /*
  77. * CGDataProviderCreate()
  78. *
  79. * Availability:
  80. * Non-Carbon CFM: not available
  81. * CarbonLib: not available
  82. * Mac OS X: in version 10.0 and later
  83. */
  84. EXTERN_API_C( CGDataProviderRef )
  85. CGDataProviderCreate(
  86. void * info,
  87. const CGDataProviderCallbacks * callbacks);
  88. /* Create a direct-access data provider using `callbacks' to supply `size'
  89. * bytes of data. `info' is passed to each of the callback functions. */
  90. /*
  91. * CGDataProviderCreateDirectAccess()
  92. *
  93. * Availability:
  94. * Non-Carbon CFM: not available
  95. * CarbonLib: not available
  96. * Mac OS X: in version 10.0 and later
  97. */
  98. EXTERN_API_C( CGDataProviderRef )
  99. CGDataProviderCreateDirectAccess(
  100. void * info,
  101. size_t size,
  102. const CGDataProviderDirectAccessCallbacks * callbacks);
  103. /* Create a direct-access data provider using `data', an array of `size'
  104. * bytes. `releaseData' is called when the data provider is freed, and is
  105. * passed `info' as its first argument. */
  106. /*
  107. * CGDataProviderCreateWithData()
  108. *
  109. * Availability:
  110. * Non-Carbon CFM: not available
  111. * CarbonLib: not available
  112. * Mac OS X: in version 10.0 and later
  113. */
  114. EXTERN_API_C( CGDataProviderRef )
  115. CGDataProviderCreateWithData(
  116. void * info,
  117. const void * data,
  118. size_t size,
  119. CGReleaseDataProcPtr releaseData);
  120. /* Create a data provider using `url'. */
  121. /*
  122. * CGDataProviderCreateWithURL()
  123. *
  124. * Availability:
  125. * Non-Carbon CFM: not available
  126. * CarbonLib: not available
  127. * Mac OS X: in version 10.0 and later
  128. */
  129. EXTERN_API_C( CGDataProviderRef )
  130. CGDataProviderCreateWithURL(CFURLRef url);
  131. /* Increment the retain count of `provider' and return it. All data
  132. * providers are created with an initial retain count of 1. */
  133. /*
  134. * CGDataProviderRetain()
  135. *
  136. * Availability:
  137. * Non-Carbon CFM: not available
  138. * CarbonLib: not available
  139. * Mac OS X: in version 10.0 and later
  140. */
  141. EXTERN_API_C( CGDataProviderRef )
  142. CGDataProviderRetain(CGDataProviderRef provider);
  143. /* Decrement the retain count of `provider'. If the retain count reaches
  144. * 0, then free `provider' and any associated resources. */
  145. /*
  146. * CGDataProviderRelease()
  147. *
  148. * Availability:
  149. * Non-Carbon CFM: not available
  150. * CarbonLib: not available
  151. * Mac OS X: in version 10.0 and later
  152. */
  153. EXTERN_API_C( void )
  154. CGDataProviderRelease(CGDataProviderRef provider);
  155. #if PRAGMA_STRUCT_ALIGN
  156. #pragma options align=reset
  157. #elif PRAGMA_STRUCT_PACKPUSH
  158. #pragma pack(pop)
  159. #elif PRAGMA_STRUCT_PACK
  160. #pragma pack()
  161. #endif
  162. #ifdef PRAGMA_IMPORT_OFF
  163. #pragma import off
  164. #elif PRAGMA_IMPORT
  165. #pragma import reset
  166. #endif
  167. #ifdef __cplusplus
  168. }
  169. #endif
  170. #endif /* CGDATAPROVIDER_H_ */