CGDataConsumer.pas 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. { CoreGraphics - CGDataConsumer.h
  2. * Copyright (c) 1999-2004 Apple Computer, Inc.
  3. * All rights reserved.
  4. }
  5. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  6. { Pascal Translation Updated: Gale R Paeper, <[email protected]>, 2006 }
  7. {
  8. Modified for use with Free Pascal
  9. Version 200
  10. Please report any bugs to <[email protected]>
  11. }
  12. {$mode macpas}
  13. {$packenum 1}
  14. {$macro on}
  15. {$inline on}
  16. {$CALLING MWPASCAL}
  17. unit CGDataConsumer;
  18. interface
  19. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  20. {$setc GAP_INTERFACES_VERSION := $0200}
  21. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  22. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  23. {$endc}
  24. {$ifc defined CPUPOWERPC and defined CPUI386}
  25. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  26. {$endc}
  27. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  28. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  29. {$endc}
  30. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  31. {$setc __ppc__ := 1}
  32. {$elsec}
  33. {$setc __ppc__ := 0}
  34. {$endc}
  35. {$ifc not defined __i386__ and defined CPUI386}
  36. {$setc __i386__ := 1}
  37. {$elsec}
  38. {$setc __i386__ := 0}
  39. {$endc}
  40. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  41. {$error Conflicting definitions for __ppc__ and __i386__}
  42. {$endc}
  43. {$ifc defined __ppc__ and __ppc__}
  44. {$setc TARGET_CPU_PPC := TRUE}
  45. {$setc TARGET_CPU_X86 := FALSE}
  46. {$elifc defined __i386__ and __i386__}
  47. {$setc TARGET_CPU_PPC := FALSE}
  48. {$setc TARGET_CPU_X86 := TRUE}
  49. {$elsec}
  50. {$error Neither __ppc__ nor __i386__ is defined.}
  51. {$endc}
  52. {$setc TARGET_CPU_PPC_64 := FALSE}
  53. {$ifc defined FPC_BIG_ENDIAN}
  54. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  55. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  56. {$elifc defined FPC_LITTLE_ENDIAN}
  57. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  58. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  59. {$elsec}
  60. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  61. {$endc}
  62. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  63. {$setc CALL_NOT_IN_CARBON := FALSE}
  64. {$setc OLDROUTINENAMES := FALSE}
  65. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  66. {$setc OPAQUE_UPP_TYPES := TRUE}
  67. {$setc OTCARBONAPPLICATION := TRUE}
  68. {$setc OTKERNEL := FALSE}
  69. {$setc PM_USE_SESSION_APIS := TRUE}
  70. {$setc TARGET_API_MAC_CARBON := TRUE}
  71. {$setc TARGET_API_MAC_OS8 := FALSE}
  72. {$setc TARGET_API_MAC_OSX := TRUE}
  73. {$setc TARGET_CARBON := TRUE}
  74. {$setc TARGET_CPU_68K := FALSE}
  75. {$setc TARGET_CPU_MIPS := FALSE}
  76. {$setc TARGET_CPU_SPARC := FALSE}
  77. {$setc TARGET_OS_MAC := TRUE}
  78. {$setc TARGET_OS_UNIX := FALSE}
  79. {$setc TARGET_OS_WIN32 := FALSE}
  80. {$setc TARGET_RT_MAC_68881 := FALSE}
  81. {$setc TARGET_RT_MAC_CFM := FALSE}
  82. {$setc TARGET_RT_MAC_MACHO := TRUE}
  83. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  84. {$setc TYPE_BOOL := FALSE}
  85. {$setc TYPE_EXTENDED := FALSE}
  86. {$setc TYPE_LONGLONG := TRUE}
  87. uses MacTypes,CFBase,CFData,CGBase,CFURL;
  88. {$ALIGN POWER}
  89. type
  90. CGDataConsumerRef = ^SInt32; { an opaque 32-bit type }
  91. { This callback is called to copy `count' bytes from `buffer' to the
  92. * data consumer. }
  93. type
  94. CGDataConsumerPutBytesCallback = function( info: UnivPtr; buffer: {const} UnivPtr; count: size_t ): size_t;
  95. { This callback is called to release the `info' pointer when the data
  96. * provider is freed. }
  97. type
  98. CGDataConsumerReleaseInfoCallback = procedure( info: UnivPtr );
  99. { Callbacks for accessing data.
  100. * `putBytes' copies `count' bytes from `buffer' to the consumer, and
  101. * returns the number of bytes copied. It should return 0 if no more data
  102. * can be written to the consumer.
  103. * `releaseConsumer', if non-NULL, is called when the consumer is freed. }
  104. type
  105. CGDataConsumerCallbacks = record
  106. putBytes: CGDataConsumerPutBytesCallback;
  107. releaseConsumer: CGDataConsumerReleaseInfoCallback;
  108. end;
  109. { Return the CFTypeID for CGDataConsumerRefs. }
  110. function CGDataConsumerGetTypeID: CFTypeID; external name '_CGDataConsumerGetTypeID'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  111. { Create a data consumer using `callbacks' to handle the data. `info' is
  112. * passed to each of the callback functions. }
  113. function CGDataConsumerCreate( info: UnivPtr; const (*var*) callbacks: CGDataConsumerCallbacks ): CGDataConsumerRef; external name '_CGDataConsumerCreate';
  114. { Create a data consumer which writes data to `url'. }
  115. function CGDataConsumerCreateWithURL( url: CFURLRef ): CGDataConsumerRef; external name '_CGDataConsumerCreateWithURL';
  116. { Create a data consumer which writes to `data'. }
  117. function CGDataConsumerCreateWithCFData( data: CFMutableDataRef ): CGDataConsumerRef; external name '_CGDataConsumerCreateWithCFData'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  118. { Equivalent to `CFRetain(consumer)'. }
  119. function CGDataConsumerRetain( consumer: CGDataConsumerRef ): CGDataConsumerRef; external name '_CGDataConsumerRetain';
  120. { Equivalent to `CFRelease(consumer)'. }
  121. procedure CGDataConsumerRelease( consumer: CGDataConsumerRef ); external name '_CGDataConsumerRelease';
  122. end.