CGContext.pas 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178
  1. { CoreGraphics - CGContext.h
  2. * Copyright (c) 2000-2008 Apple Inc.
  3. * All rights reserved. }
  4. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  5. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  6. {
  7. Modified for use with Free Pascal
  8. Version 308
  9. Please report any bugs to <[email protected]>
  10. }
  11. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  12. {$mode macpas}
  13. {$packenum 1}
  14. {$macro on}
  15. {$inline on}
  16. {$calling mwpascal}
  17. unit CGContext;
  18. interface
  19. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  20. {$setc GAP_INTERFACES_VERSION := $0308}
  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 CPUPOWERPC32}
  31. {$setc __ppc__ := 1}
  32. {$elsec}
  33. {$setc __ppc__ := 0}
  34. {$endc}
  35. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  36. {$setc __ppc64__ := 1}
  37. {$elsec}
  38. {$setc __ppc64__ := 0}
  39. {$endc}
  40. {$ifc not defined __i386__ and defined CPUI386}
  41. {$setc __i386__ := 1}
  42. {$elsec}
  43. {$setc __i386__ := 0}
  44. {$endc}
  45. {$ifc not defined __x86_64__ and defined CPUX86_64}
  46. {$setc __x86_64__ := 1}
  47. {$elsec}
  48. {$setc __x86_64__ := 0}
  49. {$endc}
  50. {$ifc not defined __arm__ and defined CPUARM}
  51. {$setc __arm__ := 1}
  52. {$elsec}
  53. {$setc __arm__ := 0}
  54. {$endc}
  55. {$ifc defined cpu64}
  56. {$setc __LP64__ := 1}
  57. {$elsec}
  58. {$setc __LP64__ := 0}
  59. {$endc}
  60. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  61. {$error Conflicting definitions for __ppc__ and __i386__}
  62. {$endc}
  63. {$ifc defined __ppc__ and __ppc__}
  64. {$setc TARGET_CPU_PPC := TRUE}
  65. {$setc TARGET_CPU_PPC64 := FALSE}
  66. {$setc TARGET_CPU_X86 := FALSE}
  67. {$setc TARGET_CPU_X86_64 := FALSE}
  68. {$setc TARGET_CPU_ARM := FALSE}
  69. {$setc TARGET_OS_MAC := TRUE}
  70. {$setc TARGET_OS_IPHONE := FALSE}
  71. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  72. {$elifc defined __ppc64__ and __ppc64__}
  73. {$setc TARGET_CPU_PPC := FALSE}
  74. {$setc TARGET_CPU_PPC64 := TRUE}
  75. {$setc TARGET_CPU_X86 := FALSE}
  76. {$setc TARGET_CPU_X86_64 := FALSE}
  77. {$setc TARGET_CPU_ARM := FALSE}
  78. {$setc TARGET_OS_MAC := TRUE}
  79. {$setc TARGET_OS_IPHONE := FALSE}
  80. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  81. {$elifc defined __i386__ and __i386__}
  82. {$setc TARGET_CPU_PPC := FALSE}
  83. {$setc TARGET_CPU_PPC64 := FALSE}
  84. {$setc TARGET_CPU_X86 := TRUE}
  85. {$setc TARGET_CPU_X86_64 := FALSE}
  86. {$setc TARGET_CPU_ARM := FALSE}
  87. {$ifc defined(iphonesim)}
  88. {$setc TARGET_OS_MAC := FALSE}
  89. {$setc TARGET_OS_IPHONE := TRUE}
  90. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  91. {$elsec}
  92. {$setc TARGET_OS_MAC := TRUE}
  93. {$setc TARGET_OS_IPHONE := FALSE}
  94. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  95. {$endc}
  96. {$elifc defined __x86_64__ and __x86_64__}
  97. {$setc TARGET_CPU_PPC := FALSE}
  98. {$setc TARGET_CPU_PPC64 := FALSE}
  99. {$setc TARGET_CPU_X86 := FALSE}
  100. {$setc TARGET_CPU_X86_64 := TRUE}
  101. {$setc TARGET_CPU_ARM := FALSE}
  102. {$setc TARGET_OS_MAC := TRUE}
  103. {$setc TARGET_OS_IPHONE := FALSE}
  104. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  105. {$elifc defined __arm__ and __arm__}
  106. {$setc TARGET_CPU_PPC := FALSE}
  107. {$setc TARGET_CPU_PPC64 := FALSE}
  108. {$setc TARGET_CPU_X86 := FALSE}
  109. {$setc TARGET_CPU_X86_64 := FALSE}
  110. {$setc TARGET_CPU_ARM := TRUE}
  111. { will require compiler define when/if other Apple devices with ARM cpus ship }
  112. {$setc TARGET_OS_MAC := FALSE}
  113. {$setc TARGET_OS_IPHONE := TRUE}
  114. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  115. {$elsec}
  116. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
  117. {$endc}
  118. {$ifc defined __LP64__ and __LP64__ }
  119. {$setc TARGET_CPU_64 := TRUE}
  120. {$elsec}
  121. {$setc TARGET_CPU_64 := FALSE}
  122. {$endc}
  123. {$ifc defined FPC_BIG_ENDIAN}
  124. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  125. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  126. {$elifc defined FPC_LITTLE_ENDIAN}
  127. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  128. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  129. {$elsec}
  130. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  131. {$endc}
  132. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  133. {$setc CALL_NOT_IN_CARBON := FALSE}
  134. {$setc OLDROUTINENAMES := FALSE}
  135. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  136. {$setc OPAQUE_UPP_TYPES := TRUE}
  137. {$setc OTCARBONAPPLICATION := TRUE}
  138. {$setc OTKERNEL := FALSE}
  139. {$setc PM_USE_SESSION_APIS := TRUE}
  140. {$setc TARGET_API_MAC_CARBON := TRUE}
  141. {$setc TARGET_API_MAC_OS8 := FALSE}
  142. {$setc TARGET_API_MAC_OSX := TRUE}
  143. {$setc TARGET_CARBON := TRUE}
  144. {$setc TARGET_CPU_68K := FALSE}
  145. {$setc TARGET_CPU_MIPS := FALSE}
  146. {$setc TARGET_CPU_SPARC := FALSE}
  147. {$setc TARGET_OS_UNIX := FALSE}
  148. {$setc TARGET_OS_WIN32 := FALSE}
  149. {$setc TARGET_RT_MAC_68881 := FALSE}
  150. {$setc TARGET_RT_MAC_CFM := FALSE}
  151. {$setc TARGET_RT_MAC_MACHO := TRUE}
  152. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  153. {$setc TYPE_BOOL := FALSE}
  154. {$setc TYPE_EXTENDED := FALSE}
  155. {$setc TYPE_LONGLONG := TRUE}
  156. uses MacTypes,CFBase,CGGeometry,CGBase,CFDictionary,CGAffineTransforms,CGColorSpace,CGFont,CGGradient,CGImage,CGPDFDocument,CGPath,CGColor,CGShading,CGPDFPage;
  157. {$endc} {not MACOSALLINCLUDE}
  158. {$ALIGN POWER}
  159. type
  160. CGContextRef = ^SInt32; { an opaque type }
  161. { Line join styles. }
  162. type
  163. CGLineJoin = SInt32;
  164. const
  165. kCGLineJoinMiter = 0;
  166. kCGLineJoinRound = 1;
  167. kCGLineJoinBevel = 2;
  168. { Line cap styles. }
  169. type
  170. CGLineCap = SInt32;
  171. const
  172. kCGLineCapButt = 0;
  173. kCGLineCapRound = 1;
  174. kCGLineCapSquare = 2;
  175. { Drawing modes for paths. }
  176. type
  177. CGPathDrawingMode = SInt32;
  178. const
  179. kCGPathFill = 0;
  180. kCGPathEOFill = 1;
  181. kCGPathStroke = 2;
  182. kCGPathFillStroke = 3;
  183. kCGPathEOFillStroke = 4;
  184. { Drawing modes for text. }
  185. type
  186. CGTextDrawingMode = SInt32;
  187. const
  188. kCGTextFill = 0;
  189. kCGTextStroke = 1;
  190. kCGTextFillStroke = 2;
  191. kCGTextInvisible = 3;
  192. kCGTextFillClip = 4;
  193. kCGTextStrokeClip = 5;
  194. kCGTextFillStrokeClip = 6;
  195. kCGTextClip = 7;
  196. { Text encodings. }
  197. type
  198. CGTextEncoding = SInt32;
  199. const
  200. kCGEncodingFontSpecific = 0;
  201. kCGEncodingMacRoman = 1;
  202. { Interpolation quality. }
  203. type
  204. CGInterpolationQuality = SInt32;
  205. const
  206. kCGInterpolationDefault = 0; { Let the context decide. }
  207. kCGInterpolationNone = 1; { Never interpolate. }
  208. kCGInterpolationLow = 2; { Low quality, fast interpolation. }
  209. kCGInterpolationMedium = 4; { Medium quality, slower than kCGInterpolationLow. Available in Mac OS X 10.6 & later. }
  210. kCGInterpolationHigh = 3; { Highest quality, slower than kCGInterpolationMedium. }
  211. { Blend modes.
  212. The blend modes from kCGBlendModeNormal to kCGBlendModeLuminosity are
  213. supported in Mac OS X 10.4 and later. The Porter-Duff blend modes (from
  214. kCGBlendModeClear to kCGBlendModePlusLighter) are supported in Mac OS X
  215. 10.5 and later. The names of the Porter-Duff blend modes are historical.
  216. Note that the Porter-Duff blend modes are not necessarily supported in
  217. every context. In particular, they are only guaranteed to work in
  218. bitmap-based contexts, such as those created by CGBitmapContextCreate. It
  219. is your responsibility to make sure that they do what you want when you
  220. use them in a CGContext. }
  221. type
  222. CGBlendMode = SInt32;
  223. const
  224. { Available in Mac OS X 10.4 & later. }
  225. kCGBlendModeNormal = 0;
  226. kCGBlendModeMultiply = 1;
  227. kCGBlendModeScreen = 2;
  228. kCGBlendModeOverlay = 3;
  229. kCGBlendModeDarken = 4;
  230. kCGBlendModeLighten = 5;
  231. kCGBlendModeColorDodge = 6;
  232. kCGBlendModeColorBurn = 7;
  233. kCGBlendModeSoftLight = 8;
  234. kCGBlendModeHardLight = 9;
  235. kCGBlendModeDifference = 10;
  236. kCGBlendModeExclusion = 11;
  237. kCGBlendModeHue = 12;
  238. kCGBlendModeSaturation = 13;
  239. kCGBlendModeColor = 14;
  240. kCGBlendModeLuminosity = 15;
  241. { Available in Mac OS X 10.5 & later. R, S, and D are, respectively,
  242. premultiplied result, source, and destination colors with alpha; Ra,
  243. Sa, and Da are the alpha components of these colors.
  244. The Porter-Duff "source over" mode is called `kCGBlendModeNormal':
  245. R = S + D*(1 - Sa)
  246. Note that the Porter-Duff "XOR" mode is only titularly related to the
  247. classical bitmap XOR operation (which is unsupported by
  248. CoreGraphics). }
  249. kCGBlendModeClear = 16; { R = 0 }
  250. kCGBlendModeCopy = 17; { R = S }
  251. kCGBlendModeSourceIn = 18; { R = S*Da }
  252. kCGBlendModeSourceOut = 19; { R = S*(1 - Da) }
  253. kCGBlendModeSourceAtop = 20; { R = S*Da + D*(1 - Sa) }
  254. kCGBlendModeDestinationOver = 21; { R = S*(1 - Da) + D }
  255. kCGBlendModeDestinationIn = 22; { R = D*Sa }
  256. kCGBlendModeDestinationOut = 23; { R = D*(1 - Sa) }
  257. kCGBlendModeDestinationAtop = 24; { R = S*(1 - Da) + D*Sa }
  258. kCGBlendModeXOR = 25; { R = S*(1 - Da) + D*(1 - Sa) }
  259. kCGBlendModePlusDarker = 26; { R = MAX(0, (1 - D) + (1 - S)) }
  260. kCGBlendModePlusLighter = 27; { R = MIN(1, S + D) } { Available in Mac OS X 10.4 & later. }
  261. { Return the CFTypeID for CGContextRefs. }
  262. function CGContextGetTypeID: CFTypeID; external name '_CGContextGetTypeID';
  263. (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
  264. {* Graphics state functions. *}
  265. { Push a copy of the current graphics state onto the graphics state stack.
  266. Note that the path is not considered part of the graphics state, and is
  267. not saved. }
  268. procedure CGContextSaveGState( c: CGContextRef ); external name '_CGContextSaveGState';
  269. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  270. { Restore the current graphics state from the one on the top of the
  271. graphics state stack, popping the graphics state stack in the process. }
  272. procedure CGContextRestoreGState( c: CGContextRef ); external name '_CGContextRestoreGState';
  273. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  274. {* Coordinate space transformations. *}
  275. { Scale the current graphics state's transformation matrix (the CTM) by
  276. `(sx, sy)'. }
  277. procedure CGContextScaleCTM( c: CGContextRef; sx: CGFloat; sy: CGFloat ); external name '_CGContextScaleCTM';
  278. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  279. { Translate the current graphics state's transformation matrix (the CTM) by
  280. `(tx, ty)'. }
  281. procedure CGContextTranslateCTM( c: CGContextRef; tx: CGFloat; ty: CGFloat ); external name '_CGContextTranslateCTM';
  282. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  283. { Rotate the current graphics state's transformation matrix (the CTM) by
  284. `angle' radians. }
  285. procedure CGContextRotateCTM( c: CGContextRef; angle: CGFloat ); external name '_CGContextRotateCTM';
  286. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  287. { Concatenate the current graphics state's transformation matrix (the CTM)
  288. with the affine transform `transform'. }
  289. procedure CGContextConcatCTM( c: CGContextRef; transform: CGAffineTransform ); external name '_CGContextConcatCTM';
  290. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  291. { Return the current graphics state's transformation matrix. }
  292. function CGContextGetCTM( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetCTM';
  293. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  294. {* Drawing attribute functions. *}
  295. { Set the line width in the current graphics state to `width'. }
  296. procedure CGContextSetLineWidth( c: CGContextRef; width: CGFloat ); external name '_CGContextSetLineWidth';
  297. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  298. { Set the line cap in the current graphics state to `cap'. }
  299. procedure CGContextSetLineCap( c: CGContextRef; cap: CGLineCap ); external name '_CGContextSetLineCap';
  300. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  301. { Set the line join in the current graphics state to `join'. }
  302. procedure CGContextSetLineJoin( c: CGContextRef; join: CGLineJoin ); external name '_CGContextSetLineJoin';
  303. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  304. { Set the miter limit in the current graphics state to `limit'. }
  305. procedure CGContextSetMiterLimit( c: CGContextRef; limit: CGFloat ); external name '_CGContextSetMiterLimit';
  306. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  307. { Set the line dash patttern in the current graphics state of `c'. }
  308. procedure CGContextSetLineDash( c: CGContextRef; phase: CGFloat; {const} lengths: {variable-size-array} CGFloatPtr; count: size_t ); external name '_CGContextSetLineDash';
  309. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  310. { Set the path flatness parameter in the current graphics state of `c' to
  311. `flatness'. }
  312. procedure CGContextSetFlatness( c: CGContextRef; flatness: CGFloat ); external name '_CGContextSetFlatness';
  313. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  314. { Set the alpha value in the current graphics state of `c' to `alpha'. }
  315. procedure CGContextSetAlpha( c: CGContextRef; alpha: CGFloat ); external name '_CGContextSetAlpha';
  316. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  317. { Set the blend mode of `context' to `mode'. }
  318. procedure CGContextSetBlendMode( context: CGContextRef; mode: CGBlendMode ); external name '_CGContextSetBlendMode';
  319. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  320. {* Path construction functions. *}
  321. { Note that a context has a single path in use at any time: a path is not
  322. part of the graphics state. }
  323. { Begin a new path. The old path is discarded. }
  324. procedure CGContextBeginPath( c: CGContextRef ); external name '_CGContextBeginPath';
  325. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  326. { Start a new subpath at point `(x, y)' in the context's path. }
  327. procedure CGContextMoveToPoint( c: CGContextRef; x: CGFloat; y: CGFloat ); external name '_CGContextMoveToPoint';
  328. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  329. { Append a straight line segment from the current point to `(x, y)'. }
  330. procedure CGContextAddLineToPoint( c: CGContextRef; x: CGFloat; y: CGFloat ); external name '_CGContextAddLineToPoint';
  331. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  332. { Append a cubic Bezier curve from the current point to `(x,y)', with
  333. control points `(cp1x, cp1y)' and `(cp2x, cp2y)'. }
  334. procedure CGContextAddCurveToPoint( c: CGContextRef; cp1x: CGFloat; cp1y: CGFloat; cp2x: CGFloat; cp2y: CGFloat; x: CGFloat; y: CGFloat ); external name '_CGContextAddCurveToPoint';
  335. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  336. { Append a quadratic curve from the current point to `(x, y)', with control
  337. point `(cpx, cpy)'. }
  338. procedure CGContextAddQuadCurveToPoint( c: CGContextRef; cpx: CGFloat; cpy: CGFloat; x: CGFloat; y: CGFloat ); external name '_CGContextAddQuadCurveToPoint';
  339. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  340. { Close the current subpath of the context's path. }
  341. procedure CGContextClosePath( c: CGContextRef ); external name '_CGContextClosePath';
  342. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  343. {* Path construction convenience functions. *}
  344. { Add a single rect to the context's path. }
  345. procedure CGContextAddRect( c: CGContextRef; rect: CGRect ); external name '_CGContextAddRect';
  346. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  347. { Add a set of rects to the context's path. }
  348. procedure CGContextAddRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextAddRects';
  349. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  350. { Add a set of lines to the context's path. }
  351. procedure CGContextAddLines( c: CGContextRef; {const} points: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextAddLines';
  352. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  353. { Add an ellipse inside `rect' to the current path of `context'. See the
  354. function `CGPathAddEllipseInRect' for more information on how the path
  355. for the ellipse is constructed. }
  356. procedure CGContextAddEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextAddEllipseInRect';
  357. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  358. { Add an arc of a circle to the context's path, possibly preceded by a
  359. straight line segment. `(x, y)' is the center of the arc; `radius' is its
  360. radius; `startAngle' is the angle to the first endpoint of the arc;
  361. `endAngle' is the angle to the second endpoint of the arc; and
  362. `clockwise' is 1 if the arc is to be drawn clockwise, 0 otherwise.
  363. `startAngle' and `endAngle' are measured in radians. }
  364. procedure CGContextAddArc( c: CGContextRef; x: CGFloat; y: CGFloat; radius: CGFloat; startAngle: CGFloat; endAngle: CGFloat; clockwise: SInt32 ); external name '_CGContextAddArc';
  365. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  366. { Add an arc of a circle to the context's path, possibly preceded by a
  367. straight line segment. `radius' is the radius of the arc. The arc is
  368. tangent to the line from the current point to `(x1, y1)', and the line
  369. from `(x1, y1)' to `(x2, y2)'. }
  370. procedure CGContextAddArcToPoint( c: CGContextRef; x1: CGFloat; y1: CGFloat; x2: CGFloat; y2: CGFloat; radius: CGFloat ); external name '_CGContextAddArcToPoint';
  371. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  372. { Add `path' to the path of context. The points in `path' are transformed
  373. by the CTM of context before they are added. }
  374. procedure CGContextAddPath( context: CGContextRef; path: CGPathRef ); external name '_CGContextAddPath';
  375. (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
  376. {* Path stroking. *}
  377. { Replace the path in `context' with the stroked version of the path, using
  378. the parameters of `context' to calculate the stroked path. The resulting
  379. path is created such that filling it with the appropriate color will
  380. produce the same results as stroking the original path. You can use this
  381. path in the same way you can use the path of any context; for example,
  382. you can clip to the stroked version of a path by calling this function
  383. followed by a call to "CGContextClip". }
  384. procedure CGContextReplacePathWithStrokedPath( c: CGContextRef ); external name '_CGContextReplacePathWithStrokedPath';
  385. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  386. {* Path information functions. *}
  387. { Return true if the path of `context' contains no elements, false
  388. otherwise. }
  389. function CGContextIsPathEmpty( context: CGContextRef ): CBool; external name '_CGContextIsPathEmpty';
  390. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  391. { Return the current point of the current subpath of the path of
  392. `context'. }
  393. function CGContextGetPathCurrentPoint( context: CGContextRef ): CGPoint; external name '_CGContextGetPathCurrentPoint';
  394. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  395. { Return the bounding box of the path of `context'. The bounding box is the
  396. smallest rectangle completely enclosing all points in the path, including
  397. control points for Bezier and quadratic curves. }
  398. function CGContextGetPathBoundingBox( context: CGContextRef ): CGRect; external name '_CGContextGetPathBoundingBox';
  399. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  400. { Return a copy of the path of `context'. The returned path is specified in
  401. the current user space of `context'. }
  402. function CGContextCopyPath( context: CGContextRef ): CGPathRef; external name '_CGContextCopyPath';
  403. (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
  404. { Return true if `point' is contained in the current path of `context'. A
  405. point is contained within a context's path if it is inside the painted
  406. region when the path is stroked or filled with opaque colors using the
  407. path drawing mode `mode'. `point' is specified is user space. }
  408. function CGContextPathContainsPoint( context: CGContextRef; point: CGPoint; mode: CGPathDrawingMode ): CBool; external name '_CGContextPathContainsPoint';
  409. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  410. {* Path drawing functions. *}
  411. { Draw the context's path using drawing mode `mode'. }
  412. procedure CGContextDrawPath( c: CGContextRef; mode: CGPathDrawingMode ); external name '_CGContextDrawPath';
  413. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  414. {* Path drawing convenience functions. *}
  415. { Fill the context's path using the winding-number fill rule. Any open
  416. subpath of the path is implicitly closed. }
  417. procedure CGContextFillPath( c: CGContextRef ); external name '_CGContextFillPath';
  418. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  419. { Fill the context's path using the even-odd fill rule. Any open subpath of
  420. the path is implicitly closed. }
  421. procedure CGContextEOFillPath( c: CGContextRef ); external name '_CGContextEOFillPath';
  422. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  423. { Stroke the context's path. }
  424. procedure CGContextStrokePath( c: CGContextRef ); external name '_CGContextStrokePath';
  425. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  426. { Fill `rect' with the current fill color. }
  427. procedure CGContextFillRect( c: CGContextRef; rect: CGRect ); external name '_CGContextFillRect';
  428. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  429. { Fill `rects', an array of `count' CGRects, with the current fill
  430. color. }
  431. procedure CGContextFillRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextFillRects';
  432. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  433. { Stroke `rect' with the current stroke color and the current linewidth. }
  434. procedure CGContextStrokeRect( c: CGContextRef; rect: CGRect ); external name '_CGContextStrokeRect';
  435. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  436. { Stroke `rect' with the current stroke color, using `width' as the the
  437. line width. }
  438. procedure CGContextStrokeRectWithWidth( c: CGContextRef; rect: CGRect; width: CGFloat ); external name '_CGContextStrokeRectWithWidth';
  439. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  440. { Clear `rect' (that is, set the region within the rect to transparent). }
  441. procedure CGContextClearRect( c: CGContextRef; rect: CGRect ); external name '_CGContextClearRect';
  442. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  443. { Fill an ellipse (an oval) inside `rect'. }
  444. procedure CGContextFillEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextFillEllipseInRect';
  445. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  446. { Stroke an ellipse (an oval) inside `rect'. }
  447. procedure CGContextStrokeEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextStrokeEllipseInRect';
  448. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  449. { Stroke a sequence of line segments one after another in `context'. The
  450. line segments are specified by `points', an array of `count' CGPoints.
  451. This function is equivalent to
  452. CGContextBeginPath(context);
  453. for (k = 0; k < count; k += 2) begin
  454. CGContextMoveToPoint(context, s[k].x, s[k].y);
  455. CGContextAddLineToPoint(context, s[k+1].x, s[k+1].y);
  456. end;
  457. CGContextStrokePath(context); }
  458. procedure CGContextStrokeLineSegments( c: CGContextRef; {const} points: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextStrokeLineSegments';
  459. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  460. {* Clipping functions. *}
  461. { Intersect the context's path with the current clip path and use the
  462. resulting path as the clip path for subsequent rendering operations. Use
  463. the winding-number fill rule for deciding what's inside the path. }
  464. procedure CGContextClip( c: CGContextRef ); external name '_CGContextClip';
  465. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  466. { Intersect the context's path with the current clip path and use the
  467. resulting path as the clip path for subsequent rendering operations. Use
  468. the even-odd fill rule for deciding what's inside the path. }
  469. procedure CGContextEOClip( c: CGContextRef ); external name '_CGContextEOClip';
  470. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  471. { Add `mask' transformed to `rect' to the clipping area of `context'. The
  472. mask, which may be either an image mask or an image, is mapped into the
  473. specified rectangle and intersected with the current clipping area of the
  474. context.
  475. If `mask' is an image mask, then it clips in a manner identical to the
  476. behavior if it were used with "CGContextDrawImage": it indicates an area
  477. to be masked out (left unchanged) when drawing. The source samples of the
  478. image mask determine which points of the clipping area are changed,
  479. acting as an "inverse alpha": if the value of a source sample in the
  480. image mask is S, then the corresponding point in the current clipping
  481. area will be multiplied by an alpha of (1-S). (For example, if S is 1,
  482. then the point in the clipping area becomes clear, while if S is 0, the
  483. point in the clipping area is unchanged.
  484. If `mask' is an image, then it serves as alpha mask and is blended with
  485. the current clipping area. The source samples of mask determine which
  486. points of the clipping area are changed: if the value of the source
  487. sample in mask is S, then the corresponding point in the current clipping
  488. area will be multiplied by an alpha of S. (For example, if S is 0, then
  489. the point in the clipping area becomes clear, while if S is 1, the point
  490. in the clipping area is unchanged.
  491. If `mask' is an image, then it must be in the DeviceGray color space, may
  492. not have alpha, and may not be masked by an image mask or masking
  493. color. }
  494. procedure CGContextClipToMask( c: CGContextRef; rect: CGRect; mask: CGImageRef ); external name '_CGContextClipToMask';
  495. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  496. { Return the bounding box of the clip path of `c' in user space. The
  497. bounding box is the smallest rectangle completely enclosing all points in
  498. the clip. }
  499. function CGContextGetClipBoundingBox( c: CGContextRef ): CGRect; external name '_CGContextGetClipBoundingBox';
  500. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  501. {* Clipping convenience functions. *}
  502. { Intersect the current clipping path with `rect'. Note that this function
  503. resets the context's path to the empty path. }
  504. procedure CGContextClipToRect( c: CGContextRef; rect: CGRect ); external name '_CGContextClipToRect';
  505. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  506. { Intersect the current clipping path with the clipping region formed by
  507. creating a path consisting of all rects in `rects'. Note that this
  508. function resets the context's path to the empty path. }
  509. procedure CGContextClipToRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextClipToRects';
  510. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  511. {* Primitive color functions. *}
  512. { Set the current fill color in the context `c' to `color'. }
  513. procedure CGContextSetFillColorWithColor( c: CGContextRef; color: CGColorRef ); external name '_CGContextSetFillColorWithColor';
  514. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  515. { Set the current stroke color in the context `c' to `color'. }
  516. procedure CGContextSetStrokeColorWithColor( c: CGContextRef; color: CGColorRef ); external name '_CGContextSetStrokeColorWithColor';
  517. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  518. {* Color space functions. *}
  519. { Set the current fill color space in `context' to `space'. As a
  520. side-effect, set the fill color to a default value appropriate for the
  521. color space. }
  522. procedure CGContextSetFillColorSpace( context: CGContextRef; space: CGColorSpaceRef ); external name '_CGContextSetFillColorSpace';
  523. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  524. { Set the current stroke color space in `context' to `space'. As a
  525. side-effect, set the stroke color to a default value appropriate for the
  526. color space. }
  527. procedure CGContextSetStrokeColorSpace( context: CGContextRef; space: CGColorSpaceRef ); external name '_CGContextSetStrokeColorSpace';
  528. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  529. {* Color functions. *}
  530. { Set the components of the current fill color in `context' to the values
  531. specifed by `components'. The number of elements in `components' must be
  532. one greater than the number of components in the current fill color space
  533. (N color components + 1 alpha component). The current fill color space
  534. must not be a pattern color space. }
  535. procedure CGContextSetFillColor( context: CGContextRef; {const} components: {variable-size-array} CGFloatPtr ); external name '_CGContextSetFillColor';
  536. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  537. { Set the components of the current stroke color in `context' to the values
  538. specifed by `components'. The number of elements in `components' must be
  539. one greater than the number of components in the current stroke color
  540. space (N color components + 1 alpha component). The current stroke color
  541. space must not be a pattern color space. }
  542. procedure CGContextSetStrokeColor( context: CGContextRef; {const} components: {variable-size-array} CGFloatPtr ); external name '_CGContextSetStrokeColor';
  543. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  544. {* Pattern functions. *}
  545. { Set the components of the current fill color in `context' to the values
  546. specifed by `components', and set the current fill pattern to `pattern'.
  547. The number of elements in `components' must be one greater than the
  548. number of components in the current fill color space (N color components
  549. + 1 alpha component). The current fill color space must be a pattern
  550. color space. }
  551. procedure CGContextSetFillPattern( context: CGContextRef; pattern: CGPatternRef; {const} components: {variable-size-array} CGFloatPtr ); external name '_CGContextSetFillPattern';
  552. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  553. { Set the components of the current stroke color in `context' to the values
  554. specifed by `components', and set the current stroke pattern to
  555. `pattern'. The number of elements in `components' must be one greater
  556. than the number of components in the current stroke color space (N color
  557. components + 1 alpha component). The current stroke color space must be a
  558. pattern color space. }
  559. procedure CGContextSetStrokePattern( context: CGContextRef; pattern: CGPatternRef; {const} components: {variable-size-array} CGFloatPtr ); external name '_CGContextSetStrokePattern';
  560. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  561. { Set the pattern phase in the current graphics state of `context' to
  562. `phase'. }
  563. procedure CGContextSetPatternPhase( context: CGContextRef; phase: CGSize ); external name '_CGContextSetPatternPhase';
  564. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  565. {* Color convenience functions. *}
  566. { Set the current fill color space in `context' to `DeviceGray' and set the
  567. components of the current fill color to `(gray, alpha)'. }
  568. procedure CGContextSetGrayFillColor( context: CGContextRef; gray: CGFloat; alpha: CGFloat ); external name '_CGContextSetGrayFillColor';
  569. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  570. { Set the current stroke color space in `context' to `DeviceGray' and set
  571. the components of the current stroke color to `(gray, alpha)'. }
  572. procedure CGContextSetGrayStrokeColor( context: CGContextRef; gray: CGFloat; alpha: CGFloat ); external name '_CGContextSetGrayStrokeColor';
  573. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  574. { Set the current fill color space in `context' to `DeviceRGB' and set the
  575. components of the current fill color to `(red, green, blue, alpha)'. }
  576. procedure CGContextSetRGBFillColor( context: CGContextRef; red: CGFloat; green: CGFloat; blue: CGFloat; alpha: CGFloat ); external name '_CGContextSetRGBFillColor';
  577. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  578. { Set the current stroke color space in `context' to `DeviceRGB' and set
  579. the components of the current stroke color to `(red, green, blue,
  580. alpha)'. }
  581. procedure CGContextSetRGBStrokeColor( context: CGContextRef; red: CGFloat; green: CGFloat; blue: CGFloat; alpha: CGFloat ); external name '_CGContextSetRGBStrokeColor';
  582. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  583. { Set the current fill color space in `context' to `DeviceCMYK' and set the
  584. components of the current fill color to `(cyan, magenta, yellow, black,
  585. alpha)'. }
  586. procedure CGContextSetCMYKFillColor( context: CGContextRef; cyan: CGFloat; magenta: CGFloat; yellow: CGFloat; black: CGFloat; alpha: CGFloat ); external name '_CGContextSetCMYKFillColor';
  587. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  588. { Set the current stroke color space in `context' to `DeviceCMYK' and set
  589. the components of the current stroke color to `(cyan, magenta, yellow,
  590. black, alpha)'. }
  591. procedure CGContextSetCMYKStrokeColor( context: CGContextRef; cyan: CGFloat; magenta: CGFloat; yellow: CGFloat; black: CGFloat; alpha: CGFloat ); external name '_CGContextSetCMYKStrokeColor';
  592. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  593. {* Rendering intent. *}
  594. { Set the rendering intent in the current graphics state of `context' to
  595. `intent'. }
  596. procedure CGContextSetRenderingIntent( context: CGContextRef; intent: CGColorRenderingIntent ); external name '_CGContextSetRenderingIntent';
  597. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  598. {* Image functions. *}
  599. { Draw `image' in the rectangular area specified by `rect' in the context
  600. `c'. The image is scaled, if necessary, to fit into `rect'. }
  601. procedure CGContextDrawImage( c: CGContextRef; rect: CGRect; image: CGImageRef ); external name '_CGContextDrawImage';
  602. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  603. { Draw `image' tiled in the context `c'. The image is scaled to the size
  604. specified by `rect' in user space, positioned at the origin of `rect' in
  605. user space, then replicated, stepping the width of `rect' horizontally
  606. and the height of `rect' vertically, to fill the current clip region.
  607. Unlike patterns, the image is tiled in user space, so transformations
  608. applied to the CTM affect the final result. }
  609. procedure CGContextDrawTiledImage( c: CGContextRef; rect: CGRect; image: CGImageRef ); external name '_CGContextDrawTiledImage';
  610. (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  611. { Return the interpolation quality for image rendering of `context'. The
  612. interpolation quality is a gstate parameter which controls the level of
  613. interpolation performed when an image is interpolated (for example, when
  614. scaling the image). Note that it is merely a hint to the context: not all
  615. contexts support all interpolation quality levels. }
  616. function CGContextGetInterpolationQuality( context: CGContextRef ): CGInterpolationQuality; external name '_CGContextGetInterpolationQuality';
  617. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  618. { Set the interpolation quality of `context' to `quality'. }
  619. procedure CGContextSetInterpolationQuality( context: CGContextRef; quality: CGInterpolationQuality ); external name '_CGContextSetInterpolationQuality';
  620. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  621. {* Shadow support. *}
  622. { Set the shadow parameters in `context'. `offset' specifies a translation
  623. in base-space; `blur' is a non-negative number specifying the amount of
  624. blur; `color' specifies the color of the shadow, which may contain a
  625. non-opaque alpha value. If `color' is NULL, it's equivalent to specifying
  626. a fully transparent color. The shadow is a gstate parameter. After a
  627. shadow is specified, all objects drawn subsequently will be shadowed. To
  628. turn off shadowing, set the shadow color to a fully transparent color (or
  629. pass NULL as the color), or use the standard gsave/grestore mechanism. }
  630. procedure CGContextSetShadowWithColor( context: CGContextRef; offset: CGSize; blur: CGFloat; color: CGColorRef ); external name '_CGContextSetShadowWithColor';
  631. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  632. { Equivalent to calling
  633. CGContextSetShadowWithColor(context, offset, blur, color)
  634. where color is black with 1/3 alpha (i.e., RGBA = (0, 0, 0, 1.0/3.0)) in
  635. the DeviceRGB color space. }
  636. procedure CGContextSetShadow( context: CGContextRef; offset: CGSize; blur: CGFloat ); external name '_CGContextSetShadow';
  637. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  638. {* Gradient and shading functions. *}
  639. { Fill the current clipping region of `context' with a linear gradient from
  640. `startPoint' to `endPoint'. The location 0 of `gradient' corresponds to
  641. `startPoint'; the location 1 of `gradient' corresponds to `endPoint';
  642. colors are linearly interpolated between these two points based on the
  643. values of the gradient's locations. The option flags control whether the
  644. gradient is drawn before the start point or after the end point. }
  645. procedure CGContextDrawLinearGradient( context: CGContextRef; gradient: CGGradientRef; startPoint: CGPoint; endPoint: CGPoint; options: CGGradientDrawingOptions ); external name '_CGContextDrawLinearGradient';
  646. (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  647. { Fill the current clipping region of `context' with a radial gradient
  648. between two circles defined by the center point and radius of each
  649. circle. The location 0 of `gradient' corresponds to a circle centered at
  650. `startCenter' with radius `startRadius'; the location 1 of `gradient'
  651. corresponds to a circle centered at `endCenter' with radius `endRadius';
  652. colors are linearly interpolated between these two circles based on the
  653. values of the gradient's locations. The option flags control whether the
  654. gradient is drawn before the start circle or after the end circle. }
  655. procedure CGContextDrawRadialGradient( context: CGContextRef; gradient: CGGradientRef; startCenter: CGPoint; startRadius: CGFloat; endCenter: CGPoint; endRadius: CGFloat; options: CGGradientDrawingOptions ); external name '_CGContextDrawRadialGradient';
  656. (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  657. { Fill the current clipping region of `context' with `shading'. }
  658. procedure CGContextDrawShading( context: CGContextRef; shading: CGShadingRef ); external name '_CGContextDrawShading';
  659. (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
  660. {* Text functions. *}
  661. { Set the current character spacing in `context' to `spacing'. The
  662. character spacing is added to the displacement between the origin of one
  663. character and the origin of the next. }
  664. procedure CGContextSetCharacterSpacing( context: CGContextRef; spacing: CGFloat ); external name '_CGContextSetCharacterSpacing';
  665. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  666. { Set the user-space point at which text will be drawn in the context `c'
  667. to `(x, y)'. }
  668. procedure CGContextSetTextPosition( c: CGContextRef; x: CGFloat; y: CGFloat ); external name '_CGContextSetTextPosition';
  669. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  670. { Return the user-space point at which text will be drawn in `context'. }
  671. function CGContextGetTextPosition( context: CGContextRef ): CGPoint; external name '_CGContextGetTextPosition';
  672. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  673. { Set the text matrix in the context `c' to `t'. }
  674. procedure CGContextSetTextMatrix( c: CGContextRef; t: CGAffineTransform ); external name '_CGContextSetTextMatrix';
  675. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  676. { Return the text matrix in the context `c'. }
  677. function CGContextGetTextMatrix( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetTextMatrix';
  678. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  679. { Set the text drawing mode in the current graphics state of the context
  680. `c' to `mode'. }
  681. procedure CGContextSetTextDrawingMode( c: CGContextRef; mode: CGTextDrawingMode ); external name '_CGContextSetTextDrawingMode';
  682. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  683. { Set the font in the current graphics state of the context `c' to
  684. `font'. }
  685. procedure CGContextSetFont( c: CGContextRef; font: CGFontRef ); external name '_CGContextSetFont';
  686. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  687. { Set the font size in the current graphics state of the context `c' to
  688. `size'. }
  689. procedure CGContextSetFontSize( c: CGContextRef; size: CGFloat ); external name '_CGContextSetFontSize';
  690. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  691. { Attempts to find the font named `name' and, if successful, sets it as the
  692. font in the current graphics state of `c' and sets the font size in the
  693. current graphics state to `size'. `textEncoding' specifies how to
  694. translate from bytes to glyphs when displaying text. }
  695. procedure CGContextSelectFont( c: CGContextRef; name: ConstCStringPtr; size: CGFloat; textEncoding: CGTextEncoding ); external name '_CGContextSelectFont';
  696. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  697. { Draw `glyphs', an array of `count' CGGlyphs, at the points specified by
  698. `positions'. Each element of `positions' specifies the position from the
  699. associated glyph; the positions are specified in user space. }
  700. procedure CGContextShowGlyphsAtPositions( context: CGContextRef; {const} glyphs: {variable-size-array} CGGlyphPtr; {const} positions: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextShowGlyphsAtPositions';
  701. (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  702. {* Text convenience functions. *}
  703. { Draw `string', a string of `length' bytes, at the point specified by the
  704. text matrix in the context `c'. Each byte of the string is mapped through
  705. the encoding vector of the current font to obtain the glyph to
  706. display. }
  707. procedure CGContextShowText( c: CGContextRef; strng: ConstCStringPtr; length: size_t ); external name '_CGContextShowText';
  708. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  709. { Draw `string', a string of `length' bytes, at the point `(x, y)',
  710. specified in user space, in the context `c'. Each byte of the string is
  711. mapped through the encoding vector of the current font to obtain the
  712. glyph to display. }
  713. procedure CGContextShowTextAtPoint( c: CGContextRef; x: CGFloat; y: CGFloat; strng: ConstCStringPtr; length: size_t ); external name '_CGContextShowTextAtPoint';
  714. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  715. { Draw the glyphs pointed to by `g', an array of `count' glyphs, at the
  716. point specified by the text matrix in the context `c'. }
  717. procedure CGContextShowGlyphs( c: CGContextRef; {const} g: {variable-size-array} CGGlyphPtr; count: size_t ); external name '_CGContextShowGlyphs';
  718. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  719. { Display the glyphs pointed to by `glyphs', an array of `count' glyphs, at
  720. the point `(x, y)', specified in user space, in `context'. }
  721. procedure CGContextShowGlyphsAtPoint( context: CGContextRef; x: CGFloat; y: CGFloat; {const} glyphs: {variable-size-array} CGGlyphPtr; count: size_t ); external name '_CGContextShowGlyphsAtPoint';
  722. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  723. { Draw `glyphs', an array of `count' CGGlyphs, at the current point
  724. specified by the text matrix. Each element of `advances' specifies the
  725. offset from the previous glyph's origin to the origin of the associated
  726. glyph; the advances are specified in user space. }
  727. procedure CGContextShowGlyphsWithAdvances( c: CGContextRef; {const} glyphs: {variable-size-array} CGGlyphPtr; {const} advances: {variable-size-array} CGSizePtr; count: size_t ); external name '_CGContextShowGlyphsWithAdvances';
  728. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  729. {* PDF functions. *}
  730. { Draw `page' in the current user space of the context `c'. }
  731. procedure CGContextDrawPDFPage( c: CGContextRef; page: CGPDFPageRef ); external name '_CGContextDrawPDFPage';
  732. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  733. {$ifc TARGET_OS_MAC}
  734. { DEPRECATED; use the CGPDFPage API instead.
  735. * Draw `page' in `document' in the rectangular area specified by `rect' in
  736. * the context `c'. The media box of the page is scaled, if necessary, to
  737. * fit into `rect'. }
  738. procedure CGContextDrawPDFDocument( c: CGContextRef; rect: CGRect; document: CGPDFDocumentRef; page: SInt32 ); external name '_CGContextDrawPDFDocument';
  739. {$endc}
  740. {* Output page functions. *}
  741. { Begin a new page. }
  742. procedure CGContextBeginPage( c: CGContextRef; const (*var*) mediaBox: CGRect ); external name '_CGContextBeginPage';
  743. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  744. { End the current page. }
  745. procedure CGContextEndPage( c: CGContextRef ); external name '_CGContextEndPage';
  746. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  747. {* Context functions. *}
  748. { Equivalent to `CFRetain(c)'. }
  749. function CGContextRetain( c: CGContextRef ): CGContextRef; external name '_CGContextRetain';
  750. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  751. { Equivalent to `CFRelease(c)'. }
  752. procedure CGContextRelease( c: CGContextRef ); external name '_CGContextRelease';
  753. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  754. { Flush all drawing to the destination. }
  755. procedure CGContextFlush( c: CGContextRef ); external name '_CGContextFlush';
  756. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  757. { Synchronized drawing. }
  758. procedure CGContextSynchronize( c: CGContextRef ); external name '_CGContextSynchronize';
  759. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  760. {* Antialiasing functions. *}
  761. { Turn on antialiasing if `shouldAntialias' is true; turn it off otherwise.
  762. This parameter is part of the graphics state. }
  763. procedure CGContextSetShouldAntialias( context: CGContextRef; shouldAntialias: CBool ); external name '_CGContextSetShouldAntialias';
  764. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  765. { Allow antialiasing in `context' if `allowsAntialiasing' is true; don't
  766. allow it otherwise. This parameter is not part of the graphics state. A
  767. context will perform antialiasing if both `allowsAntialiasing' and the
  768. graphics state parameter `shouldAntialias' are true. }
  769. procedure CGContextSetAllowsAntialiasing( context: CGContextRef; allowsAntialiasing: CBool ); external name '_CGContextSetAllowsAntialiasing';
  770. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  771. {* Font display functions. *}
  772. { Turn on font smoothing if `shouldSmoothFonts' is true; turn it off
  773. otherwise. This parameter is part of the graphics state. Note that this
  774. doesn't guarantee that font smoothing will occur: not all destination
  775. contexts support font smoothing. }
  776. procedure CGContextSetShouldSmoothFonts( context: CGContextRef; shouldSmoothFonts: CBool ); external name '_CGContextSetShouldSmoothFonts';
  777. (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
  778. { If `allowsFontSmoothing' is true, then allow font smoothing when
  779. displaying text in `context'; otherwise, don't allow font smoothing. This
  780. parameter is not part of the graphics state. Fonts will be smoothed if
  781. they are antialiased when drawn and if both `allowsFontSmoothing' and the
  782. graphics state parameter `shouldSmoothFonts' are true. }
  783. procedure CGContextSetAllowsFontSmoothing( context: CGContextRef; allowsFontSmoothing: CBool ); external name '_CGContextSetAllowsFontSmoothing';
  784. (* CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0) *)
  785. { If `shouldSubpixelPositionFonts' is true, then glyphs may be placed at
  786. subpixel positions (if allowed) when displaying text in `context';
  787. otherwise, glyphs will be forced to integer pixel boundaries. This
  788. parameter is part of the graphics state. }
  789. procedure CGContextSetShouldSubpixelPositionFonts( context: CGContextRef; shouldSubpixelPositionFonts: CBool ); external name '_CGContextSetShouldSubpixelPositionFonts';
  790. (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  791. { If `allowsFontSubpixelPositioning' is true, then allow font subpixel
  792. positioning when displaying text in `context'; otherwise, don't allow
  793. subpixel positioning. This parameter is not part of the graphics state. A
  794. context will place glyphs at subpixel positions if fonts will be
  795. antialiased when drawn and if both `allowsFontSubpixelPositioning' and
  796. the graphics state parameter `shouldSubpixelPositionFonts' are true. }
  797. procedure CGContextSetAllowsFontSubpixelPositioning( context: CGContextRef; allowsFontSubpixelPositioning: CBool ); external name '_CGContextSetAllowsFontSubpixelPositioning';
  798. (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  799. { If `shouldSubpixelQuantizeFonts' is true, then quantize the subpixel
  800. positions of glyphs when displaying text in `context'; otherwise, don't
  801. quantize the subpixel positions. This parameter is part of the graphics
  802. state. }
  803. procedure CGContextSetShouldSubpixelQuantizeFonts( context: CGContextRef; shouldSubpixelQuantizeFonts: CBool ); external name '_CGContextSetShouldSubpixelQuantizeFonts';
  804. (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  805. { If `allowsFontSubpixelQuantization' is true, then allow font subpixel
  806. quantization when displaying text in `context'; otherwise, don't allow
  807. subpixel quantization. This parameter is not part of the graphics state.
  808. A context quantizes subpixel positions if glyphs will be drawn at
  809. subpixel positions and `allowsFontSubpixelQuantization' and the graphics
  810. state parameter `shouldSubpixelQuantizeFonts' are both true. }
  811. procedure CGContextSetAllowsFontSubpixelQuantization( context: CGContextRef; allowsFontSubpixelQuantization: CBool ); external name '_CGContextSetAllowsFontSubpixelQuantization';
  812. (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  813. {* Transparency layer support. *}
  814. { Begin a transparency layer in `context'. All subsequent drawing
  815. operations until a corresponding `CGContextEndTransparencyLayer' are
  816. composited into a fully transparent backdrop (which is treated as a
  817. separate destination buffer from the context). After the transparency
  818. layer is ended, the result is composited into the context using the
  819. global alpha and shadow state of the context. This operation respects the
  820. clipping region of the context. After a call to this function, all of the
  821. parameters in the graphics state remain unchanged with the exception of
  822. the following:
  823. - The global alpha is set to 1.
  824. - The shadow is turned off.
  825. - The blend mode is set to `kCGBlendModeNormal'.
  826. Ending the transparency layer restores these parameters to the values
  827. they had before `CGContextBeginTransparencyLayer' was called.
  828. Transparency layers may be nested. }
  829. procedure CGContextBeginTransparencyLayer( context: CGContextRef; auxiliaryInfo: CFDictionaryRef ); external name '_CGContextBeginTransparencyLayer';
  830. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  831. { Begin a transparency layer in `context'. This function is identical to
  832. `CGContextBeginTransparencyLayer' except that the content of the
  833. transparency layer will be bounded by `rect' (specified in user space). }
  834. procedure CGContextBeginTransparencyLayerWithRect( context: CGContextRef; rect: CGRect; auxiliaryInfo: CFDictionaryRef ); external name '_CGContextBeginTransparencyLayerWithRect';
  835. (* CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  836. { End a tranparency layer. }
  837. procedure CGContextEndTransparencyLayer( context: CGContextRef ); external name '_CGContextEndTransparencyLayer';
  838. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  839. {* User space to device space tranformations. *}
  840. { Return the affine transform mapping the user space (abstract coordinates)
  841. of `context' to device space (pixels). }
  842. function CGContextGetUserSpaceToDeviceSpaceTransform( context: CGContextRef ): CGAffineTransform; external name '_CGContextGetUserSpaceToDeviceSpaceTransform';
  843. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  844. { Transform `point' from the user space of `context' to device space. }
  845. function CGContextConvertPointToDeviceSpace( context: CGContextRef; point: CGPoint ): CGPoint; external name '_CGContextConvertPointToDeviceSpace';
  846. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  847. { Transform `point' from device space to the user space of `context'. }
  848. function CGContextConvertPointToUserSpace( context: CGContextRef; point: CGPoint ): CGPoint; external name '_CGContextConvertPointToUserSpace';
  849. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  850. { Transform `size' from the user space of `context' to device space. }
  851. function CGContextConvertSizeToDeviceSpace( context: CGContextRef; size: CGSize ): CGSize; external name '_CGContextConvertSizeToDeviceSpace';
  852. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  853. { Transform `size' from device space to the user space of `context'. }
  854. function CGContextConvertSizeToUserSpace( context: CGContextRef; size: CGSize ): CGSize; external name '_CGContextConvertSizeToUserSpace';
  855. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  856. { Transform `rect' from the user space of `context' to device space. Since
  857. affine transforms do not preserve rectangles in general, this function
  858. returns the smallest rectangle which contains the transformed corner
  859. points of `rect'. }
  860. function CGContextConvertRectToDeviceSpace( context: CGContextRef; rect: CGRect ): CGRect; external name '_CGContextConvertRectToDeviceSpace';
  861. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  862. { Transform `rect' from device space to the user space of `context'. Since
  863. affine transforms do not preserve rectangles in general, this function
  864. returns the smallest rectangle which contains the transformed corner
  865. points of `rect'. }
  866. function CGContextConvertRectToUserSpace( context: CGContextRef; rect: CGRect ): CGRect; external name '_CGContextConvertRectToUserSpace';
  867. (* CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  868. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  869. end.
  870. {$endc} {not MACOSALLINCLUDE}