CGImageMetadata.pas 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. { Initial Pascal Translation: Jonas Maebe, <[email protected]>, October 2012 }
  2. {
  3. Modified for use with Free Pascal
  4. Version 308
  5. Please report any bugs to <[email protected]>
  6. }
  7. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  8. {$mode macpas}
  9. {$modeswitch cblocks}
  10. {$packenum 1}
  11. {$macro on}
  12. {$inline on}
  13. {$calling mwpascal}
  14. {$IFNDEF FPC_DOTTEDUNITS}
  15. unit CGImageMetadata;
  16. {$ENDIF FPC_DOTTEDUNITS}
  17. interface
  18. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  19. {$setc GAP_INTERFACES_VERSION := $0308}
  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 CPUPOWERPC32}
  30. {$setc __ppc__ := 1}
  31. {$elsec}
  32. {$setc __ppc__ := 0}
  33. {$endc}
  34. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  35. {$setc __ppc64__ := 1}
  36. {$elsec}
  37. {$setc __ppc64__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc not defined __x86_64__ and defined CPUX86_64}
  45. {$setc __x86_64__ := 1}
  46. {$elsec}
  47. {$setc __x86_64__ := 0}
  48. {$endc}
  49. {$ifc not defined __arm__ and defined CPUARM}
  50. {$setc __arm__ := 1}
  51. {$elsec}
  52. {$setc __arm__ := 0}
  53. {$endc}
  54. {$ifc not defined __arm64__ and defined CPUAARCH64}
  55. {$setc __arm64__ := 1}
  56. {$elsec}
  57. {$setc __arm64__ := 0}
  58. {$endc}
  59. {$ifc defined cpu64}
  60. {$setc __LP64__ := 1}
  61. {$elsec}
  62. {$setc __LP64__ := 0}
  63. {$endc}
  64. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  65. {$error Conflicting definitions for __ppc__ and __i386__}
  66. {$endc}
  67. {$ifc defined __ppc__ and __ppc__}
  68. {$setc TARGET_CPU_PPC := TRUE}
  69. {$setc TARGET_CPU_PPC64 := FALSE}
  70. {$setc TARGET_CPU_X86 := FALSE}
  71. {$setc TARGET_CPU_X86_64 := FALSE}
  72. {$setc TARGET_CPU_ARM := FALSE}
  73. {$setc TARGET_CPU_ARM64 := FALSE}
  74. {$setc TARGET_OS_MAC := TRUE}
  75. {$setc TARGET_OS_IPHONE := FALSE}
  76. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  77. {$setc TARGET_OS_EMBEDDED := FALSE}
  78. {$elifc defined __ppc64__ and __ppc64__}
  79. {$setc TARGET_CPU_PPC := FALSE}
  80. {$setc TARGET_CPU_PPC64 := TRUE}
  81. {$setc TARGET_CPU_X86 := FALSE}
  82. {$setc TARGET_CPU_X86_64 := FALSE}
  83. {$setc TARGET_CPU_ARM := FALSE}
  84. {$setc TARGET_CPU_ARM64 := FALSE}
  85. {$setc TARGET_OS_MAC := TRUE}
  86. {$setc TARGET_OS_IPHONE := FALSE}
  87. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  88. {$setc TARGET_OS_EMBEDDED := FALSE}
  89. {$elifc defined __i386__ and __i386__}
  90. {$setc TARGET_CPU_PPC := FALSE}
  91. {$setc TARGET_CPU_PPC64 := FALSE}
  92. {$setc TARGET_CPU_X86 := TRUE}
  93. {$setc TARGET_CPU_X86_64 := FALSE}
  94. {$setc TARGET_CPU_ARM := FALSE}
  95. {$setc TARGET_CPU_ARM64 := FALSE}
  96. {$ifc defined iphonesim}
  97. {$setc TARGET_OS_MAC := FALSE}
  98. {$setc TARGET_OS_IPHONE := TRUE}
  99. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  100. {$elsec}
  101. {$setc TARGET_OS_MAC := TRUE}
  102. {$setc TARGET_OS_IPHONE := FALSE}
  103. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  104. {$endc}
  105. {$setc TARGET_OS_EMBEDDED := FALSE}
  106. {$elifc defined __x86_64__ and __x86_64__}
  107. {$setc TARGET_CPU_PPC := FALSE}
  108. {$setc TARGET_CPU_PPC64 := FALSE}
  109. {$setc TARGET_CPU_X86 := FALSE}
  110. {$setc TARGET_CPU_X86_64 := TRUE}
  111. {$setc TARGET_CPU_ARM := FALSE}
  112. {$setc TARGET_CPU_ARM64 := FALSE}
  113. {$ifc defined iphonesim}
  114. {$setc TARGET_OS_MAC := FALSE}
  115. {$setc TARGET_OS_IPHONE := TRUE}
  116. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  117. {$elsec}
  118. {$setc TARGET_OS_MAC := TRUE}
  119. {$setc TARGET_OS_IPHONE := FALSE}
  120. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  121. {$endc}
  122. {$setc TARGET_OS_EMBEDDED := FALSE}
  123. {$elifc defined __arm__ and __arm__}
  124. {$setc TARGET_CPU_PPC := FALSE}
  125. {$setc TARGET_CPU_PPC64 := FALSE}
  126. {$setc TARGET_CPU_X86 := FALSE}
  127. {$setc TARGET_CPU_X86_64 := FALSE}
  128. {$setc TARGET_CPU_ARM := TRUE}
  129. {$setc TARGET_CPU_ARM64 := FALSE}
  130. {$setc TARGET_OS_MAC := FALSE}
  131. {$setc TARGET_OS_IPHONE := TRUE}
  132. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  133. {$setc TARGET_OS_EMBEDDED := TRUE}
  134. {$elifc defined __arm64__ and __arm64__}
  135. {$setc TARGET_CPU_PPC := FALSE}
  136. {$setc TARGET_CPU_PPC64 := FALSE}
  137. {$setc TARGET_CPU_X86 := FALSE}
  138. {$setc TARGET_CPU_X86_64 := FALSE}
  139. {$setc TARGET_CPU_ARM := FALSE}
  140. {$setc TARGET_CPU_ARM64 := TRUE}
  141. {$ifc defined ios}
  142. {$setc TARGET_OS_MAC := FALSE}
  143. {$setc TARGET_OS_IPHONE := TRUE}
  144. {$setc TARGET_OS_EMBEDDED := TRUE}
  145. {$elsec}
  146. {$setc TARGET_OS_MAC := TRUE}
  147. {$setc TARGET_OS_IPHONE := FALSE}
  148. {$setc TARGET_OS_EMBEDDED := FALSE}
  149. {$endc}
  150. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  151. {$elsec}
  152. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  153. {$endc}
  154. {$ifc defined __LP64__ and __LP64__ }
  155. {$setc TARGET_CPU_64 := TRUE}
  156. {$elsec}
  157. {$setc TARGET_CPU_64 := FALSE}
  158. {$endc}
  159. {$ifc defined FPC_BIG_ENDIAN}
  160. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  161. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  162. {$elifc defined FPC_LITTLE_ENDIAN}
  163. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  164. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  165. {$elsec}
  166. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  167. {$endc}
  168. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  169. {$setc CALL_NOT_IN_CARBON := FALSE}
  170. {$setc OLDROUTINENAMES := FALSE}
  171. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  172. {$setc OPAQUE_UPP_TYPES := TRUE}
  173. {$setc OTCARBONAPPLICATION := TRUE}
  174. {$setc OTKERNEL := FALSE}
  175. {$setc PM_USE_SESSION_APIS := TRUE}
  176. {$setc TARGET_API_MAC_CARBON := TRUE}
  177. {$setc TARGET_API_MAC_OS8 := FALSE}
  178. {$setc TARGET_API_MAC_OSX := TRUE}
  179. {$setc TARGET_CARBON := TRUE}
  180. {$setc TARGET_CPU_68K := FALSE}
  181. {$setc TARGET_CPU_MIPS := FALSE}
  182. {$setc TARGET_CPU_SPARC := FALSE}
  183. {$setc TARGET_OS_UNIX := FALSE}
  184. {$setc TARGET_OS_WIN32 := FALSE}
  185. {$setc TARGET_RT_MAC_68881 := FALSE}
  186. {$setc TARGET_RT_MAC_CFM := FALSE}
  187. {$setc TARGET_RT_MAC_MACHO := TRUE}
  188. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  189. {$setc TYPE_BOOL := FALSE}
  190. {$setc TYPE_EXTENDED := FALSE}
  191. {$setc TYPE_LONGLONG := TRUE}
  192. {$IFDEF FPC_DOTTEDUNITS}
  193. uses MacOsApi.MacTypes,MacOsApi.CFBase,MacOsApi.CFArray,MacOsApi.CFData,MacOsApi.CFDictionary,MacOsApi.CFError;
  194. {$ELSE FPC_DOTTEDUNITS}
  195. uses MacTypes,CFBase,CFArray,CFData,CFDictionary,CFError;
  196. {$ENDIF FPC_DOTTEDUNITS}
  197. {$endc} {not MACOSALLINCLUDE}
  198. {$ALIGN POWER}
  199. {$ifc TARGET_OS_MAC}
  200. // *****************************************************************************
  201. // CGImageMetadata.h
  202. // *****************************************************************************
  203. {!
  204. * @header CGImageMetadata.h
  205. * @abstract Implements access to image metadata
  206. * @description CGImageMetadata APIs allow clients to view and modify metadata
  207. * for popular image formats. ImageIO supports the EXIF, IPTC, and XMP
  208. * metadata specifications. Please refer to CGImageSource.h for functions to
  209. * read metadata from a CGImageSource, and CGImageDestination.h for functions to
  210. * write metadata to a CGImageDestination. CGImageDestinationCopyImageSource can
  211. * be used to modify metadata without recompressing the image.
  212. *
  213. * Developers can enable additional debugging information by setting the
  214. * environment variable IIO_DEBUG_METADATA=1.
  215. * @related CGImageSource.h
  216. * @related CGImageDestination.h
  217. * @ignorefuncmacro IMAGEIO_AVAILABLE_STARTING
  218. * @ignore extern
  219. * @unsorted
  220. }
  221. {!
  222. * @typedef CGImageMetadataRef
  223. * @abstract an immutable container for CGImageMetadataTags
  224. }
  225. type
  226. CGImageMetadataRef = ^OpaqueCGImageMetadata; { an opaque type }
  227. OpaqueCGImageMetadata = record end;
  228. //{! @functiongroup Creating and identifying CGImageMetadata containers }
  229. {!
  230. * @function CGImageMetadataGetTypeID
  231. * @abstract Gets the type identifier for the CGImageMetadata opaque type
  232. * @return the type identifier for the CGImageMetadata opaque type
  233. }
  234. function CGImageMetadataGetTypeID: CFTypeID; external name '_CGImageMetadataGetTypeID';
  235. {!
  236. * @typedef CGMutableImageMetadataRef
  237. * @abstract a mutable container for CGImageMetadataTags
  238. * @discussion A CGMutableImageMetadataRef can be used in any function that
  239. * accepts a CGImageMetadataRef.
  240. }
  241. type
  242. CGMutableImageMetadataRef = ^OpaqueCGImageMetadata;
  243. {!
  244. * @function CGImageMetadataCreateMutable
  245. * @abstract Creates an empty CGMutableImageMetadataRef
  246. }
  247. function CGImageMetadataCreateMutable: CGMutableImageMetadataRef; external name '_CGImageMetadataCreateMutable';
  248. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  249. {!
  250. * @function CGImageMetadataCreateMutableCopy
  251. * @abstract Creates a deep mutable copy of another CGImageMetadataRef
  252. * @discussion Before modifying an immutable CGImageMetadataRef (such as metadata
  253. * from CGImageSourceCopyMetadataAtIndex) you must first make a copy.
  254. * This function makes a deep copy of all CGImageMetadataTags and their values.
  255. }
  256. function CGImageMetadataCreateMutableCopy( metadata: CGImageMetadataRef ): CGMutableImageMetadataRef; external name '_CGImageMetadataCreateMutableCopy';
  257. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  258. // ****************************************************************************
  259. // CGImageMetadataTag - an individual metadata tag, encapsulating an EXIF tag,
  260. // IPTC tag, or XMP property.
  261. // ****************************************************************************
  262. {!
  263. * @typedef CGImageMetadataTagRef
  264. * @abstract an individual metadata tag
  265. * @discussion A CGImageMetadataTag encapsulates an EXIF, IPTC, or XMP property.
  266. * All tags contain a namespace, prefix, name, type, and value. Please see
  267. * @link CGImageMetadataTagCreate @/link for more details.
  268. }
  269. type
  270. CGImageMetadataTagRef = ^CGImageMetadataTag; { an opaque type }
  271. CGImageMetadataTag = record end;
  272. //{! @functiongroup Creating and identifying CGImageMetadataTags }
  273. {!
  274. * @function CGImageMetadataTagGetTypeID
  275. * @abstract Gets the type identifier for the CGImageMetadataTag opaque type
  276. * @return the type identifier for the CGImageMetadataTagGetTypeID opaque type
  277. }
  278. function CGImageMetadataTagGetTypeID: CFTypeID; external name '_CGImageMetadataTagGetTypeID';
  279. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  280. // ****************************************************************************
  281. // Constants for use in a CGImageMetadataTag
  282. // ****************************************************************************
  283. // All metadata tags must contain a namespace. Clients may use one of the
  284. // public namespaces defined below or create their own namespace. If a caller
  285. // defines their own namespace, it should comply with the guidelines set forth
  286. // by Adobe in their XMP specification at:
  287. // http://www.adobe.com/devnet/xmp.html.
  288. // For example: "http://ns.adobe.com/exif/1.0/".
  289. // The caller must also register a custom namespace using
  290. // CGImageMetadataRegisterNamespaceForPrefix.
  291. // Public, common namespaces.
  292. var kCGImageMetadataNamespaceExif: CFStringRef; external name '_kCGImageMetadataNamespaceExif'; (* attribute const *)
  293. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  294. var kCGImageMetadataNamespaceExifAux: CFStringRef; external name '_kCGImageMetadataNamespaceExifAux'; (* attribute const *)
  295. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  296. var kCGImageMetadataNamespaceDublinCore: CFStringRef; external name '_kCGImageMetadataNamespaceDublinCore'; (* attribute const *)
  297. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  298. var kCGImageMetadataNamespaceIPTCCore: CFStringRef; external name '_kCGImageMetadataNamespaceIPTCCore'; (* attribute const *)
  299. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  300. var kCGImageMetadataNamespacePhotoshop: CFStringRef; external name '_kCGImageMetadataNamespacePhotoshop'; (* attribute const *)
  301. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  302. var kCGImageMetadataNamespaceTIFF: CFStringRef; external name '_kCGImageMetadataNamespaceTIFF'; (* attribute const *)
  303. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  304. var kCGImageMetadataNamespaceXMPBasic: CFStringRef; external name '_kCGImageMetadataNamespaceXMPBasic'; (* attribute const *)
  305. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  306. var kCGImageMetadataNamespaceXMPRights: CFStringRef; external name '_kCGImageMetadataNamespaceXMPRights'; (* attribute const *)
  307. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  308. // All metadata tags must contain a prefix. For the public namespaces defined
  309. // above, no prefix is required - ImageIO will use appropriate defaults. For
  310. // other namespaces a prefix is required. For example, while the exif namespace
  311. // is rather long ("http://ns.adobe.com/exif/1.0/"), when exported the shorter
  312. // string "exif" will be used to prefix all properties in the exif namespace
  313. // (example - "exif:Flash").
  314. // Public, common prefixes.
  315. var kCGImageMetadataPrefixExif: CFStringRef; external name '_kCGImageMetadataPrefixExif'; (* attribute const *)
  316. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  317. var kCGImageMetadataPrefixExifAux: CFStringRef; external name '_kCGImageMetadataPrefixExifAux'; (* attribute const *)
  318. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  319. var kCGImageMetadataPrefixDublinCore: CFStringRef; external name '_kCGImageMetadataPrefixDublinCore'; (* attribute const *)
  320. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  321. var kCGImageMetadataPrefixIPTCCore: CFStringRef; external name '_kCGImageMetadataPrefixIPTCCore'; (* attribute const *)
  322. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  323. var kCGImageMetadataPrefixPhotoshop: CFStringRef; external name '_kCGImageMetadataPrefixPhotoshop'; (* attribute const *)
  324. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  325. var kCGImageMetadataPrefixTIFF: CFStringRef; external name '_kCGImageMetadataPrefixTIFF'; (* attribute const *)
  326. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  327. var kCGImageMetadataPrefixXMPBasic: CFStringRef; external name '_kCGImageMetadataPrefixXMPBasic'; (* attribute const *)
  328. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  329. var kCGImageMetadataPrefixXMPRights: CFStringRef; external name '_kCGImageMetadataPrefixXMPRights'; (* attribute const *)
  330. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  331. // Metadata value type constants.
  332. {!
  333. * @typedef CGImageMetadataType
  334. * @abstract The XMP type for a CGImageMetadataTag
  335. * @discussion CGImageMetadataType defines a list of constants used to indicate
  336. * the type for a CGImageMetadataTag. If you are reading metadata, use the type
  337. * to determine how to interpret the CGImageMetadataTag's value. If you are
  338. * creating a CGImageMetadataTag, use the type to specify how the tag
  339. * should be serialized in XMP. String types have CFStringRef values, array
  340. * types have CFArray values, and structure types have CFDictionary values.
  341. * @const kCGImageMetadataTypeDefault The type will be interpretted based on the
  342. * CFType of the tag's value. This is only used when creating a new
  343. * CGImageMetadataTag - no existing tags should have this value. CFString
  344. * defaults to kCGImageMetadataTypeString, CFArray defaults to
  345. * kCGImageMetadataTypeArrayOrdered, and CFDictionary defaults to
  346. * kCGImageMetadataTypeStructure.
  347. * @const kCGImageMetadataTypeString A string value. CFNumber and CFBoolean
  348. * values will be converted to a string.
  349. * @const kCGImageMetadataTypeArrayUnordered An array where order does not matter.
  350. * Serialized in XMP as <rdf:Bag>.
  351. * @const kCGImageMetadataTypeArrayOrdered An array where order is preserved.
  352. * Serialized in XMP as <rdf:Seq>.
  353. * @const kCGImageMetadataTypeAlternateArray An ordered array where all elements
  354. * are alternates for the same value. Serialized in XMP as <rdf:Alt>.
  355. * @const kCGImageMetadataTypeAlternateText A special case of an alternate array
  356. * where all elements are different localized strings for the same value.
  357. * Serialized in XMP as an alternate array of strings with xml:lang qualifiers.
  358. * @const kCGImageMetadataTypeStructure A collection of keys and values. Unlike
  359. * array elements, fields of a structure may belong to different namespaces.
  360. }
  361. const
  362. kCGImageMetadataTypeInvalid = -1;
  363. kCGImageMetadataTypeDefault = 0;
  364. kCGImageMetadataTypeString = 1;
  365. kCGImageMetadataTypeArrayUnordered = 2;
  366. kCGImageMetadataTypeArrayOrdered = 3;
  367. kCGImageMetadataTypeAlternateArray = 4;
  368. kCGImageMetadataTypeAlternateText = 5;
  369. kCGImageMetadataTypeStructure = 6;
  370. type
  371. CGImageMetadataType = UInt32;
  372. // ****************************************************************************
  373. // Creating a CGImageMetadataTag
  374. // ****************************************************************************
  375. {!
  376. * @function CGImageMetadataTagCreate
  377. * @abstract Creates a new CGImageMetadataTag
  378. * @param xmlns The namespace for the tag. The value can be a common XMP namespace
  379. * defined above, such as kCGImageMetadataNamespaceExif, or a CFString with a
  380. * custom namespace URI. Custom namespaces must be a valid XML namespace. By
  381. * convention, namespaces should end with either '/' or '#'. For example, exif
  382. * uses the namespace "http://ns.adobe.com/exif/1.0/".
  383. * @param prefix An abbreviation for the XML namespace. The value can be NULL if
  384. * the namespace is defined as a constant. Custom prefixes must be a valid XML
  385. * name. For example, the prefix used for "http://ns.adobe.com/exif/1.0/" is "exif".
  386. * The XMP serialization of the tag will use the prefix. Prefixes are also
  387. * important for path-based CGImageMetadata functions, such as
  388. * @link CGImageMetadataCopyStringValueWithPath @/link or
  389. * @link CGImageMetadataSetValueWithPath @/link.
  390. * @param name The name of the tag. It must be a valid XMP name.
  391. * @param type The type of the tag's value. Must be a constant from @link
  392. * CGImageMetadataType @/link.
  393. * @param value The value of the tag. Allowable CFTypes include CFStringRef,
  394. * CFNumberRef, CFBooleanRef, CFArrayRef, and CFDictionaryRef. The CFType of 'value'
  395. * must correspond to the 'type'. The elements of a CFArray must be either a
  396. * CFStringRef or CGImageMetadataTagRef. The keys of a CFDictionary must be
  397. * CFStringRefs with valid XMP names. The values of a CFDictionary must be either
  398. * CFStringRefs or CGImageMetadataTagRefs. A shallow copy of the value is stored
  399. * in the tag. Therefore, modifying a mutable value after the tag is created
  400. * will not affect the tag's value.
  401. * @result Returns a pointer to a new CGImageMetadataTag. Returns NULL if a tag
  402. * could not be created with the specified parameters.
  403. }
  404. function CGImageMetadataTagCreate( xmlns: CFStringRef; prefix: CFStringRef; name: CFStringRef; typ: CGImageMetadataType; value: CFTypeRef ): CGImageMetadataTagRef; external name '_CGImageMetadataTagCreate';
  405. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  406. // ****************************************************************************
  407. // Getting attributes of a CGImageMetadataTag
  408. // ****************************************************************************
  409. //{! @functiongroup Getting attributes of a CGImageMetadataTag }
  410. {!
  411. * @function CGImageMetadataTagCopyNamespace
  412. * @abstract Returns a copy of the tag's namespace
  413. }
  414. function CGImageMetadataTagCopyNamespace( tag: CGImageMetadataTagRef ): CFStringRef; external name '_CGImageMetadataTagCopyNamespace';
  415. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  416. {!
  417. * @function CGImageMetadataTagCopyPrefix
  418. * @abstract Returns a copy of the tag's prefix
  419. }
  420. function CGImageMetadataTagCopyPrefix( tag: CGImageMetadataTagRef ): CFStringRef; external name '_CGImageMetadataTagCopyPrefix';
  421. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  422. {!
  423. * @function CGImageMetadataTagCopyName
  424. * @abstract Returns a copy of the tag's name
  425. }
  426. function CGImageMetadataTagCopyName( tag: CGImageMetadataTagRef ): CFStringRef; external name '_CGImageMetadataTagCopyName';
  427. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  428. {!
  429. * @function CGImageMetadataTagCopyValue
  430. * @abstract Returns a shallow copy of the tag's value
  431. * @discussion This function should only be used to read the tag's value.
  432. * CGImageMetadataCopyTagWithPath returns a copy of the tag (including a copy of
  433. * the tag's value). Therefore mutating a tag's value returned from this function
  434. * may not actually mutate the value in the CGImageMetadata. It is recommended
  435. * to create a new tag followed by CGImageMetadataSetTagWithPath, or use
  436. * CGImageMetadataSetValueWithPath to mutate a metadata value.
  437. }
  438. function CGImageMetadataTagCopyValue( tag: CGImageMetadataTagRef ): CFTypeRef; external name '_CGImageMetadataTagCopyValue';
  439. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  440. {!
  441. * @function CGImageMetadataTagGetType
  442. * @abstract Get the type of the CGImageMetadataTag
  443. * @return Returns a CGImageMetadataType constant for the CGImageMetadataTag.
  444. * This is primarily used to determine how to interpret the tag's value.
  445. }
  446. function CGImageMetadataTagGetType( tag: CGImageMetadataTagRef ): CGImageMetadataType; external name '_CGImageMetadataTagGetType';
  447. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  448. {!
  449. * @function CGImageMetadataTagCopyQualifiers
  450. * @abstract Return a copy of the tag's qualifiers
  451. * @discussion XMP allows properties to contain supplemental properties called
  452. * qualifiers. Qualifiers are themselves CGImageMetadataTags with their own
  453. * namespace, prefix, name, and value. A common use is the xml:lang qualifier
  454. * for elements of an alternate-text array.
  455. * @return Returns a copy of the array of qualifiers. Elements of the array are
  456. * CGImageMetadataTags. Returns NULL if the tag does not have any qualifiers.
  457. * The copy is shallow, the qualifiers are not deep copied.
  458. }
  459. function CGImageMetadataTagCopyQualifiers( tag: CGImageMetadataTagRef ): CFArrayRef; external name '_CGImageMetadataTagCopyQualifiers';
  460. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  461. // ****************************************************************************
  462. // Functions for copying CGImageMetadataTagRefs from a CGImageMetadataRef.
  463. // These functions make it easier for the caller to traverse complex nested
  464. // structures of metadata, similar to KVC-compliant Objective-C classes.
  465. // ****************************************************************************
  466. //{! @functiongroup Retrieving CGImageMetadataTagRefs from a CGImageMetadataRef }
  467. {!
  468. * @function CGImageMetadataCopyTags
  469. * @abstract Obtain an array of tags from a CGImageMetadataRef
  470. * @return Returns an array with a shallow copy of all top-level
  471. * CGImageMetadataTagRefs in a CGImageMetadataRef.
  472. }
  473. function CGImageMetadataCopyTags( metadata: CGImageMetadataRef ): CFArrayRef; external name '_CGImageMetadataCopyTags';
  474. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  475. {!
  476. * @function CGImageMetadataCopyTagWithPath
  477. * @abstract Searches for a specific CGImageMetadataTag in a CGImageMetadataRef
  478. * @discussion This is the primary function for clients to obtain specific
  479. * metadata properties from an image. The 'path' mechanism provides a way to
  480. * access both simple top-level properties, such as Date & Time, or complex
  481. * deeply-nested properties with ease.
  482. * @param metadata A collection of metadata tags.
  483. * @param parent A parent tag. If NULL, the path is relative to the root of the
  484. * CGImageMetadataRef (i.e. it is not a child of another property). If the parent
  485. * is provided, the effective path will be the concatenation of the parent's path
  486. * and the 'path' parameter. This is useful for accessing array elements or
  487. * structure fields inside nested tags.
  488. * @param path A string representing a path to the desired tag. Paths consist of
  489. * a tag prefix (i.e. "exif") joined with a tag name (i.e. "Flash") by a colon
  490. * (":"), such as CFSTR("exif:Flash").
  491. * Elements of ordered and unordered arrays are accessed via 0-based indices inside square [] brackets.
  492. * Elements of alternate-text arrays are accessed by an RFC 3066 language code inside square [] brackets.
  493. * Fields of a structure are delimited by a period, '.'.
  494. * Qualifiers are delimited by the '?' character. Only tags with string values (kCGImageMetadataTypeString)
  495. * are allowed to have qualifiers - arrays and structures may not contain qualifiers.
  496. *
  497. * If parent is NULL, a prefix must be specified for the first tag. Prefixes for
  498. * all subsequent tags are optional. If unspecified, the prefix is
  499. * inherented from the nearest parent tag with a prefix. Custom prefixes must be
  500. * registered using @link CGImageMetadataRegisterNamespaceForPrefix @/link prior to use
  501. * in any path-based functions.
  502. *
  503. * Examples:
  504. * <ul>
  505. * <li>'path' = CFSTR("xmp:CreateDate")</li>
  506. * <li>'path' = CFSTR("exif:Flash.Fired")</li>
  507. * <li>'parent' = tag at path CFSTR("exif:Flash"), path = CFSTR("exif:Fired") (equivilent to previous)</li>
  508. * <li>'path' = CFSTR("exif:Flash.RedEyeMode")</li>
  509. * <li>'path' = CFSTR("dc:title")</li>
  510. * <li>'path' = CFSTR("dc:subject")</li>
  511. * <li>'path' = CFSTR("dc:subject[2]") </li>
  512. * <li>'parent' = tag at path CFSTR("dc:subject"), path = CFSTR("[2]") (equivilent to previous)</li>
  513. * <li>'path' = CFSTR("dc:description[x-default])"</li>
  514. * <li>'path' = CFSTR("dc.description[de])"</li>
  515. * <li>'path' = CFSTR("dc.description[fr])"</li>
  516. * <li>'path' = CFSTR("foo:product)"</li>
  517. * <li>'path' = CFSTR("foo:product?bar:manufacturer)"</li>
  518. * </ul>
  519. * @return Returns a copy of CGImageMetadataTag matching 'path', or NULL if no
  520. * match is found. The copy of the tag's value is shallow. Tags
  521. * copied from an immutable CGImageMetadataRef are also immutable. Because this
  522. * function returns a copy of the tag's value, any modification of the tag's
  523. * value must be followed by a CGImageMetadataSetTagWithPath to commit the
  524. * change to the metadata container.
  525. }
  526. function CGImageMetadataCopyTagWithPath( metadata: CGImageMetadataRef; parent: CGImageMetadataTagRef; path: CFStringRef ): CGImageMetadataTagRef; external name '_CGImageMetadataCopyTagWithPath';
  527. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  528. {!
  529. * @function CGImageMetadataCopyStringValueWithPath
  530. * @abstract Searches for a specific tag in a CGImageMetadataRef and returns its
  531. * string value.
  532. * @discussion This is a convenience method for searching for a tag at path and
  533. * extracting the string value.
  534. * @param metadata A collection of metadata tags.
  535. * @param parent A parent tag. If NULL, the path is relative to the root of the
  536. * CGImageMetadataRef (i.e. it is not a child of another property).
  537. * @param path A string with the path to the desired tag. Please consult
  538. * the documentation of @link CGImageMetadataCopyTagWithPath @/link for
  539. * information about path syntax.
  540. * @return Returns a string from a CGImageMetadataTag located at 'path'. The
  541. * tag must be of type kCGImageMetadataTypeString or kCGImageMetadataTypeAlternateText.
  542. * For AlternateText tags, the element with the "x-default" language qualifier
  543. * will be returned. For other types, NULL will be returned.
  544. }
  545. function CGImageMetadataCopyStringValueWithPath( metadata: CGImageMetadataRef; parent: CGImageMetadataTagRef; path: CFStringRef ): CFStringRef; external name '_CGImageMetadataCopyStringValueWithPath';
  546. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  547. // ****************************************************************************
  548. // Functions for modifying a CGMutableImageMetadataRef
  549. // ****************************************************************************
  550. //{! @functiongroup Modifying a CGMutableImageMetadataRef }
  551. {!
  552. * @function CGImageMetadataRegisterNamespaceForPrefix
  553. * @abstract Associates an XMP namespace URI with a prefix string.
  554. * @discussion This allows ImageIO to create custom metadata when it encounters
  555. * an unrecognized prefix in a path (see CGImageMetadataCopyTagWithPath for more
  556. * information about path syntax). A namespace must be registered before it can
  557. * be used to add custom metadata. All namespaces found in the image's metadata,
  558. * or defined as a constant above, will be pre-registered. Namespaces and
  559. * prefixes must be unique.
  560. * @return Returns true if successful. Returns false and sets 'err' if an error
  561. * or conflict occurs.
  562. }
  563. function CGImageMetadataRegisterNamespaceForPrefix( metadata: CGMutableImageMetadataRef; xmlns: CFStringRef; prefix: CFStringRef; var err: CFErrorRef ): CBool; external name '_CGImageMetadataRegisterNamespaceForPrefix';
  564. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  565. {!
  566. * @function CGImageMetadataSetTagWithPath
  567. * @abstract Sets the tag at a specific path in a CGMutableImageMetadata container or a parent tag
  568. * @discussion This is the primary function for adding new metadata tags to a
  569. * metadata container, or updating existing tags. All tags required to reach
  570. * the final tag (at the end of the path) will be created, if needed. Tags will
  571. * created with default types (ordered arrays). Creating tags will fail if a
  572. * prefix is encountered that has not been registered. Use
  573. * @link CGImageMetadataRegisterNamespaceForPrefix @/link to associate a prefix
  574. * with a namespace prior to using a path-based CGImageMetadata function.
  575. * Note that if a parent tag is provided,
  576. * the children of that tag reference will be modified, which may be a different
  577. * reference from the tag stored in the metadata container. Since tags are normally
  578. * obtained as a copy, it is typically neccesary to use CGImageMetadataSetTagWithPath
  579. * to commit the changed parent object back to the metadata container (using
  580. * the parent's path and NULL for the parent).
  581. * @param metadata A mutable collection of metadata tags.
  582. * Use @link CGImageMetadataCreateMutableCopy @/link or
  583. * @link CGImageMetadataCreateMutable @/link to obtain a mutable metadata container.
  584. * @param parent A parent tag. If NULL, the path is relative to the root of the
  585. * CGImageMetadataRef (i.e. it is not a child of another property).
  586. * Note that if a parent tag is provided,
  587. * the children of that tag reference will be modified, which may be a different
  588. * reference from the tag stored in the metadata container. Since tags are normally
  589. * obtained as a copy, it is typically neccesary to use CGImageMetadataSetTagWithPath
  590. * to commit the changed parent object back to the metadata container (using
  591. * the parent's path and NULL for the parent).
  592. * @param path A string with the path to the desired tag. Please consult
  593. * the documentation of @link CGImageMetadataCopyTagWithPath @/link for
  594. * information about path syntax.
  595. * @param tag The CGImageMetadataTag to be added to the metadata. The tag
  596. * will be retained.
  597. * @return Returns true if successful, false otherwise.
  598. }
  599. function CGImageMetadataSetTagWithPath( metadata: CGMutableImageMetadataRef; parent: CGImageMetadataTagRef; path: CFStringRef; tag: CGImageMetadataTagRef ): CBool; external name '_CGImageMetadataSetTagWithPath';
  600. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  601. {!
  602. * @function CGImageMetadataSetValueWithPath
  603. * @abstract Sets the value of the tag at a specific path in a CGMutableImageMetadataRef container or a parent tag
  604. * @discussion This function is used to add new metadata values to a
  605. * metadata container, or update existing tag values. All tags required to reach
  606. * the final tag (at the end of the path) are created, if needed. Tags are
  607. * created with default types (i.e. arrays will be ordered). Creating tags will
  608. * fail if a prefix is encountered that has not been registered. Use
  609. * @link CGImageMetadataRegisterNamespaceForPrefix @/link to associate a prefix
  610. * with a namespace prior to using a path-based CGImageMetadata function.
  611. *
  612. * Examples
  613. * <ul>
  614. * <li>'path' = CFSTR("xmp:CreateDate"), 'value' = CFSTR("2011-09-20T14:54:47-08:00")</li>
  615. * <li>'path' = CFSTR("dc:subject[0]"), 'value' = CFSTR("San Francisco")</li>
  616. * <li>'path' = CFSTR("dc:subject[1]"), 'value' = CFSTR("Golden Gate Bridge")</li>
  617. * <li>'path' = CFSTR("dc:description[en]") 'value' = CFSTR("my image description")</li>
  618. * <li>'path' = CFSTR("dc:description[de]") 'value' = CFSTR("meine bildbeschreibung")</li>
  619. * </ul>
  620. * Note that if a parent tag is provided,
  621. * the children of that tag reference will be modified, which may be a different
  622. * reference from the tag stored in the metadata container. Since tags are normally
  623. * obtained as a copy, it is typically neccesary to use CGImageMetadataSetTagWithPath
  624. * to commit the changed parent object back to the metadata container (using
  625. * the parent's path and NULL for the parent).
  626. * @param metadata A mutable collection of metadata tags.
  627. * Use @link CGImageMetadataCreateMutableCopy @/link or
  628. * @link CGImageMetadataCreateMutable @/link to obtain a mutable metadata container.
  629. * @param parent A parent tag. If NULL, the path is relative to the root of the
  630. * CGImageMetadataRef (i.e. it is not a child of another property).
  631. * @param path A string with the path to the desired tag. Please consult
  632. * the documentation of @link CGImageMetadataCopyTagWithPath @/link for
  633. * information about path syntax.
  634. * @param value The value to be added to the CGImageMetadataTag matching the path.
  635. * The tag will be retained. The restrictions for the value are the same as in @link
  636. * CGImageMetadataTagCreate @/link.
  637. * @return Returns true if successful, false otherwise.
  638. }
  639. function CGImageMetadataSetValueWithPath( metadata: CGMutableImageMetadataRef; parent: CGImageMetadataTagRef; path: CFStringRef; value: CFTypeRef ): CBool; external name '_CGImageMetadataSetValueWithPath';
  640. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  641. {!
  642. * @function CGImageMetadataRemoveTagWithPath
  643. * @abstract Removes the tag at a specific path from a CGMutableImageMetadata container or from the parent tag
  644. * @discussion Use this function to delete a metadata tag matching a specific
  645. * path from a mutable metadata container. Note that if a parent tag is provided,
  646. * the children of that tag reference will be modified, which may be a different
  647. * reference from the tag stored in the metadata container. Since tags are normally
  648. * obtained as a copy, it is typically neccesary to use CGImageMetadataSetTagWithPath
  649. * to commit the changed parent object back to the metadata container (using
  650. * the parent's path and NULL for the parent).
  651. * @param parent A parent tag. If NULL, the path is relative to the root of the
  652. * CGImageMetadataRef (i.e. it is not a child of another property).
  653. * @param path A string with the path to the desired tag. Please consult
  654. * the documentation of @link CGImageMetadataCopyTagWithPath @/link for
  655. * information about path syntax.
  656. }
  657. function CGImageMetadataRemoveTagWithPath( metadata: CGMutableImageMetadataRef; parent: CGImageMetadataTagRef; path: CFStringRef ): CBool; external name '_CGImageMetadataRemoveTagWithPath';
  658. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  659. // A key for the 'options' of CGImageMetadataEnumerateTagsUsingBlock. If present,
  660. // the value should be a CFBoolean. If true, tags will be enumerated recursively,
  661. // if false, only the direct children of 'rootPath' will be enumerated.
  662. // The default is non-recursive.
  663. var kCGImageMetadataEnumerateRecursively: CFStringRef; external name '_kCGImageMetadataEnumerateRecursively'; (* attribute const *)
  664. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  665. // ****************************************************************************
  666. // Functions for working with constants defined in CGImageProperties.h
  667. // Provides a bridge for values from CGImageCopyPropertiesAtIndex().
  668. // Simplifies metadata access for properties defined EXIF and IPTC standards,
  669. // which have no notion of namespaces, prefixes, or XMP property types.
  670. // Metadata Working Group guidance is factored into the mapping of
  671. // CGImageProperties to XMP. For example, setting Exif DateTimeOriginal will
  672. // set the value of the corresponding XMP tag, which is photoshop:DateCreated
  673. // ****************************************************************************
  674. //{! @functiongroup Working with CGImageProperties }
  675. {!
  676. * @function CGImageMetadataCopyTagMatchingImageProperty
  677. * @abstract Searches for a specific CGImageMetadataTag matching a kCGImageProperty constant
  678. * @discussion Provides a bridge for values from CGImageCopyPropertiesAtIndex, simplifying
  679. * access for properties defined in EXIF and IPTC standards, which have no notion of
  680. * namespaces, prefixes, or XMP property types.
  681. * Metadata Working Group guidance is factored into the mapping of CGImageProperties to
  682. * XMP compatible CGImageMetadataTags.
  683. * For example, kCGImagePropertyExifDateTimeOriginal will get the value of the
  684. * corresponding XMP tag, which is photoshop:DateCreated. Note that property values will
  685. * still be in their XMP forms, such as "YYYY-MM-DDThh:mm:ss" for DateTime, rather than
  686. * the EXIF or IPTC DateTime formats.
  687. * @param metadata A collection of metadata tags
  688. * @param dictionaryName the metadata subdictionary to which the image property belongs,
  689. * such as kCGImagePropertyExifDictionary or kCGImagePropertyIPTCDictionary. Not all
  690. * dictionaries and properties are supported at this time.
  691. * @param propertyName the name of the property. This must be a defined property constant
  692. * corresponding to the 'dictionaryName'. For example, kCGImagePropertyTIFFOrientation,
  693. * kCGImagePropertyExifDateTimeOriginal, or kCGImagePropertyIPTCKeywords. A warning
  694. * will be logged if the CGImageProperty is unsupported by CGImageMetadata.
  695. * @return Returns a CGImageMetadataTagRef with the appropriate namespace, prefix,
  696. * tag name, and XMP value for the corresponding CGImageProperty. Returns NULL if the
  697. * property could not be found.
  698. }
  699. function CGImageMetadataCopyTagMatchingImageProperty( metadata: CGImageMetadataRef; dictionaryName: CFStringRef; propertyName: CFStringRef ): CGImageMetadataTagRef; external name '_CGImageMetadataCopyTagMatchingImageProperty';
  700. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  701. {!
  702. * @function CGImageMetadataSetValueMatchingImageProperty
  703. * @abstract Sets the value of the CGImageMetadataTag matching a kCGImageProperty constant
  704. * @discussion Provides a bridge for values from CGImageCopyPropertiesAtIndex, simplifying
  705. * changing property values defined in EXIF and IPTC standards, which have no notion of
  706. * namespaces, prefixes, or XMP property types.
  707. * Metadata Working Group guidance is factored into the mapping of CGImageProperties to
  708. * XMP compatible CGImageMetadataTags.
  709. * For example, setting kCGImagePropertyExifDateTimeOriginal will set the value of the
  710. * corresponding XMP tag, which is photoshop:DateCreated. Note that property values should
  711. * still be in their XMP forms, such as "YYYY-MM-DDThh:mm:ss" for DateTime, rather than
  712. * the EXIF or IPTC DateTime formats. Although this function will allow the caller to set
  713. * custom values for these properties, you should consult the appropriate specifications
  714. * for details about property value formats for EXIF and IPTC tags in XMP.
  715. * @param metadata A mutable collection of metadata tags
  716. * @param dictionaryName the metadata subdictionary to which the image property belongs,
  717. * such as kCGImagePropertyExifDictionary or kCGImagePropertyIPTCDictionary. Not all
  718. * dictionaries and properties are supported at this time.
  719. * @param propertyName the name of the property. This must be a defined property constant
  720. * corresponding to the 'dictionaryName'. For example, kCGImagePropertyTIFFOrientation,
  721. * kCGImagePropertyExifDateTimeOriginal, or kCGImagePropertyIPTCKeywords. A warning
  722. * will be logged if the CGImageProperty is unsupported by CGImageMetadata.
  723. * @param value A CFTypeRef with the value for the tag. The same value restrictions apply
  724. * as in @link CGImageMetadataTagCreate @/link.
  725. * @return Returns true if successful, false otherwise.
  726. }
  727. function CGImageMetadataSetValueMatchingImageProperty( metadata: CGMutableImageMetadataRef; dictionaryName: CFStringRef; propertyName: CFStringRef; value: CFTypeRef ): CBool; external name '_CGImageMetadataSetValueMatchingImageProperty';
  728. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  729. // ****************************************************************************
  730. // Functions for converting metadata to and from XMP packets
  731. // ****************************************************************************
  732. //{! @functiongroup Reading and Writing XMP }
  733. {!
  734. * @function CGImageMetadataCreateXMPData
  735. * @abstract Serializes the CGImageMetadataRef to XMP data
  736. * @discussion This converts all of the metadata tags to a block of XMP data. Common uses
  737. * include creating sidecar files that contain metadata for image formats that do not
  738. * support embedded XMP, or cannot be edited due to other format restrictions (such as
  739. * proprietary RAW camera formats).
  740. * @param metadata A collection of metadata tags.
  741. * @param options should be NULL. Options are currently not used, but may be used in
  742. * future release.
  743. * @return Returns a CFData containing an XMP representation of the metadata. Returns
  744. * NULL if an error occurred.
  745. }
  746. function CGImageMetadataCreateXMPData( metadata: CGImageMetadataRef; options: CFDictionaryRef ): CFDataRef; external name '_CGImageMetadataCreateXMPData';
  747. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  748. {!
  749. * @function CGImageMetadataCreateFromXMPData
  750. * @abstract Creates a collection of CGImageMetadataTags from a block of XMP data
  751. * @discussion Converts XMP data into a collection of metadata tags.
  752. * The data must be a complete XMP tree. XMP packet headers (<?xpacket .. ?>) are
  753. * supported.
  754. * @param data The XMP data.
  755. * @return Returns a collection of CGImageMetadata tags. Returns NULL if an error occurred.
  756. }
  757. function CGImageMetadataCreateFromXMPData( data: CFDataRef ): CGImageMetadataRef; external name '_CGImageMetadataCreateFromXMPData';
  758. (* IMAGEIO_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  759. {!
  760. * @constant kCFErrorDomainCGImageMetadata
  761. * @discussion Error domain for all errors originating in ImageIO for CGImageMetadata APIs.
  762. * Error codes may be interpreted using the list below.
  763. }
  764. var kCFErrorDomainCGImageMetadata: CFStringRef; external name '_kCFErrorDomainCGImageMetadata'; (* attribute const *)
  765. {!
  766. * @enum CGImageMetadataErrors
  767. * @discussion the list of all error codes returned under the error domain kCFErrorDomainCGImageMetadata
  768. }
  769. const
  770. kCGImageMetadataErrorUnknown = 0;
  771. kCGImageMetadataErrorUnsupportedFormat = 1;
  772. kCGImageMetadataErrorBadArgument = 2;
  773. kCGImageMetadataErrorConflictingArguments = 3;
  774. kCGImageMetadataErrorPrefixConflict = 4;
  775. type
  776. CGImageMetadataErrors = UInt32;
  777. {$endc} { TARGET_OS_MAC }
  778. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  779. end.
  780. {$endc} {not MACOSALLINCLUDE}