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

1460 lines
36 KiB

  1. /*
  2. File: CGContext.h
  3. Contains: CoreGraphics context
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2000-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef CGCONTEXT_H_
  11. #define CGCONTEXT_H_
  12. #ifndef __CGBASE__
  13. #include <CGBase.h>
  14. #endif
  15. #ifndef __CGAFFINETRANSFORM__
  16. #include <CGAffineTransform.h>
  17. #endif
  18. #ifndef __CGCOLORSPACE__
  19. #include <CGColorSpace.h>
  20. #endif
  21. #ifndef __CGFONT__
  22. #include <CGFont.h>
  23. #endif
  24. #ifndef __CGIMAGE__
  25. #include <CGImage.h>
  26. #endif
  27. #ifndef __CGPDFDOCUMENT__
  28. #include <CGPDFDocument.h>
  29. #endif
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. #if PRAGMA_IMPORT
  37. #pragma import on
  38. #endif
  39. #if PRAGMA_ENUM_ALWAYSINT
  40. #if defined(__fourbyteints__) && !__fourbyteints__
  41. #define __CGCONTEXT__RESTORE_TWOBYTEINTS
  42. #pragma fourbyteints on
  43. #endif
  44. #pragma enumsalwaysint on
  45. #elif PRAGMA_ENUM_OPTIONS
  46. #pragma option enum=int
  47. #elif PRAGMA_ENUM_PACK
  48. #if __option(pack_enums)
  49. #define __CGCONTEXT__RESTORE_PACKED_ENUMS
  50. #pragma options(!pack_enums)
  51. #endif
  52. #endif
  53. typedef struct CGContext* CGContextRef;
  54. typedef struct CGPattern* CGPatternRef;
  55. /* Line join styles. */
  56. enum CGLineJoin {
  57. kCGLineJoinMiter = 0,
  58. kCGLineJoinRound = 1,
  59. kCGLineJoinBevel = 2
  60. };
  61. typedef enum CGLineJoin CGLineJoin;
  62. /* Line cap styles. */
  63. enum CGLineCap {
  64. kCGLineCapButt = 0,
  65. kCGLineCapRound = 1,
  66. kCGLineCapSquare = 2
  67. };
  68. typedef enum CGLineCap CGLineCap;
  69. /* Drawing modes for paths. */
  70. enum CGPathDrawingMode {
  71. kCGPathFill = 0,
  72. kCGPathEOFill = 1,
  73. kCGPathStroke = 2,
  74. kCGPathFillStroke = 3,
  75. kCGPathEOFillStroke = 4
  76. };
  77. typedef enum CGPathDrawingMode CGPathDrawingMode;
  78. /* Drawing modes for text. */
  79. enum CGTextDrawingMode {
  80. kCGTextFill = 0,
  81. kCGTextStroke = 1,
  82. kCGTextFillStroke = 2,
  83. kCGTextInvisible = 3,
  84. kCGTextFillClip = 4,
  85. kCGTextStrokeClip = 5,
  86. kCGTextFillStrokeClip = 6,
  87. kCGTextClip = 7
  88. };
  89. typedef enum CGTextDrawingMode CGTextDrawingMode;
  90. /* Text encodings. */
  91. enum CGTextEncoding {
  92. kCGEncodingFontSpecific = 0,
  93. kCGEncodingMacRoman = 1
  94. };
  95. typedef enum CGTextEncoding CGTextEncoding;
  96. enum CGInterpolationQuality {
  97. kCGInterpolationDefault = 0, /* Let the context decide. */
  98. kCGInterpolationNone = 1, /* Never interpolate. */
  99. kCGInterpolationLow = 2, /* Fast, low quality. */
  100. kCGInterpolationHigh = 3 /* Slow, high quality. */
  101. };
  102. typedef enum CGInterpolationQuality CGInterpolationQuality;
  103. /** Graphics state functions. **/
  104. /* Push a copy of the current graphics state onto the graphics state
  105. * stack. Note that the path is not considered part of the gstate, and is
  106. * not saved. */
  107. /*
  108. * CGContextSaveGState()
  109. *
  110. * Availability:
  111. * Non-Carbon CFM: not available
  112. * CarbonLib: not available
  113. * Mac OS X: in version 10.0 and later
  114. */
  115. EXTERN_API_C( void )
  116. CGContextSaveGState(CGContextRef ctx);
  117. /* Restore the current graphics state from the one on the top of the
  118. * graphics state stack, popping the graphics state stack in the
  119. * process. */
  120. /*
  121. * CGContextRestoreGState()
  122. *
  123. * Availability:
  124. * Non-Carbon CFM: not available
  125. * CarbonLib: not available
  126. * Mac OS X: in version 10.0 and later
  127. */
  128. EXTERN_API_C( void )
  129. CGContextRestoreGState(CGContextRef ctx);
  130. /** Coordinate space transformations. **/
  131. /* Scale the current graphics state's transformation matrix (the CTM) by
  132. * `(sx, sy)'. */
  133. /*
  134. * CGContextScaleCTM()
  135. *
  136. * Availability:
  137. * Non-Carbon CFM: not available
  138. * CarbonLib: not available
  139. * Mac OS X: in version 10.0 and later
  140. */
  141. EXTERN_API_C( void )
  142. CGContextScaleCTM(
  143. CGContextRef ctx,
  144. float sx,
  145. float sy);
  146. /* Translate the current graphics state's transformation matrix (the CTM)
  147. * by `(tx, ty)'. */
  148. /*
  149. * CGContextTranslateCTM()
  150. *
  151. * Availability:
  152. * Non-Carbon CFM: not available
  153. * CarbonLib: not available
  154. * Mac OS X: in version 10.0 and later
  155. */
  156. EXTERN_API_C( void )
  157. CGContextTranslateCTM(
  158. CGContextRef ctx,
  159. float tx,
  160. float ty);
  161. /* Rotate the current graphics state's transformation matrix (the CTM) by
  162. * `angle' radians. */
  163. /*
  164. * CGContextRotateCTM()
  165. *
  166. * Availability:
  167. * Non-Carbon CFM: not available
  168. * CarbonLib: not available
  169. * Mac OS X: in version 10.0 and later
  170. */
  171. EXTERN_API_C( void )
  172. CGContextRotateCTM(
  173. CGContextRef ctx,
  174. float angle);
  175. /* Concatenate the current graphics state's transformation matrix (the CTM)
  176. * with the affine transform `transform'. */
  177. /*
  178. * CGContextConcatCTM()
  179. *
  180. * Availability:
  181. * Non-Carbon CFM: not available
  182. * CarbonLib: not available
  183. * Mac OS X: in version 10.0 and later
  184. */
  185. EXTERN_API_C( void )
  186. CGContextConcatCTM(
  187. CGContextRef ctx,
  188. CGAffineTransform transform);
  189. /* Return the current graphics state's transformation matrix. */
  190. /*
  191. * CGContextGetCTM()
  192. *
  193. * Availability:
  194. * Non-Carbon CFM: not available
  195. * CarbonLib: not available
  196. * Mac OS X: in version 10.0 and later
  197. */
  198. EXTERN_API_C( CGAffineTransform )
  199. CGContextGetCTM(CGContextRef ctx);
  200. /** Drawing attribute functions. **/
  201. /* Set the line width in the current graphics state to `width'. */
  202. /*
  203. * CGContextSetLineWidth()
  204. *
  205. * Availability:
  206. * Non-Carbon CFM: not available
  207. * CarbonLib: not available
  208. * Mac OS X: in version 10.0 and later
  209. */
  210. EXTERN_API_C( void )
  211. CGContextSetLineWidth(
  212. CGContextRef ctx,
  213. float width);
  214. /* Set the line cap in the current graphics state to `cap'. */
  215. /*
  216. * CGContextSetLineCap()
  217. *
  218. * Availability:
  219. * Non-Carbon CFM: not available
  220. * CarbonLib: not available
  221. * Mac OS X: in version 10.0 and later
  222. */
  223. EXTERN_API_C( void )
  224. CGContextSetLineCap(
  225. CGContextRef ctx,
  226. CGLineCap cap);
  227. /* Set the line join in the current graphics state to `join'. */
  228. /*
  229. * CGContextSetLineJoin()
  230. *
  231. * Availability:
  232. * Non-Carbon CFM: not available
  233. * CarbonLib: not available
  234. * Mac OS X: in version 10.0 and later
  235. */
  236. EXTERN_API_C( void )
  237. CGContextSetLineJoin(
  238. CGContextRef ctx,
  239. CGLineJoin join);
  240. /* Set the miter limit in the current graphics state to `limit'. */
  241. /*
  242. * CGContextSetMiterLimit()
  243. *
  244. * Availability:
  245. * Non-Carbon CFM: not available
  246. * CarbonLib: not available
  247. * Mac OS X: in version 10.0 and later
  248. */
  249. EXTERN_API_C( void )
  250. CGContextSetMiterLimit(
  251. CGContextRef ctx,
  252. float limit);
  253. /* Set the line dash patttern in the current graphics state. */
  254. /*
  255. * CGContextSetLineDash()
  256. *
  257. * Availability:
  258. * Non-Carbon CFM: not available
  259. * CarbonLib: not available
  260. * Mac OS X: in version 10.0 and later
  261. */
  262. EXTERN_API_C( void )
  263. CGContextSetLineDash(
  264. CGContextRef ctx,
  265. float phase,
  266. const float lengths[],
  267. size_t count);
  268. /* Set the path flatness parameter in the current graphics state to
  269. * `flatness'. */
  270. /*
  271. * CGContextSetFlatness()
  272. *
  273. * Availability:
  274. * Non-Carbon CFM: not available
  275. * CarbonLib: not available
  276. * Mac OS X: in version 10.0 and later
  277. */
  278. EXTERN_API_C( void )
  279. CGContextSetFlatness(
  280. CGContextRef ctx,
  281. float flatness);
  282. /* Set the alpha value in the current graphics state to `alpha'. */
  283. /*
  284. * CGContextSetAlpha()
  285. *
  286. * Availability:
  287. * Non-Carbon CFM: not available
  288. * CarbonLib: not available
  289. * Mac OS X: in version 10.0 and later
  290. */
  291. EXTERN_API_C( void )
  292. CGContextSetAlpha(
  293. CGContextRef ctx,
  294. float alpha);
  295. /** Path construction functions. **/
  296. /* Note that a context has a single path in use at any time: a path is not
  297. * part of the graphics state. */
  298. /* Begin a new path. The old path is discarded. */
  299. /*
  300. * CGContextBeginPath()
  301. *
  302. * Availability:
  303. * Non-Carbon CFM: not available
  304. * CarbonLib: not available
  305. * Mac OS X: in version 10.0 and later
  306. */
  307. EXTERN_API_C( void )
  308. CGContextBeginPath(CGContextRef ctx);
  309. /* Start a new subpath at point `(x, y)' in the context's path. */
  310. /*
  311. * CGContextMoveToPoint()
  312. *
  313. * Availability:
  314. * Non-Carbon CFM: not available
  315. * CarbonLib: not available
  316. * Mac OS X: in version 10.0 and later
  317. */
  318. EXTERN_API_C( void )
  319. CGContextMoveToPoint(
  320. CGContextRef ctx,
  321. float x,
  322. float y);
  323. /* Append a straight line segment from the current point to `(x, y)'. */
  324. /*
  325. * CGContextAddLineToPoint()
  326. *
  327. * Availability:
  328. * Non-Carbon CFM: not available
  329. * CarbonLib: not available
  330. * Mac OS X: in version 10.0 and later
  331. */
  332. EXTERN_API_C( void )
  333. CGContextAddLineToPoint(
  334. CGContextRef ctx,
  335. float x,
  336. float y);
  337. /* Append a cubic Bezier curve from the current point to `(x,y)', with
  338. * control points `(cp1x, cp1y)' and `(cp2x, cp2y)'. */
  339. /*
  340. * CGContextAddCurveToPoint()
  341. *
  342. * Availability:
  343. * Non-Carbon CFM: not available
  344. * CarbonLib: not available
  345. * Mac OS X: in version 10.0 and later
  346. */
  347. EXTERN_API_C( void )
  348. CGContextAddCurveToPoint(
  349. CGContextRef ctx,
  350. float cp1x,
  351. float cp1y,
  352. float cp2x,
  353. float cp2y,
  354. float x,
  355. float y);
  356. /* Append a quadratic curve from the current point to `(x, y)', with
  357. * control point `(cpx, cpy)'. */
  358. /*
  359. * CGContextAddQuadCurveToPoint()
  360. *
  361. * Availability:
  362. * Non-Carbon CFM: not available
  363. * CarbonLib: not available
  364. * Mac OS X: in version 10.0 and later
  365. */
  366. EXTERN_API_C( void )
  367. CGContextAddQuadCurveToPoint(
  368. CGContextRef ctx,
  369. float cpx,
  370. float cpy,
  371. float x,
  372. float y);
  373. /* Close the current subpath of the context's path. */
  374. /*
  375. * CGContextClosePath()
  376. *
  377. * Availability:
  378. * Non-Carbon CFM: not available
  379. * CarbonLib: not available
  380. * Mac OS X: in version 10.0 and later
  381. */
  382. EXTERN_API_C( void )
  383. CGContextClosePath(CGContextRef ctx);
  384. /** Path construction convenience functions. **/
  385. /* Add a single rect to the context's path. */
  386. /*
  387. * CGContextAddRect()
  388. *
  389. * Availability:
  390. * Non-Carbon CFM: not available
  391. * CarbonLib: not available
  392. * Mac OS X: in version 10.0 and later
  393. */
  394. EXTERN_API_C( void )
  395. CGContextAddRect(
  396. CGContextRef ctx,
  397. CGRect rect);
  398. /* Add a set of rects to the context's path. */
  399. /*
  400. * CGContextAddRects()
  401. *
  402. * Availability:
  403. * Non-Carbon CFM: not available
  404. * CarbonLib: not available
  405. * Mac OS X: in version 10.0 and later
  406. */
  407. EXTERN_API_C( void )
  408. CGContextAddRects(
  409. CGContextRef ctx,
  410. const CGRect rects[],
  411. size_t count);
  412. /* Add a set of lines to the context's path. */
  413. /*
  414. * CGContextAddLines()
  415. *
  416. * Availability:
  417. * Non-Carbon CFM: not available
  418. * CarbonLib: not available
  419. * Mac OS X: in version 10.0 and later
  420. */
  421. EXTERN_API_C( void )
  422. CGContextAddLines(
  423. CGContextRef ctx,
  424. const CGPoint points[],
  425. size_t count);
  426. /* Add an arc of a circle to the context's path, possibly preceded by a
  427. * straight line segment. `(x, y)' is the center of the arc; `radius' is
  428. * its radius; `startAngle' is the angle to the first endpoint of the arc;
  429. * `endAngle' is the angle to the second endpoint of the arc; and
  430. * `clockwise' is 1 if the arc is to be drawn clockwise, 0 otherwise.
  431. * `startAngle' and `endAngle' are measured in radians. */
  432. /*
  433. * CGContextAddArc()
  434. *
  435. * Availability:
  436. * Non-Carbon CFM: not available
  437. * CarbonLib: not available
  438. * Mac OS X: in version 10.0 and later
  439. */
  440. EXTERN_API_C( void )
  441. CGContextAddArc(
  442. CGContextRef ctx,
  443. float x,
  444. float y,
  445. float radius,
  446. float startAngle,
  447. float endAngle,
  448. int clockwise);
  449. /* Add an arc of a circle to the context's path, possibly preceded by a
  450. * straight line segment. `radius' is the radius of the arc. The arc is
  451. * tangent to the line from the current point to `(x1, y1)', and the line
  452. * from `(x1, y1)' to `(x2, y2)'. */
  453. /*
  454. * CGContextAddArcToPoint()
  455. *
  456. * Availability:
  457. * Non-Carbon CFM: not available
  458. * CarbonLib: not available
  459. * Mac OS X: in version 10.0 and later
  460. */
  461. EXTERN_API_C( void )
  462. CGContextAddArcToPoint(
  463. CGContextRef ctx,
  464. float x1,
  465. float y1,
  466. float x2,
  467. float y2,
  468. float radius);
  469. /** Path information functions. **/
  470. /* Return 1 if the context's path contains no elements, 0 otherwise. */
  471. /*
  472. * CGContextIsPathEmpty()
  473. *
  474. * Availability:
  475. * Non-Carbon CFM: not available
  476. * CarbonLib: not available
  477. * Mac OS X: in version 10.0 and later
  478. */
  479. EXTERN_API_C( int )
  480. CGContextIsPathEmpty(CGContextRef ctx);
  481. /* Return the current point of the current subpath of the context's
  482. * path. */
  483. /*
  484. * CGContextGetPathCurrentPoint()
  485. *
  486. * Availability:
  487. * Non-Carbon CFM: not available
  488. * CarbonLib: not available
  489. * Mac OS X: in version 10.0 and later
  490. */
  491. EXTERN_API_C( CGPoint )
  492. CGContextGetPathCurrentPoint(CGContextRef ctx);
  493. /* Return the bounding box of the context's path. The bounding box is the
  494. * smallest rectangle completely enclosing all points in the path,
  495. * including control points for Bezier and quadratic curves. */
  496. /*
  497. * CGContextGetPathBoundingBox()
  498. *
  499. * Availability:
  500. * Non-Carbon CFM: not available
  501. * CarbonLib: not available
  502. * Mac OS X: in version 10.0 and later
  503. */
  504. EXTERN_API_C( CGRect )
  505. CGContextGetPathBoundingBox(CGContextRef ctx);
  506. /** Path drawing functions. **/
  507. /* Draw the context's path using drawing mode `mode'. */
  508. /*
  509. * CGContextDrawPath()
  510. *
  511. * Availability:
  512. * Non-Carbon CFM: not available
  513. * CarbonLib: not available
  514. * Mac OS X: in version 10.0 and later
  515. */
  516. EXTERN_API_C( void )
  517. CGContextDrawPath(
  518. CGContextRef ctx,
  519. CGPathDrawingMode mode);
  520. /** Path drawing convenience functions. **/
  521. /* Fill the context's path using the winding-number fill rule. Any open
  522. * subpath of the path is implicitly closed. */
  523. /*
  524. * CGContextFillPath()
  525. *
  526. * Availability:
  527. * Non-Carbon CFM: not available
  528. * CarbonLib: not available
  529. * Mac OS X: in version 10.0 and later
  530. */
  531. EXTERN_API_C( void )
  532. CGContextFillPath(CGContextRef ctx);
  533. /* Fill the context's path using the even-odd fill rule. Any open subpath
  534. * of the path is implicitly closed. */
  535. /*
  536. * CGContextEOFillPath()
  537. *
  538. * Availability:
  539. * Non-Carbon CFM: not available
  540. * CarbonLib: not available
  541. * Mac OS X: in version 10.0 and later
  542. */
  543. EXTERN_API_C( void )
  544. CGContextEOFillPath(CGContextRef ctx);
  545. /* Stroke the context's path. */
  546. /*
  547. * CGContextStrokePath()
  548. *
  549. * Availability:
  550. * Non-Carbon CFM: not available
  551. * CarbonLib: not available
  552. * Mac OS X: in version 10.0 and later
  553. */
  554. EXTERN_API_C( void )
  555. CGContextStrokePath(CGContextRef ctx);
  556. /* Fill `rect' with the current fill color. */
  557. /*
  558. * CGContextFillRect()
  559. *
  560. * Availability:
  561. * Non-Carbon CFM: not available
  562. * CarbonLib: not available
  563. * Mac OS X: in version 10.0 and later
  564. */
  565. EXTERN_API_C( void )
  566. CGContextFillRect(
  567. CGContextRef ctx,
  568. CGRect rect);
  569. /* Fill `rects', an array of `count' CGRects, with the current fill
  570. * color. */
  571. /*
  572. * CGContextFillRects()
  573. *
  574. * Availability:
  575. * Non-Carbon CFM: not available
  576. * CarbonLib: not available
  577. * Mac OS X: in version 10.0 and later
  578. */
  579. EXTERN_API_C( void )
  580. CGContextFillRects(
  581. CGContextRef ctx,
  582. const CGRect rects[],
  583. size_t count);
  584. /* Stroke `rect' with the current stroke color and the current linewidth. */
  585. /*
  586. * CGContextStrokeRect()
  587. *
  588. * Availability:
  589. * Non-Carbon CFM: not available
  590. * CarbonLib: not available
  591. * Mac OS X: in version 10.0 and later
  592. */
  593. EXTERN_API_C( void )
  594. CGContextStrokeRect(
  595. CGContextRef ctx,
  596. CGRect rect);
  597. /* Stroke `rect' with the current stroke color, using `width' as the the
  598. * line width. */
  599. /*
  600. * CGContextStrokeRectWithWidth()
  601. *
  602. * Availability:
  603. * Non-Carbon CFM: not available
  604. * CarbonLib: not available
  605. * Mac OS X: in version 10.0 and later
  606. */
  607. EXTERN_API_C( void )
  608. CGContextStrokeRectWithWidth(
  609. CGContextRef ctx,
  610. CGRect rect,
  611. float width);
  612. /* Clear `rect' (that is, set the region within the rect to
  613. * transparent). */
  614. /*
  615. * CGContextClearRect()
  616. *
  617. * Availability:
  618. * Non-Carbon CFM: not available
  619. * CarbonLib: not available
  620. * Mac OS X: in version 10.0 and later
  621. */
  622. EXTERN_API_C( void )
  623. CGContextClearRect(
  624. CGContextRef c,
  625. CGRect rect);
  626. /** Clipping functions. **/
  627. /* Intersect the context's path with the current clip path and use the
  628. * resulting path as the clip path for subsequent rendering operations.
  629. * Use the winding-number fill rule for deciding what's inside the path. */
  630. /*
  631. * CGContextClip()
  632. *
  633. * Availability:
  634. * Non-Carbon CFM: not available
  635. * CarbonLib: not available
  636. * Mac OS X: in version 10.0 and later
  637. */
  638. EXTERN_API_C( void )
  639. CGContextClip(CGContextRef ctx);
  640. /* Intersect the context's path with the current clip path and use the
  641. * resulting path as the clip path for subsequent rendering operations.
  642. * Use the even-odd fill rule for deciding what's inside the path. */
  643. /*
  644. * CGContextEOClip()
  645. *
  646. * Availability:
  647. * Non-Carbon CFM: not available
  648. * CarbonLib: not available
  649. * Mac OS X: in version 10.0 and later
  650. */
  651. EXTERN_API_C( void )
  652. CGContextEOClip(CGContextRef ctx);
  653. /** Clipping convenience functions. **/
  654. /* Intersect the current clipping path with `rect'. Note that this
  655. * function resets the context's path to the empty path. */
  656. /*
  657. * CGContextClipToRect()
  658. *
  659. * Availability:
  660. * Non-Carbon CFM: not available
  661. * CarbonLib: not available
  662. * Mac OS X: in version 10.0 and later
  663. */
  664. EXTERN_API_C( void )
  665. CGContextClipToRect(
  666. CGContextRef ctx,
  667. CGRect rect);
  668. /* Intersect the current clipping path with the clipping region formed by
  669. * creating a path consisting of all rects in `rects'. Note that this
  670. * function resets the context's path to the empty path. */
  671. /*
  672. * CGContextClipToRects()
  673. *
  674. * Availability:
  675. * Non-Carbon CFM: not available
  676. * CarbonLib: not available
  677. * Mac OS X: in version 10.0 and later
  678. */
  679. EXTERN_API_C( void )
  680. CGContextClipToRects(
  681. CGContextRef ctx,
  682. const CGRect rects[],
  683. size_t count);
  684. /** Colorspace functions. **/
  685. /* Set the components of the current fill color in the context `ctx' to the
  686. * values specifed by `components'. The number of elements in `components'
  687. * must be one greater than the number of components in the current fill
  688. * colorspace (N color components + 1 alpha component). The current fill
  689. * colorspace must not be a pattern colorspace. */
  690. /*
  691. * CGContextSetFillColorSpace()
  692. *
  693. * Availability:
  694. * Non-Carbon CFM: not available
  695. * CarbonLib: not available
  696. * Mac OS X: in version 10.0 and later
  697. */
  698. EXTERN_API_C( void )
  699. CGContextSetFillColorSpace(
  700. CGContextRef ctx,
  701. CGColorSpaceRef colorspace);
  702. /* Set the components of the current fill color in the context `ctx' to the
  703. * values specifed by `components'. The number of elements in `components'
  704. * must be one greater than the number of components in the current fill
  705. * colorspace (N color components + 1 alpha component). The current fill
  706. * colorspace must not be a pattern colorspace. */
  707. /*
  708. * CGContextSetStrokeColorSpace()
  709. *
  710. * Availability:
  711. * Non-Carbon CFM: not available
  712. * CarbonLib: not available
  713. * Mac OS X: in version 10.0 and later
  714. */
  715. EXTERN_API_C( void )
  716. CGContextSetStrokeColorSpace(
  717. CGContextRef ctx,
  718. CGColorSpaceRef colorspace);
  719. /** Color functions. **/
  720. /* Set the components of the current fill color in the context `c' to the
  721. * values specifed by `components'. The number of elements in `components'
  722. * must be one greater than the number of components in the current fill
  723. * colorspace (N color components + 1 alpha component). The current fill
  724. * colorspace must not be a pattern colorspace. */
  725. /*
  726. * CGContextSetFillColor()
  727. *
  728. * Availability:
  729. * Non-Carbon CFM: not available
  730. * CarbonLib: not available
  731. * Mac OS X: in version 10.0 and later
  732. */
  733. EXTERN_API_C( void )
  734. CGContextSetFillColor(
  735. CGContextRef c,
  736. const float components[]);
  737. /* Set the components of the current stroke color in the context `c' to the
  738. * values specifed by `components'. The number of elements in `components'
  739. * must be one greater than the number of components in the current stroke
  740. * colorspace (N color components + 1 alpha component). The current stroke
  741. * colorspace must not be a pattern colorspace. */
  742. /*
  743. * CGContextSetStrokeColor()
  744. *
  745. * Availability:
  746. * Non-Carbon CFM: not available
  747. * CarbonLib: not available
  748. * Mac OS X: in version 10.0 and later
  749. */
  750. EXTERN_API_C( void )
  751. CGContextSetStrokeColor(
  752. CGContextRef c,
  753. const float components[]);
  754. /** Pattern functions. **/
  755. /* Set the components of the current fill color in the context `c' to the
  756. * values specifed by `components', and set the current fill pattern to
  757. * `pattern'. The number of elements in `components' must be one greater
  758. * than the number of components in the current fill colorspace (N color
  759. * components + 1 alpha component). The current fill colorspace must be a
  760. * pattern colorspace. */
  761. /*
  762. * CGContextSetFillPattern()
  763. *
  764. * Availability:
  765. * Non-Carbon CFM: not available
  766. * CarbonLib: not available
  767. * Mac OS X: in version 10.1 and later
  768. */
  769. EXTERN_API_C( void )
  770. CGContextSetFillPattern(
  771. CGContextRef c,
  772. CGPatternRef pattern,
  773. const float components[]);
  774. /* Set the components of the current stroke color in the context `c' to the
  775. * values specifed by `components', and set the current stroke pattern to
  776. * `pattern'. The number of elements in `components' must be one greater
  777. * than the number of components in the current stroke colorspace (N color
  778. * components + 1 alpha component). The current stroke colorspace must be
  779. * a pattern colorspace. */
  780. /*
  781. * CGContextSetStrokePattern()
  782. *
  783. * Availability:
  784. * Non-Carbon CFM: not available
  785. * CarbonLib: not available
  786. * Mac OS X: in version 10.1 and later
  787. */
  788. EXTERN_API_C( void )
  789. CGContextSetStrokePattern(
  790. CGContextRef c,
  791. CGPatternRef pattern,
  792. const float components[]);
  793. /** Color convenience functions. **/
  794. /* Set the current fill colorspace in the context `c' to `DeviceGray' and
  795. * set the components of the current fill color to `(gray, alpha)'. */
  796. /*
  797. * CGContextSetGrayFillColor()
  798. *
  799. * Availability:
  800. * Non-Carbon CFM: not available
  801. * CarbonLib: not available
  802. * Mac OS X: in version 10.0 and later
  803. */
  804. EXTERN_API_C( void )
  805. CGContextSetGrayFillColor(
  806. CGContextRef ctx,
  807. float gray,
  808. float alpha);
  809. /* Set the current stroke colorspace in the context `c' to `DeviceGray' and
  810. * set the components of the current stroke color to `(gray, alpha)'. */
  811. /*
  812. * CGContextSetGrayStrokeColor()
  813. *
  814. * Availability:
  815. * Non-Carbon CFM: not available
  816. * CarbonLib: not available
  817. * Mac OS X: in version 10.0 and later
  818. */
  819. EXTERN_API_C( void )
  820. CGContextSetGrayStrokeColor(
  821. CGContextRef ctx,
  822. float gray,
  823. float alpha);
  824. /* Set the current fill colorspace in the context `c' to `DeviceRGB' and
  825. * set the components of the current fill color to `(red, green, blue,
  826. * alpha)'. */
  827. /*
  828. * CGContextSetRGBFillColor()
  829. *
  830. * Availability:
  831. * Non-Carbon CFM: not available
  832. * CarbonLib: not available
  833. * Mac OS X: in version 10.0 and later
  834. */
  835. EXTERN_API_C( void )
  836. CGContextSetRGBFillColor(
  837. CGContextRef ctx,
  838. float red,
  839. float green,
  840. float blue,
  841. float alpha);
  842. /* Set the current stroke colorspace in the context `c' to `DeviceRGB' and
  843. * set the components of the current stroke color to `(red, green, blue,
  844. * alpha)'. */
  845. /*
  846. * CGContextSetRGBStrokeColor()
  847. *
  848. * Availability:
  849. * Non-Carbon CFM: not available
  850. * CarbonLib: not available
  851. * Mac OS X: in version 10.0 and later
  852. */
  853. EXTERN_API_C( void )
  854. CGContextSetRGBStrokeColor(
  855. CGContextRef ctx,
  856. float red,
  857. float green,
  858. float blue,
  859. float alpha);
  860. /* Set the current fill colorspace in the context `c' to `DeviceCMYK' and
  861. * set the components of the current fill color to `(cyan, magenta, yellow,
  862. * black, alpha)'. */
  863. /*
  864. * CGContextSetCMYKFillColor()
  865. *
  866. * Availability:
  867. * Non-Carbon CFM: not available
  868. * CarbonLib: not available
  869. * Mac OS X: in version 10.0 and later
  870. */
  871. EXTERN_API_C( void )
  872. CGContextSetCMYKFillColor(
  873. CGContextRef ctx,
  874. float cyan,
  875. float magenta,
  876. float yellow,
  877. float black,
  878. float alpha);
  879. /* Set the current stroke colorspace in the context `c' to `DeviceCMYK' and
  880. * set the components of the current stroke color to `(cyan, magenta,
  881. * yellow, black, alpha)'. */
  882. /*
  883. * CGContextSetCMYKStrokeColor()
  884. *
  885. * Availability:
  886. * Non-Carbon CFM: not available
  887. * CarbonLib: not available
  888. * Mac OS X: in version 10.0 and later
  889. */
  890. EXTERN_API_C( void )
  891. CGContextSetCMYKStrokeColor(
  892. CGContextRef ctx,
  893. float cyan,
  894. float magenta,
  895. float yellow,
  896. float black,
  897. float alpha);
  898. /** Rendering intent. **/
  899. /* Set the rendering intent in the graphics state to `intent'. */
  900. /*
  901. * CGContextSetRenderingIntent()
  902. *
  903. * Availability:
  904. * Non-Carbon CFM: not available
  905. * CarbonLib: not available
  906. * Mac OS X: in version 10.0 and later
  907. */
  908. EXTERN_API_C( void )
  909. CGContextSetRenderingIntent(
  910. CGContextRef c,
  911. CGColorRenderingIntent intent);
  912. /** Image functions. **/
  913. /* Draw `image' in the rectangular area specified by `rect'. The image is
  914. * scaled, if necessary, to fit into `rect'. */
  915. /*
  916. * CGContextDrawImage()
  917. *
  918. * Availability:
  919. * Non-Carbon CFM: not available
  920. * CarbonLib: not available
  921. * Mac OS X: in version 10.0 and later
  922. */
  923. EXTERN_API_C( void )
  924. CGContextDrawImage(
  925. CGContextRef ctx,
  926. CGRect rect,
  927. CGImageRef image);
  928. /* Return the interpolation quality for image rendering of the context `c'.
  929. * The interpolation quality is a gstate-parameter which controls the level
  930. * of interpolation performed when an image is interpolated (for example,
  931. * when scaling the image). Note that it is merely a hint to the context:
  932. * not all contexts support all interpolation quality levels. */
  933. /*
  934. * CGContextGetInterpolationQuality()
  935. *
  936. * Availability:
  937. * Non-Carbon CFM: not available
  938. * CarbonLib: not available
  939. * Mac OS X: in version 10.1 and later
  940. */
  941. EXTERN_API_C( CGInterpolationQuality )
  942. CGContextGetInterpolationQuality(CGContextRef c);
  943. /* Set the interpolation quality of the context `c' to `quality'. */
  944. /*
  945. * CGContextSetInterpolationQuality()
  946. *
  947. * Availability:
  948. * Non-Carbon CFM: not available
  949. * CarbonLib: not available
  950. * Mac OS X: in version 10.1 and later
  951. */
  952. EXTERN_API_C( void )
  953. CGContextSetInterpolationQuality(
  954. CGContextRef c,
  955. CGInterpolationQuality quality);
  956. /** Text functions. **/
  957. /* Set the current character spacing in the context `ctx' to `spacing'. The
  958. * character spacing is added to the displacement between the origin of one
  959. * character and the origin of the next. */
  960. /*
  961. * CGContextSetCharacterSpacing()
  962. *
  963. * Availability:
  964. * Non-Carbon CFM: not available
  965. * CarbonLib: not available
  966. * Mac OS X: in version 10.0 and later
  967. */
  968. EXTERN_API_C( void )
  969. CGContextSetCharacterSpacing(
  970. CGContextRef ctx,
  971. float spacing);
  972. /* Set the user-space point at which text will be drawn to (x,y). */
  973. /*
  974. * CGContextSetTextPosition()
  975. *
  976. * Availability:
  977. * Non-Carbon CFM: not available
  978. * CarbonLib: not available
  979. * Mac OS X: in version 10.0 and later
  980. */
  981. EXTERN_API_C( void )
  982. CGContextSetTextPosition(
  983. CGContextRef ctx,
  984. float x,
  985. float y);
  986. /* Return the current user-space point at which text will be drawn to (x,y). */
  987. /*
  988. * CGContextGetTextPosition()
  989. *
  990. * Availability:
  991. * Non-Carbon CFM: not available
  992. * CarbonLib: not available
  993. * Mac OS X: in version 10.0 and later
  994. */
  995. EXTERN_API_C( CGPoint )
  996. CGContextGetTextPosition(CGContextRef ctx);
  997. /* Set the text matrix to `transform'. */
  998. /*
  999. * CGContextSetTextMatrix()
  1000. *
  1001. * Availability:
  1002. * Non-Carbon CFM: not available
  1003. * CarbonLib: not available
  1004. * Mac OS X: in version 10.0 and later
  1005. */
  1006. EXTERN_API_C( void )
  1007. CGContextSetTextMatrix(
  1008. CGContextRef ctx,
  1009. CGAffineTransform transform);
  1010. /* Return the text matrix. */
  1011. /*
  1012. * CGContextGetTextMatrix()
  1013. *
  1014. * Availability:
  1015. * Non-Carbon CFM: not available
  1016. * CarbonLib: not available
  1017. * Mac OS X: in version 10.0 and later
  1018. */
  1019. EXTERN_API_C( CGAffineTransform )
  1020. CGContextGetTextMatrix(CGContextRef ctx);
  1021. /* Set the text drawing mode to `mode'. */
  1022. /*
  1023. * CGContextSetTextDrawingMode()
  1024. *
  1025. * Availability:
  1026. * Non-Carbon CFM: not available
  1027. * CarbonLib: not available
  1028. * Mac OS X: in version 10.0 and later
  1029. */
  1030. EXTERN_API_C( void )
  1031. CGContextSetTextDrawingMode(
  1032. CGContextRef ctx,
  1033. CGTextDrawingMode mode);
  1034. /* Set the current font to `font'. */
  1035. /*
  1036. * CGContextSetFont()
  1037. *
  1038. * Availability:
  1039. * Non-Carbon CFM: not available
  1040. * CarbonLib: not available
  1041. * Mac OS X: in version 10.0 and later
  1042. */
  1043. EXTERN_API_C( void )
  1044. CGContextSetFont(
  1045. CGContextRef ctx,
  1046. CGFontRef font);
  1047. /* Set the current font size to `size'. */
  1048. /*
  1049. * CGContextSetFontSize()
  1050. *
  1051. * Availability:
  1052. * Non-Carbon CFM: not available
  1053. * CarbonLib: not available
  1054. * Mac OS X: in version 10.0 and later
  1055. */
  1056. EXTERN_API_C( void )
  1057. CGContextSetFontSize(
  1058. CGContextRef ctx,
  1059. float size);
  1060. /* Attempts to find the font named `name'. If successful, scales it to
  1061. * `size' units in user space. `textEncoding' specifies how to translate
  1062. * from bytes to glyphs. */
  1063. /*
  1064. * CGContextSelectFont()
  1065. *
  1066. * Availability:
  1067. * Non-Carbon CFM: not available
  1068. * CarbonLib: not available
  1069. * Mac OS X: in version 10.0 and later
  1070. */
  1071. EXTERN_API_C( void )
  1072. CGContextSelectFont(
  1073. CGContextRef ctx,
  1074. const char * name,
  1075. float size,
  1076. CGTextEncoding textEncoding);
  1077. /* Draw `string', a string of `length' bytes, at the point specified by the
  1078. * current text matrix. Each byte of the string is mapped through the
  1079. * encoding vector of the current font to obtain the glyph to display. */
  1080. /*
  1081. * CGContextShowText()
  1082. *
  1083. * Availability:
  1084. * Non-Carbon CFM: not available
  1085. * CarbonLib: not available
  1086. * Mac OS X: in version 10.0 and later
  1087. */
  1088. EXTERN_API_C( void )
  1089. CGContextShowText(
  1090. CGContextRef ctx,
  1091. const char * cstring,
  1092. size_t length);
  1093. /* Draw the glyphs pointed to by `g', an array of `count' glyphs, at the
  1094. * point specified by the current text matrix. */
  1095. /*
  1096. * CGContextShowGlyphs()
  1097. *
  1098. * Availability:
  1099. * Non-Carbon CFM: not available
  1100. * CarbonLib: not available
  1101. * Mac OS X: in version 10.0 and later
  1102. */
  1103. EXTERN_API_C( void )
  1104. CGContextShowGlyphs(
  1105. CGContextRef ctx,
  1106. const CGGlyph g[],
  1107. size_t count);
  1108. /** Text convenience functions. **/
  1109. /* Draw `string', a string of `length' bytes, at the point `(x, y)',
  1110. * specified in user space. Each byte of the string is mapped through the
  1111. * encoding vector of the current font to obtain the glyph to display. */
  1112. /*
  1113. * CGContextShowTextAtPoint()
  1114. *
  1115. * Availability:
  1116. * Non-Carbon CFM: not available
  1117. * CarbonLib: not available
  1118. * Mac OS X: in version 10.0 and later
  1119. */
  1120. EXTERN_API_C( void )
  1121. CGContextShowTextAtPoint(
  1122. CGContextRef ctx,
  1123. float x,
  1124. float y,
  1125. const char * cstring,
  1126. size_t length);
  1127. /* Display the glyphs pointed to by `g', an array of `count' glyph ids, at
  1128. * the point `(x, y)', specified in user space. */
  1129. /*
  1130. * CGContextShowGlyphsAtPoint()
  1131. *
  1132. * Availability:
  1133. * Non-Carbon CFM: not available
  1134. * CarbonLib: not available
  1135. * Mac OS X: in version 10.0 and later
  1136. */
  1137. EXTERN_API_C( void )
  1138. CGContextShowGlyphsAtPoint(
  1139. CGContextRef ctx,
  1140. float x,
  1141. float y,
  1142. const CGGlyph g[],
  1143. size_t count);
  1144. /** PDF document functions. **/
  1145. /* Draw `page' in `document' in the rectangular area specified by `rect'.
  1146. * The media box of the page is scaled, if necessary, to fit into
  1147. * `rect'. */
  1148. /*
  1149. * CGContextDrawPDFDocument()
  1150. *
  1151. * Availability:
  1152. * Non-Carbon CFM: not available
  1153. * CarbonLib: not available
  1154. * Mac OS X: in version 10.0 and later
  1155. */
  1156. EXTERN_API_C( void )
  1157. CGContextDrawPDFDocument(
  1158. CGContextRef ctx,
  1159. CGRect rect,
  1160. CGPDFDocumentRef document,
  1161. int page);
  1162. /** Page functions. **/
  1163. /* Begin a new page. */
  1164. /*
  1165. * CGContextBeginPage()
  1166. *
  1167. * Availability:
  1168. * Non-Carbon CFM: not available
  1169. * CarbonLib: not available
  1170. * Mac OS X: in version 10.0 and later
  1171. */
  1172. EXTERN_API_C( void )
  1173. CGContextBeginPage(
  1174. CGContextRef ctx,
  1175. const CGRect * mediaBox);
  1176. /* End the current page. */
  1177. /*
  1178. * CGContextEndPage()
  1179. *
  1180. * Availability:
  1181. * Non-Carbon CFM: not available
  1182. * CarbonLib: not available
  1183. * Mac OS X: in version 10.0 and later
  1184. */
  1185. EXTERN_API_C( void )
  1186. CGContextEndPage(CGContextRef ctx);
  1187. /** Context functions. **/
  1188. /* Increment the retain count of `ctx' and return it. All contexts are
  1189. * created with an initial retain count of 1. */
  1190. /*
  1191. * CGContextRetain()
  1192. *
  1193. * Availability:
  1194. * Non-Carbon CFM: not available
  1195. * CarbonLib: not available
  1196. * Mac OS X: in version 10.0 and later
  1197. */
  1198. EXTERN_API_C( CGContextRef )
  1199. CGContextRetain(CGContextRef ctx);
  1200. /* Decrement the retain count of `ctx'. If the retain count reaches 0,
  1201. * then free `ctx' and any associated resources. */
  1202. /*
  1203. * CGContextRelease()
  1204. *
  1205. * Availability:
  1206. * Non-Carbon CFM: not available
  1207. * CarbonLib: not available
  1208. * Mac OS X: in version 10.0 and later
  1209. */
  1210. EXTERN_API_C( void )
  1211. CGContextRelease(CGContextRef ctx);
  1212. /* Flush all drawing to the destination. */
  1213. /*
  1214. * CGContextFlush()
  1215. *
  1216. * Availability:
  1217. * Non-Carbon CFM: not available
  1218. * CarbonLib: not available
  1219. * Mac OS X: in version 10.0 and later
  1220. */
  1221. EXTERN_API_C( void )
  1222. CGContextFlush(CGContextRef ctx);
  1223. /* Synchronized drawing. */
  1224. /*
  1225. * CGContextSynchronize()
  1226. *
  1227. * Availability:
  1228. * Non-Carbon CFM: not available
  1229. * CarbonLib: not available
  1230. * Mac OS X: in version 10.0 and later
  1231. */
  1232. EXTERN_API_C( void )
  1233. CGContextSynchronize(CGContextRef ctx);
  1234. /** Antialiasing functions. **/
  1235. /* Turn off antialiasing if `shouldAntialias' is zero; turn it on
  1236. * otherwise. This parameter is part of the graphics state. */
  1237. /*
  1238. * CGContextSetShouldAntialias()
  1239. *
  1240. * Availability:
  1241. * Non-Carbon CFM: not available
  1242. * CarbonLib: not available
  1243. * Mac OS X: in version 10.0 and later
  1244. */
  1245. EXTERN_API_C( void )
  1246. CGContextSetShouldAntialias(
  1247. CGContextRef ctx,
  1248. int shouldAntialias);
  1249. #if PRAGMA_ENUM_ALWAYSINT
  1250. #pragma enumsalwaysint reset
  1251. #ifdef __CGCONTEXT__RESTORE_TWOBYTEINTS
  1252. #pragma fourbyteints off
  1253. #endif
  1254. #elif PRAGMA_ENUM_OPTIONS
  1255. #pragma option enum=reset
  1256. #elif defined(__CGCONTEXT__RESTORE_PACKED_ENUMS)
  1257. #pragma options(pack_enums)
  1258. #endif
  1259. #ifdef PRAGMA_IMPORT_OFF
  1260. #pragma import off
  1261. #elif PRAGMA_IMPORT
  1262. #pragma import reset
  1263. #endif
  1264. #ifdef __cplusplus
  1265. }
  1266. #endif
  1267. #endif /* CGCONTEXT_H_ */