CGPSConverter.pas 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. { CoreGraphics - CGPSConverter.h
  2. * Copyright (c) 2003 Apple Computer, Inc.
  3. * All rights reserved.
  4. }
  5. { Pascal Translation: Peter N Lewis, <[email protected]>, August 2005 }
  6. {
  7. Modified for use with Free Pascal
  8. Version 200
  9. Please report any bugs to <[email protected]>
  10. }
  11. {$mode macpas}
  12. {$packenum 1}
  13. {$macro on}
  14. {$inline on}
  15. {$CALLING MWPASCAL}
  16. unit CGPSConverter;
  17. interface
  18. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  19. {$setc GAP_INTERFACES_VERSION := $0200}
  20. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  21. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  22. {$endc}
  23. {$ifc defined CPUPOWERPC and defined CPUI386}
  24. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  25. {$endc}
  26. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  27. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  28. {$endc}
  29. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  30. {$setc __ppc__ := 1}
  31. {$elsec}
  32. {$setc __ppc__ := 0}
  33. {$endc}
  34. {$ifc not defined __i386__ and defined CPUI386}
  35. {$setc __i386__ := 1}
  36. {$elsec}
  37. {$setc __i386__ := 0}
  38. {$endc}
  39. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  40. {$error Conflicting definitions for __ppc__ and __i386__}
  41. {$endc}
  42. {$ifc defined __ppc__ and __ppc__}
  43. {$setc TARGET_CPU_PPC := TRUE}
  44. {$setc TARGET_CPU_X86 := FALSE}
  45. {$elifc defined __i386__ and __i386__}
  46. {$setc TARGET_CPU_PPC := FALSE}
  47. {$setc TARGET_CPU_X86 := TRUE}
  48. {$elsec}
  49. {$error Neither __ppc__ nor __i386__ is defined.}
  50. {$endc}
  51. {$setc TARGET_CPU_PPC_64 := FALSE}
  52. {$ifc defined FPC_BIG_ENDIAN}
  53. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  54. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  55. {$elifc defined FPC_LITTLE_ENDIAN}
  56. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  57. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  58. {$elsec}
  59. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  60. {$endc}
  61. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  62. {$setc CALL_NOT_IN_CARBON := FALSE}
  63. {$setc OLDROUTINENAMES := FALSE}
  64. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  65. {$setc OPAQUE_UPP_TYPES := TRUE}
  66. {$setc OTCARBONAPPLICATION := TRUE}
  67. {$setc OTKERNEL := FALSE}
  68. {$setc PM_USE_SESSION_APIS := TRUE}
  69. {$setc TARGET_API_MAC_CARBON := TRUE}
  70. {$setc TARGET_API_MAC_OS8 := FALSE}
  71. {$setc TARGET_API_MAC_OSX := TRUE}
  72. {$setc TARGET_CARBON := TRUE}
  73. {$setc TARGET_CPU_68K := FALSE}
  74. {$setc TARGET_CPU_MIPS := FALSE}
  75. {$setc TARGET_CPU_SPARC := FALSE}
  76. {$setc TARGET_OS_MAC := TRUE}
  77. {$setc TARGET_OS_UNIX := FALSE}
  78. {$setc TARGET_OS_WIN32 := FALSE}
  79. {$setc TARGET_RT_MAC_68881 := FALSE}
  80. {$setc TARGET_RT_MAC_CFM := FALSE}
  81. {$setc TARGET_RT_MAC_MACHO := TRUE}
  82. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  83. {$setc TYPE_BOOL := FALSE}
  84. {$setc TYPE_EXTENDED := FALSE}
  85. {$setc TYPE_LONGLONG := TRUE}
  86. uses MacTypes,CFBase,CFDictionary,CGBase,CGDataConsumer,CGDataProvider;
  87. {$ALIGN POWER}
  88. // CGPSConverterRef defined in CGBase
  89. { CGPSConverter callbacks.
  90. *
  91. * `version' is the version number of the structure passed in as a
  92. * parameter to the converter creation functions. The structure defined
  93. * below is version 0.
  94. *
  95. * `beginDocument', if non-NULL, is called at the beginning of the
  96. * conversion of the PostScript document.
  97. *
  98. * `endDocument', if non-NULL, is called at the end of conversion of the
  99. * PostScript document.
  100. *
  101. * `beginPage', if non-NULL, is called at the start of the conversion of
  102. * each page in the PostScript document.
  103. *
  104. * `endPage', if non-NULL, is called at the end of the conversion of each
  105. * page in the PostScript document.
  106. *
  107. * `noteProgress', if non-NULL, is called periodically during the
  108. * conversion to indicate that conversion is proceeding.
  109. *
  110. * `noteMessage', if non-NULL, is called to pass any messages that might
  111. * result during the conversion.
  112. *
  113. * `releaseInfo', if non-NULL, is called when the converter is
  114. * deallocated. }
  115. type
  116. CGPSConverterBeginDocumentCallback = procedure( info: UnivPtr );
  117. type
  118. CGPSConverterEndDocumentCallback = procedure( info: UnivPtr; success: CBool );
  119. type
  120. CGPSConverterBeginPageCallback = procedure( info: UnivPtr; pageNumber: size_t; pageInfo: CFDictionaryRef );
  121. type
  122. CGPSConverterEndPageCallback = procedure( info: UnivPtr; pageNumber: size_t; pageInfo: CFDictionaryRef );
  123. type
  124. CGPSConverterProgressCallback = procedure( info: UnivPtr );
  125. type
  126. CGPSConverterMessageCallback = procedure( info: UnivPtr; message: CFStringRef );
  127. type
  128. CGPSConverterReleaseInfoCallback = procedure( info: UnivPtr );
  129. type
  130. CGPSConverterCallbacks = record
  131. version: UInt32;
  132. beginDocument: CGPSConverterBeginDocumentCallback;
  133. endDocument: CGPSConverterEndDocumentCallback;
  134. beginPage: CGPSConverterBeginPageCallback;
  135. endPage: CGPSConverterEndPageCallback;
  136. noteProgress: CGPSConverterProgressCallback;
  137. noteMessage: CGPSConverterMessageCallback;
  138. releaseInfo: CGPSConverterReleaseInfoCallback;
  139. end;
  140. { Create a CGPSConverter, using `callbacks' to populate its callback
  141. * table. Each callback will be supplied the `info' value when called. }
  142. function CGPSConverterCreate( info: UnivPtr; const (*var*) callbacks: CGPSConverterCallbacks; options: CFDictionaryRef ): CGPSConverterRef; external name '_CGPSConverterCreate'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  143. { Use `converter' to convert PostScript data to PDF data. The PostScript
  144. * data is supplied by `provider'; the resulting PDF is written to
  145. * `consumer'. Returns true if the conversion succeeded; false
  146. * otherwise. }
  147. function CGPSConverterConvert( converter: CGPSConverterRef; provider: CGDataProviderRef; consumer: CGDataConsumerRef; options: CFDictionaryRef ): CBool; external name '_CGPSConverterConvert'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  148. { Tell the `converter' to abort conversion at the next possible
  149. * opportunity. }
  150. function CGPSConverterAbort( converter: CGPSConverterRef ): CBool; external name '_CGPSConverterAbort'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  151. { Return true if `converter' is currently converting data. }
  152. function CGPSConverterIsConverting( converter: CGPSConverterRef ): CBool; external name '_CGPSConverterIsConverting'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  153. { Return the CFTypeID of the CGPSConverter class. }
  154. function CGPSConverterGetTypeID: CFTypeID; external name '_CGPSConverterGetTypeID'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  155. end.