cairo.pp 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. unit Cairo;
  2. (* cairo - a vector graphics library with display and print output
  3. *
  4. * Copyright © 2002 University of Southern California
  5. * Copyright © 2005 Red Hat, Inc.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it either under the terms of the GNU Lesser General Public
  9. * License version 2.1 as published by the Free Software Foundation
  10. * (the "LGPL") or, at your option, under the terms of the Mozilla
  11. * Public License Version 1.1 (the "MPL"). If you do not alter this
  12. * notice, a recipient may use your version of this file under either
  13. * the MPL or the LGPL.
  14. *
  15. * You should have received a copy of the LGPL along with this library
  16. * in the file COPYING-LGPL-2.1; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. * You should have received a copy of the MPL along with this library
  19. * in the file COPYING-MPL-1.1
  20. *
  21. * The contents of this file are subject to the Mozilla Public License
  22. * Version 1.1 (the "License"); you may not use this file except in
  23. * compliance with the License. You may obtain a copy of the License at
  24. * http://www.mozilla.org/MPL/
  25. *
  26. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
  27. * OF ANY KIND, either express or implied. See the LGPL or the MPL for
  28. * the specific language governing rights and limitations.
  29. *
  30. * The Original Code is the cairo graphics library.
  31. *
  32. * The Initial Developer of the Original Code is University of Southern
  33. * California.
  34. *
  35. * Contributor(s):
  36. * Carl D. Worth <[email protected]>
  37. * This FreePascal binding generated August 26, 2005
  38. * by Jeffrey Pohlmeyer <[email protected]>
  39. - Updated to cairo version 1.4
  40. - Grouped OS specific fuctions in separated units
  41. - Organized the functions by group and ordered exactly as the c header
  42. - Cleared parameter list syntax according to pascal standard
  43. By Luiz Américo Pereira Câmara
  44. October 2007
  45. *)
  46. {$mode ObjFpc}
  47. interface
  48. Uses
  49. CTypes;
  50. const
  51. {$ifdef win32}
  52. LIB_CAIRO = 'libcairo-2.dll';
  53. {$IFDEF FPC}
  54. {$ifndef NO_SMART_LINK}
  55. {$smartlink on}
  56. {$endif}
  57. {$ENDIF}
  58. {$else}
  59. {$ifdef darwin}
  60. LIB_CAIRO = 'cairo';
  61. {$linklib cairo}
  62. {$else}
  63. {$ifdef UseCustomLibs}
  64. LIB_CAIRO = '';
  65. {$else}
  66. LIB_CAIRO = 'libcairo.so.2';
  67. {$endif}
  68. {$endif}
  69. {$endif}
  70. {$IFDEF FPC}
  71. {$PACKRECORDS C}
  72. {$ENDIF}
  73. type
  74. cairo_status_t = (
  75. CAIRO_STATUS_SUCCESS = 0,
  76. CAIRO_STATUS_NO_MEMORY,
  77. CAIRO_STATUS_INVALID_RESTORE,
  78. CAIRO_STATUS_INVALID_POP_GROUP,
  79. CAIRO_STATUS_NO_CURRENT_POINT,
  80. CAIRO_STATUS_INVALID_MATRIX,
  81. CAIRO_STATUS_INVALID_STATUS,
  82. CAIRO_STATUS_NULL_POINTER,
  83. CAIRO_STATUS_INVALID_STRING,
  84. CAIRO_STATUS_INVALID_PATH_DATA,
  85. CAIRO_STATUS_READ_ERROR,
  86. CAIRO_STATUS_WRITE_ERROR,
  87. CAIRO_STATUS_SURFACE_FINISHED,
  88. CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
  89. CAIRO_STATUS_PATTERN_TYPE_MISMATCH,
  90. CAIRO_STATUS_INVALID_CONTENT,
  91. CAIRO_STATUS_INVALID_FORMAT,
  92. CAIRO_STATUS_INVALID_VISUAL,
  93. CAIRO_STATUS_FILE_NOT_FOUND,
  94. CAIRO_STATUS_INVALID_DASH
  95. );
  96. cairo_operator_t = (
  97. CAIRO_OPERATOR_CLEAR,
  98. CAIRO_OPERATOR_SOURCE,
  99. CAIRO_OPERATOR_OVER,
  100. CAIRO_OPERATOR_IN,
  101. CAIRO_OPERATOR_OUT,
  102. CAIRO_OPERATOR_ATOP,
  103. CAIRO_OPERATOR_DEST,
  104. CAIRO_OPERATOR_DEST_OVER,
  105. CAIRO_OPERATOR_DEST_IN,
  106. CAIRO_OPERATOR_DEST_OUT,
  107. CAIRO_OPERATOR_DEST_ATOP,
  108. CAIRO_OPERATOR_XOR,
  109. CAIRO_OPERATOR_ADD,
  110. CAIRO_OPERATOR_SATURATE
  111. );
  112. cairo_antialias_t = (
  113. CAIRO_ANTIALIAS_DEFAULT,
  114. CAIRO_ANTIALIAS_NONE,
  115. CAIRO_ANTIALIAS_GRAY,
  116. CAIRO_ANTIALIAS_SUBPIXEL
  117. );
  118. cairo_fill_rule_t = (
  119. CAIRO_FILL_RULE_WINDING,
  120. CAIRO_FILL_RULE_EVEN_ODD
  121. );
  122. cairo_line_cap_t = (
  123. CAIRO_LINE_CAP_BUTT,
  124. CAIRO_LINE_CAP_ROUND,
  125. CAIRO_LINE_CAP_SQUARE
  126. );
  127. cairo_line_join_t = (
  128. CAIRO_LINE_JOIN_MITER,
  129. CAIRO_LINE_JOIN_ROUND,
  130. CAIRO_LINE_JOIN_BEVEL
  131. );
  132. cairo_font_slant_t = (
  133. CAIRO_FONT_SLANT_NORMAL,
  134. CAIRO_FONT_SLANT_ITALIC,
  135. CAIRO_FONT_SLANT_OBLIQUE
  136. );
  137. cairo_font_weight_t = (
  138. CAIRO_FONT_WEIGHT_NORMAL,
  139. CAIRO_FONT_WEIGHT_BOLD
  140. );
  141. cairo_subpixel_order_t = (
  142. CAIRO_SUBPIXEL_ORDER_DEFAULT,
  143. CAIRO_SUBPIXEL_ORDER_RGB,
  144. CAIRO_SUBPIXEL_ORDER_BGR,
  145. CAIRO_SUBPIXEL_ORDER_VRGB,
  146. CAIRO_SUBPIXEL_ORDER_VBGR
  147. );
  148. cairo_hint_style_t = (
  149. CAIRO_HINT_STYLE_DEFAULT,
  150. CAIRO_HINT_STYLE_NONE,
  151. CAIRO_HINT_STYLE_SLIGHT,
  152. CAIRO_HINT_STYLE_MEDIUM,
  153. CAIRO_HINT_STYLE_FULL
  154. );
  155. cairo_hint_metrics_t = (
  156. CAIRO_HINT_METRICS_DEFAULT,
  157. CAIRO_HINT_METRICS_OFF,
  158. CAIRO_HINT_METRICS_ON
  159. );
  160. cairo_path_data_type_t = (
  161. CAIRO_PATH_MOVE_TO,
  162. CAIRO_PATH_LINE_TO,
  163. CAIRO_PATH_CURVE_TO,
  164. CAIRO_PATH_CLOSE_PATH
  165. );
  166. cairo_content_t = (
  167. CAIRO_CONTENT_COLOR = $1000,
  168. CAIRO_CONTENT_ALPHA = $2000,
  169. CAIRO_CONTENT_COLOR_ALPHA = $3000
  170. );
  171. cairo_format_t = (
  172. CAIRO_FORMAT_ARGB32,
  173. CAIRO_FORMAT_RGB24,
  174. CAIRO_FORMAT_A8,
  175. CAIRO_FORMAT_A1
  176. );
  177. cairo_extend_t = (
  178. CAIRO_EXTEND_NONE,
  179. CAIRO_EXTEND_REPEAT,
  180. CAIRO_EXTEND_REFLECT,
  181. CAIRO_EXTEND_PAD
  182. );
  183. cairo_filter_t = (
  184. CAIRO_FILTER_FAST,
  185. CAIRO_FILTER_GOOD,
  186. CAIRO_FILTER_BEST,
  187. CAIRO_FILTER_NEAREST,
  188. CAIRO_FILTER_BILINEAR,
  189. CAIRO_FILTER_GAUSSIAN
  190. );
  191. cairo_font_type_t = (
  192. CAIRO_FONT_TYPE_TOY,
  193. CAIRO_FONT_TYPE_FT,
  194. CAIRO_FONT_TYPE_WIN32,
  195. CAIRO_FONT_TYPE_ATSUI
  196. );
  197. cairo_pattern_type_t = (
  198. CAIRO_PATTERN_TYPE_SOLID,
  199. CAIRO_PATTERN_TYPE_SURFACE,
  200. CAIRO_PATTERN_TYPE_LINEAR,
  201. CAIRO_PATTERN_TYPE_RADIAL
  202. );
  203. cairo_surface_type_t = (
  204. CAIRO_SURFACE_TYPE_IMAGE,
  205. CAIRO_SURFACE_TYPE_PDF,
  206. CAIRO_SURFACE_TYPE_PS,
  207. CAIRO_SURFACE_TYPE_XLIB,
  208. CAIRO_SURFACE_TYPE_XCB,
  209. CAIRO_SURFACE_TYPE_GLITZ,
  210. CAIRO_SURFACE_TYPE_QUARTZ,
  211. CAIRO_SURFACE_TYPE_WIN32,
  212. CAIRO_SURFACE_TYPE_BEOS,
  213. CAIRO_SURFACE_TYPE_DIRECTFB,
  214. CAIRO_SURFACE_TYPE_SVG,
  215. CAIRO_SURFACE_TYPE_OS2
  216. );
  217. cairo_svg_version_t = (
  218. CAIRO_SVG_VERSION_1_1,
  219. CAIRO_SVG_VERSION_1_2
  220. );
  221. pcairo_svg_version_t = ^cairo_svg_version_t;
  222. ppcairo_svg_version_t = pcairo_svg_version_t;
  223. Pcairo_surface_t = ^cairo_surface_t;
  224. PPcairo_surface_t = ^Pcairo_surface_t;
  225. Pcairo_t = ^cairo_t;
  226. Pcairo_pattern_t = ^cairo_pattern_t;
  227. Pcairo_font_options_t = ^cairo_font_options_t;
  228. Pcairo_font_face_t = ^cairo_font_face_t;
  229. Pcairo_scaled_font_t = ^cairo_scaled_font_t;
  230. Pcairo_bool_t = ^cairo_bool_t;
  231. cairo_bool_t = LongInt;
  232. Pcairo_matrix_t = ^cairo_matrix_t;
  233. Pcairo_user_data_key_t = ^cairo_user_data_key_t;
  234. Pcairo_glyph_t = ^cairo_glyph_t;
  235. Pcairo_text_extents_t = ^cairo_text_extents_t;
  236. Pcairo_font_extents_t = ^cairo_font_extents_t;
  237. Pcairo_path_data_type_t = ^cairo_path_data_type_t;
  238. Pcairo_path_data_t = ^cairo_path_data_t;
  239. Pcairo_path_t = ^cairo_path_t;
  240. Pcairo_rectangle_t = ^cairo_rectangle_t;
  241. Pcairo_rectangle_list_t =^cairo_rectangle_list_t;
  242. cairo_destroy_func_t = procedure (data: Pointer); cdecl;
  243. cairo_write_func_t = function (closure: Pointer; data: PByte; length: LongWord): cairo_status_t; cdecl;
  244. cairo_read_func_t = function (closure: Pointer; data: PByte; length: LongWord): cairo_status_t; cdecl;
  245. cairo_t = record {OPAQUE} end;
  246. cairo_surface_t = record {OPAQUE} end;
  247. cairo_pattern_t = record {OPAQUE} end;
  248. cairo_scaled_font_t = record {OPAQUE} end;
  249. cairo_font_face_t = record {OPAQUE} end;
  250. cairo_font_options_t = record {OPAQUE} end;
  251. cairo_matrix_t = record
  252. xx : Double;
  253. yx : Double;
  254. xy : Double;
  255. yy : Double;
  256. x0 : Double;
  257. y0 : Double;
  258. end;
  259. cairo_user_data_key_t = record
  260. unused : LongInt;
  261. end;
  262. cairo_glyph_t = record
  263. index : LongWord;
  264. x : Double;
  265. y : Double;
  266. end;
  267. cairo_text_extents_t = record
  268. x_bearing : Double;
  269. y_bearing : Double;
  270. width : Double;
  271. height : Double;
  272. x_advance : Double;
  273. y_advance : Double;
  274. end;
  275. cairo_font_extents_t = record
  276. ascent : Double;
  277. descent : Double;
  278. height : Double;
  279. max_x_advance : Double;
  280. max_y_advance : Double;
  281. end;
  282. cairo_path_data_t = record
  283. case LongInt of
  284. 0 : ( header : record
  285. _type : cairo_path_data_type_t;
  286. length : LongInt;
  287. end );
  288. 1 : ( point : record
  289. x : Double;
  290. y : Double;
  291. end );
  292. end;
  293. cairo_path_t = record
  294. status : cairo_status_t;
  295. data : Pcairo_path_data_t;
  296. num_data : LongInt;
  297. end;
  298. cairo_rectangle_t = record
  299. x, y, width, height: Double;
  300. end;
  301. cairo_rectangle_list_t = record
  302. status: cairo_status_t;
  303. rectangles: Pcairo_rectangle_t;
  304. num_rectangles: LongInt;
  305. end;
  306. function cairo_version: LongInt; cdecl; external LIB_CAIRO;
  307. function cairo_version_string: PChar; cdecl; external LIB_CAIRO;
  308. //Helper function to retrieve decoded version
  309. procedure cairo_version(out major, minor, micro: LongInt);
  310. (* Functions for manipulating state objects *)
  311. function cairo_create(target: Pcairo_surface_t): Pcairo_t; cdecl; external LIB_CAIRO;
  312. function cairo_reference(cr: Pcairo_t): Pcairo_t; cdecl; external LIB_CAIRO;
  313. procedure cairo_destroy(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  314. function cairo_get_reference_count(cr: Pcairo_t): LongWord; cdecl; external LIB_CAIRO;
  315. function cairo_get_user_data(cr: Pcairo_t; key: Pcairo_user_data_key_t): pointer; cdecl; external LIB_CAIRO;
  316. function cairo_set_user_data(cr: PCairo_t; key: Pcairo_user_data_key_t; user_data: Pointer; destroy: cairo_destroy_func_t): cairo_status_t; cdecl; external LIB_CAIRO;
  317. procedure cairo_save(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  318. procedure cairo_restore(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  319. procedure cairo_push_group (cr: PCairo_t); cdecl; external LIB_CAIRO;
  320. procedure cairo_push_group_with_content (cr: PCairo_t; content: cairo_content_t); cdecl; external LIB_CAIRO;
  321. function cairo_pop_group (cr: PCairo_t): Pcairo_pattern_t; cdecl; external LIB_CAIRO;
  322. procedure cairo_pop_group_to_source (cr: PCairo_t); cdecl; external LIB_CAIRO;
  323. (* Modify state *)
  324. procedure cairo_set_operator(cr: Pcairo_t; op: cairo_operator_t); cdecl; external LIB_CAIRO;
  325. procedure cairo_set_source(cr: Pcairo_t; source: Pcairo_pattern_t); cdecl; external LIB_CAIRO;
  326. procedure cairo_set_source_rgb(cr: Pcairo_t; red, green, blue: Double); cdecl; external LIB_CAIRO;
  327. procedure cairo_set_source_rgba(cr: Pcairo_t; red, green, blue, alpha: Double); cdecl; external LIB_CAIRO;
  328. procedure cairo_set_source_surface(cr: Pcairo_t; surface: Pcairo_surface_t; x, y: Double); cdecl; external LIB_CAIRO;
  329. procedure cairo_set_tolerance(cr: Pcairo_t; tolerance: Double); cdecl; external LIB_CAIRO;
  330. procedure cairo_set_antialias(cr: Pcairo_t; antialias: cairo_antialias_t); cdecl; external LIB_CAIRO;
  331. procedure cairo_set_fill_rule(cr: Pcairo_t; fill_rule: cairo_fill_rule_t); cdecl; external LIB_CAIRO;
  332. procedure cairo_set_line_width(cr: Pcairo_t; width: Double); cdecl; external LIB_CAIRO;
  333. procedure cairo_set_line_cap(cr: Pcairo_t; line_cap: cairo_line_cap_t); cdecl; external LIB_CAIRO;
  334. procedure cairo_set_line_join(cr: Pcairo_t; line_join: cairo_line_join_t); cdecl; external LIB_CAIRO;
  335. procedure cairo_set_dash(cr: Pcairo_t; dashes: PDouble; num_dashes: LongInt; offset: Double); cdecl; external LIB_CAIRO;
  336. procedure cairo_set_miter_limit(cr: Pcairo_t; limit: Double); cdecl; external LIB_CAIRO;
  337. procedure cairo_translate(cr: Pcairo_t; tx, ty: Double); cdecl; external LIB_CAIRO;
  338. procedure cairo_scale(cr: Pcairo_t; sx, sy: Double); cdecl; external LIB_CAIRO;
  339. procedure cairo_rotate(cr: Pcairo_t; angle: Double); cdecl; external LIB_CAIRO;
  340. procedure cairo_transform(cr: Pcairo_t; matrix: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  341. procedure cairo_set_matrix(cr: Pcairo_t; matrix: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  342. procedure cairo_identity_matrix(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  343. procedure cairo_user_to_device(cr: Pcairo_t; x, y: PDouble); cdecl; external LIB_CAIRO;
  344. procedure cairo_user_to_device_distance(cr: Pcairo_t; dx, dy: PDouble); cdecl; external LIB_CAIRO;
  345. procedure cairo_device_to_user(cr: Pcairo_t; x, y: PDouble); cdecl; external LIB_CAIRO;
  346. procedure cairo_device_to_user_distance(cr: Pcairo_t; dx, dy: PDouble); cdecl; external LIB_CAIRO;
  347. (* Path creation functions *)
  348. procedure cairo_new_path(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  349. procedure cairo_move_to(cr: Pcairo_t; x, y: Double); cdecl; external LIB_CAIRO;
  350. procedure cairo_new_sub_path(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  351. procedure cairo_line_to(cr: Pcairo_t; x, y: Double); cdecl; external LIB_CAIRO;
  352. procedure cairo_curve_to(cr: Pcairo_t; x1, y1, x2, y2, x3, y3: Double); cdecl; external LIB_CAIRO;
  353. procedure cairo_arc(cr: Pcairo_t; xc, yc, radius, angle1, angle2: Double); cdecl; external LIB_CAIRO;
  354. procedure cairo_arc_negative(cr: Pcairo_t; xc, yc, radius, angle1, angle2: Double); cdecl; external LIB_CAIRO;
  355. procedure cairo_rel_move_to(cr: Pcairo_t; dx, dy: Double); cdecl; external LIB_CAIRO;
  356. procedure cairo_rel_line_to(cr: Pcairo_t; dx, dy: Double); cdecl; external LIB_CAIRO;
  357. procedure cairo_rel_curve_to(cr: Pcairo_t; dx1, dy1, dx2, dy2, dx3, dy3: Double); cdecl; external LIB_CAIRO;
  358. procedure cairo_rectangle(cr: Pcairo_t; x, y, width, height: Double); cdecl; external LIB_CAIRO;
  359. procedure cairo_close_path(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  360. (* Painting functions *)
  361. procedure cairo_paint(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  362. procedure cairo_paint_with_alpha(cr: Pcairo_t; alpha: Double); cdecl; external LIB_CAIRO;
  363. procedure cairo_mask(cr: Pcairo_t; pattern: Pcairo_pattern_t); cdecl; external LIB_CAIRO;
  364. procedure cairo_mask_surface(cr: Pcairo_t; surface: Pcairo_surface_t; surface_x, surface_y: Double); cdecl; external LIB_CAIRO;
  365. procedure cairo_stroke(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  366. procedure cairo_stroke_preserve(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  367. procedure cairo_fill(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  368. procedure cairo_fill_preserve(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  369. procedure cairo_copy_page(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  370. procedure cairo_show_page(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  371. (* Insideness testing *)
  372. function cairo_in_stroke(cr: Pcairo_t; x, y: Double): cairo_bool_t; cdecl; external LIB_CAIRO;
  373. function cairo_in_fill(cr: Pcairo_t; x, y: Double): cairo_bool_t; cdecl; external LIB_CAIRO;
  374. (* Rectangular extents *)
  375. procedure cairo_stroke_extents(cr: Pcairo_t; x1, y1, x2, y2: PDouble); cdecl; external LIB_CAIRO;
  376. procedure cairo_fill_extents(cr: Pcairo_t; x1, y1, x2, y2: PDouble); cdecl; external LIB_CAIRO;
  377. (* Clipping *)
  378. procedure cairo_reset_clip(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  379. procedure cairo_clip(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  380. procedure cairo_clip_preserve(cr: Pcairo_t); cdecl; external LIB_CAIRO;
  381. procedure cairo_clip_extents(cr: Pcairo_t; x1, y1, x2, y2: PDouble); cdecl; external LIB_CAIRO;
  382. function cairo_copy_clip_rectangle_list(cr: Pcairo_t): Pcairo_rectangle_list_t; cdecl; external LIB_CAIRO;
  383. procedure cairo_rectangle_list_destroy(rectangle_list: Pcairo_rectangle_list_t); cdecl; external LIB_CAIRO;
  384. (* Font/Text functions *)
  385. function cairo_font_options_create: Pcairo_font_options_t; cdecl; external LIB_CAIRO;
  386. function cairo_font_options_copy(original: Pcairo_font_options_t): Pcairo_font_options_t; cdecl; external LIB_CAIRO;
  387. procedure cairo_font_options_destroy(options: Pcairo_font_options_t); cdecl; external LIB_CAIRO;
  388. function cairo_font_options_status(options: Pcairo_font_options_t): cairo_status_t; cdecl; external LIB_CAIRO;
  389. procedure cairo_font_options_merge(options, other: Pcairo_font_options_t); cdecl; external LIB_CAIRO;
  390. function cairo_font_options_equal(options, other: Pcairo_font_options_t): cairo_bool_t; cdecl; external LIB_CAIRO;
  391. function cairo_font_options_hash(options: Pcairo_font_options_t): LongWord; cdecl; external LIB_CAIRO;
  392. procedure cairo_font_options_set_antialias(options: Pcairo_font_options_t; antialias: cairo_antialias_t); cdecl; external LIB_CAIRO;
  393. function cairo_font_options_get_antialias(options: Pcairo_font_options_t): cairo_antialias_t; cdecl; external LIB_CAIRO;
  394. procedure cairo_font_options_set_subpixel_order(options: Pcairo_font_options_t; subpixel_order: cairo_subpixel_order_t); cdecl; external LIB_CAIRO;
  395. function cairo_font_options_get_subpixel_order(options: Pcairo_font_options_t): cairo_subpixel_order_t; cdecl; external LIB_CAIRO;
  396. procedure cairo_font_options_set_hint_style(options: Pcairo_font_options_t; hint_style: cairo_hint_style_t); cdecl; external LIB_CAIRO;
  397. function cairo_font_options_get_hint_style(options: Pcairo_font_options_t): cairo_hint_style_t; cdecl; external LIB_CAIRO;
  398. procedure cairo_font_options_set_hint_metrics(options: Pcairo_font_options_t; hint_metrics: cairo_hint_metrics_t); cdecl; external LIB_CAIRO;
  399. function cairo_font_options_get_hint_metrics(options: Pcairo_font_options_t): cairo_hint_metrics_t; cdecl; external LIB_CAIRO;
  400. (* This interface is for dealing with text as text, not caring about the
  401. font object inside the the cairo_t. *)
  402. procedure cairo_select_font_face(cr: Pcairo_t; family: Pchar; slant: cairo_font_slant_t; weight: cairo_font_weight_t); cdecl; external LIB_CAIRO;
  403. procedure cairo_set_font_size(cr: Pcairo_t; size: Double); cdecl; external LIB_CAIRO;
  404. procedure cairo_set_font_matrix(cr: Pcairo_t; matrix: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  405. procedure cairo_get_font_matrix(cr: Pcairo_t; matrix: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  406. procedure cairo_set_font_options(cr: Pcairo_t; options: Pcairo_font_options_t); cdecl; external LIB_CAIRO;
  407. procedure cairo_get_font_options(cr: Pcairo_t; options: Pcairo_font_options_t); cdecl; external LIB_CAIRO;
  408. procedure cairo_set_font_face(cr: Pcairo_t; font_face: Pcairo_font_face_t); cdecl; external LIB_CAIRO;
  409. function cairo_get_font_face(cr: Pcairo_t): Pcairo_font_face_t; cdecl; external LIB_CAIRO;
  410. procedure cairo_set_scaled_font(cr: PCairo_t; scaled_font:Pcairo_scaled_font_t); cdecl; external LIB_CAIRO;
  411. function cairo_get_scaled_font(cr: Pcairo_t): Pcairo_scaled_font_t; cdecl; external LIB_CAIRO;
  412. procedure cairo_show_text(cr: Pcairo_t; utf8: Pchar); cdecl; external LIB_CAIRO;
  413. procedure cairo_show_glyphs(cr: Pcairo_t; glyphs: Pcairo_glyph_t; num_glyphs: LongInt); cdecl; external LIB_CAIRO;
  414. procedure cairo_text_path(cr: Pcairo_t; utf8: Pchar); cdecl; external LIB_CAIRO;
  415. procedure cairo_glyph_path(cr: Pcairo_t; glyphs: Pcairo_glyph_t; num_glyphs: LongInt); cdecl; external LIB_CAIRO;
  416. procedure cairo_text_extents(cr: Pcairo_t; utf8: Pchar; extents: Pcairo_text_extents_t); cdecl; external LIB_CAIRO;
  417. procedure cairo_glyph_extents(cr: Pcairo_t; glyphs: Pcairo_glyph_t; num_glyphs: LongInt; extents: Pcairo_text_extents_t); cdecl; external LIB_CAIRO;
  418. procedure cairo_font_extents(cr: Pcairo_t; extents: Pcairo_font_extents_t); cdecl; external LIB_CAIRO;
  419. (* Generic identifier for a font style *)
  420. function cairo_font_face_reference(font_face: Pcairo_font_face_t): Pcairo_font_face_t; cdecl; external LIB_CAIRO;
  421. procedure cairo_font_face_destroy(font_face: Pcairo_font_face_t); cdecl; external LIB_CAIRO;
  422. function cairo_font_face_get_reference_count (font_face: Pcairo_font_face_t): LongWord; cdecl; external LIB_CAIRO;
  423. function cairo_font_face_status(font_face: Pcairo_font_face_t): cairo_status_t; cdecl; external LIB_CAIRO;
  424. function cairo_font_face_get_type(font_face: Pcairo_font_face_t): cairo_font_type_t; cdecl; external LIB_CAIRO;
  425. function cairo_font_face_get_user_data(font_face: Pcairo_font_face_t; key: Pcairo_user_data_key_t): pointer; cdecl; external LIB_CAIRO;
  426. function cairo_font_face_set_user_data(font_face: Pcairo_font_face_t; key: Pcairo_user_data_key_t; user_data: pointer; destroy: cairo_destroy_func_t): cairo_status_t; cdecl; external LIB_CAIRO;
  427. (* Portable interface to general font features *)
  428. function cairo_scaled_font_create(font_face: Pcairo_font_face_t; font_matrix: Pcairo_matrix_t; ctm: Pcairo_matrix_t; options: Pcairo_font_options_t): Pcairo_scaled_font_t; cdecl; external LIB_CAIRO;
  429. function cairo_scaled_font_reference(scaled_font: Pcairo_scaled_font_t): Pcairo_scaled_font_t; cdecl; external LIB_CAIRO;
  430. procedure cairo_scaled_font_destroy(scaled_font: Pcairo_scaled_font_t); cdecl; external LIB_CAIRO;
  431. function cairo_scaled_font_get_reference_count (scaled_font: Pcairo_scaled_font_t): LongWord; cdecl; external LIB_CAIRO;
  432. function cairo_scaled_font_status(scaled_font: Pcairo_scaled_font_t): cairo_status_t; cdecl; external LIB_CAIRO;
  433. function cairo_scaled_font_get_type(scaled_font: Pcairo_scaled_font_t): cairo_font_type_t; cdecl; external LIB_CAIRO;
  434. function cairo_scaled_font_get_user_data (scaled_font: Pcairo_scaled_font_t; key: Pcairo_user_data_key_t): Pointer; cdecl; external LIB_CAIRO;
  435. function cairo_scaled_font_set_user_data (scaled_font: Pcairo_scaled_font_t; key: Pcairo_user_data_key_t; user_data: Pointer; destroy: cairo_destroy_func_t): cairo_status_t; cdecl; external LIB_CAIRO;
  436. procedure cairo_scaled_font_extents(scaled_font: Pcairo_scaled_font_t; extents: Pcairo_font_extents_t); cdecl; external LIB_CAIRO;
  437. procedure cairo_scaled_font_text_extents(scaled_font: Pcairo_scaled_font_t; utf8: PChar; extents: Pcairo_text_extents_t); cdecl; external LIB_CAIRO;
  438. procedure cairo_scaled_font_glyph_extents(scaled_font: Pcairo_scaled_font_t; glyphs: Pcairo_glyph_t; num_glyphs: LongInt; extents: Pcairo_text_extents_t); cdecl; external LIB_CAIRO;
  439. function cairo_scaled_font_get_font_face (scaled_font: Pcairo_scaled_font_t): Pcairo_font_face_t; cdecl; external LIB_CAIRO;
  440. procedure cairo_scaled_font_get_font_matrix (scaled_font: Pcairo_scaled_font_t; font_matrix: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  441. procedure cairo_scaled_font_get_ctm (scaled_font: Pcairo_scaled_font_t; ctm: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  442. procedure cairo_scaled_font_get_font_options (scaled_font: Pcairo_scaled_font_t; options: Pcairo_font_options_t); cdecl; external LIB_CAIRO;
  443. (* Query functions *)
  444. function cairo_get_operator(cr: Pcairo_t): cairo_operator_t; cdecl; external LIB_CAIRO;
  445. function cairo_get_source(cr: Pcairo_t): Pcairo_pattern_t; cdecl; external LIB_CAIRO;
  446. function cairo_get_tolerance(cr: Pcairo_t): Double; cdecl; external LIB_CAIRO;
  447. function cairo_get_antialias(cr: Pcairo_t): cairo_antialias_t; cdecl; external LIB_CAIRO;
  448. procedure cairo_get_current_point(cr: Pcairo_t; x, y: PDouble); cdecl; external LIB_CAIRO;
  449. function cairo_get_fill_rule(cr: Pcairo_t): cairo_fill_rule_t; cdecl; external LIB_CAIRO;
  450. function cairo_get_line_width(cr: Pcairo_t): Double; cdecl; external LIB_CAIRO;
  451. function cairo_get_line_cap(cr: Pcairo_t): cairo_line_cap_t; cdecl; external LIB_CAIRO;
  452. function cairo_get_line_join(cr: Pcairo_t): cairo_line_join_t; cdecl; external LIB_CAIRO;
  453. function cairo_get_miter_limit(cr: Pcairo_t): Double; cdecl; external LIB_CAIRO;
  454. function cairo_get_dash_count(cr: Pcairo_t): LongInt; cdecl; external LIB_CAIRO;
  455. procedure cairo_get_dash(cr: Pcairo_t; dashes, offset: PDouble); cdecl; external LIB_CAIRO;
  456. procedure cairo_get_matrix(cr: Pcairo_t; matrix: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  457. function cairo_get_target(cr: Pcairo_t): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  458. function cairo_get_group_target(cr: Pcairo_t): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  459. function cairo_copy_path(cr: Pcairo_t): Pcairo_path_t; cdecl; external LIB_CAIRO;
  460. function cairo_copy_path_flat(cr: Pcairo_t): Pcairo_path_t; cdecl; external LIB_CAIRO;
  461. procedure cairo_append_path(cr: Pcairo_t; path: Pcairo_path_t); cdecl; external LIB_CAIRO;
  462. procedure cairo_path_destroy(path: Pcairo_path_t); cdecl; external LIB_CAIRO;
  463. (* Error status queries *)
  464. function cairo_status(cr: Pcairo_t): cairo_status_t; cdecl; external LIB_CAIRO;
  465. function cairo_status_to_string(status: cairo_status_t): Pchar; cdecl; external LIB_CAIRO;
  466. (* Surface manipulation *)
  467. function cairo_surface_create_similar(other: Pcairo_surface_t; content: cairo_content_t; width, height: LongInt): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  468. function cairo_surface_reference(surface: Pcairo_surface_t): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  469. procedure cairo_surface_finish(surface: Pcairo_surface_t); cdecl; external LIB_CAIRO;
  470. procedure cairo_surface_destroy(surface: Pcairo_surface_t); cdecl; external LIB_CAIRO;
  471. function cairo_surface_get_reference_count(surface: Pcairo_surface_t): LongWord; cdecl; external LIB_CAIRO;
  472. function cairo_surface_status(surface: Pcairo_surface_t): cairo_status_t; cdecl; external LIB_CAIRO;
  473. function cairo_surface_get_type(surface: Pcairo_surface_t): cairo_surface_type_t; cdecl; external LIB_CAIRO;
  474. function cairo_surface_get_content(surface: Pcairo_surface_t): cairo_content_t; cdecl; external LIB_CAIRO;
  475. function cairo_surface_write_to_png(surface: Pcairo_surface_t; filename: Pchar): cairo_status_t; cdecl; external LIB_CAIRO;
  476. function cairo_surface_write_to_png_stream(surface: Pcairo_surface_t; write_func: cairo_write_func_t; closure: pointer): cairo_status_t; cdecl; external LIB_CAIRO;
  477. function cairo_surface_get_user_data(surface: Pcairo_surface_t; key: Pcairo_user_data_key_t): pointer; cdecl; external LIB_CAIRO;
  478. function cairo_surface_set_user_data(surface: Pcairo_surface_t; key: Pcairo_user_data_key_t; user_data: pointer; destroy: cairo_destroy_func_t): cairo_status_t; cdecl; external LIB_CAIRO;
  479. procedure cairo_surface_get_font_options(surface: Pcairo_surface_t; options: Pcairo_font_options_t); cdecl; external LIB_CAIRO;
  480. procedure cairo_surface_flush(surface: Pcairo_surface_t); cdecl; external LIB_CAIRO;
  481. procedure cairo_surface_mark_dirty(surface: Pcairo_surface_t); cdecl; external LIB_CAIRO;
  482. procedure cairo_surface_mark_dirty_rectangle(surface: Pcairo_surface_t; x, y, width, height: LongInt); cdecl; external LIB_CAIRO;
  483. procedure cairo_surface_set_device_offset(surface: Pcairo_surface_t; x_offset, y_offset: Double); cdecl; external LIB_CAIRO;
  484. procedure cairo_surface_get_device_offset(surface: Pcairo_surface_t; x_offset, y_offset: PDouble); cdecl; external LIB_CAIRO;
  485. procedure cairo_surface_set_fallback_resolution(surface: Pcairo_surface_t; x_pixels_per_inch, y_pixels_per_inch: Double); cdecl; external LIB_CAIRO;
  486. (* Image-surface functions *)
  487. function cairo_image_surface_create(format: cairo_format_t; width, height: LongInt): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  488. function cairo_image_surface_create_for_data(data: Pbyte; format: cairo_format_t; width, height, stride: LongInt): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  489. function cairo_image_surface_get_data(surface: Pcairo_surface_t): PChar; cdecl; external LIB_CAIRO;
  490. function cairo_image_surface_get_format(surface: Pcairo_surface_t): cairo_format_t; cdecl; external LIB_CAIRO;
  491. function cairo_image_surface_get_width(surface: Pcairo_surface_t): LongInt; cdecl; external LIB_CAIRO;
  492. function cairo_image_surface_get_height(surface: Pcairo_surface_t): LongInt; cdecl; external LIB_CAIRO;
  493. function cairo_image_surface_get_stride(surface: Pcairo_surface_t): LongInt; cdecl; external LIB_CAIRO;
  494. function cairo_image_surface_create_from_png(filename: Pchar): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  495. function cairo_image_surface_create_from_png_stream(read_func: cairo_read_func_t; closure: pointer): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  496. (* Pattern creation functions *)
  497. function cairo_pattern_create_rgb(red, green, blue: Double): Pcairo_pattern_t; cdecl; external LIB_CAIRO;
  498. function cairo_pattern_create_rgba(red, green, blue, alpha: Double): Pcairo_pattern_t; cdecl; external LIB_CAIRO;
  499. function cairo_pattern_create_for_surface(surface: Pcairo_surface_t): Pcairo_pattern_t; cdecl; external LIB_CAIRO;
  500. function cairo_pattern_create_linear(x0, y0, x1, y1: Double): Pcairo_pattern_t; cdecl; external LIB_CAIRO;
  501. function cairo_pattern_create_radial(cx0, cy0, radius0, cx1, cy1, radius1: Double): Pcairo_pattern_t; cdecl; external LIB_CAIRO;
  502. function cairo_pattern_reference(pattern: Pcairo_pattern_t): Pcairo_pattern_t; cdecl; external LIB_CAIRO;
  503. procedure cairo_pattern_destroy(pattern: Pcairo_pattern_t); cdecl; external LIB_CAIRO;
  504. function cairo_pattern_get_reference_count (pattern: Pcairo_pattern_t): LongWord; cdecl; external LIB_CAIRO;
  505. function cairo_pattern_status(pattern: Pcairo_pattern_t): cairo_status_t; cdecl; external LIB_CAIRO;
  506. function cairo_pattern_get_user_data (pattern: Pcairo_pattern_t; key: Pcairo_user_data_key_t): Pointer; cdecl; external LIB_CAIRO;
  507. function cairo_pattern_set_user_data (pattern: Pcairo_pattern_t; key: Pcairo_user_data_key_t; user_data: Pointer; destroy: cairo_destroy_func_t): cairo_status_t; cdecl; external LIB_CAIRO;
  508. function cairo_pattern_get_type(pattern: Pcairo_pattern_t): cairo_pattern_type_t; cdecl; external LIB_CAIRO;
  509. procedure cairo_pattern_add_color_stop_rgb(pattern: Pcairo_pattern_t; offset, red, green, blue: Double); cdecl; external LIB_CAIRO;
  510. procedure cairo_pattern_add_color_stop_rgba(pattern: Pcairo_pattern_t; offset, red, green, blue, alpha: Double); cdecl; external LIB_CAIRO;
  511. procedure cairo_pattern_set_matrix(pattern: Pcairo_pattern_t; matrix: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  512. procedure cairo_pattern_get_matrix(pattern: Pcairo_pattern_t; matrix: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  513. procedure cairo_pattern_set_extend(pattern: Pcairo_pattern_t; extend: cairo_extend_t); cdecl; external LIB_CAIRO;
  514. function cairo_pattern_get_extend(pattern: Pcairo_pattern_t): cairo_extend_t; cdecl; external LIB_CAIRO;
  515. procedure cairo_pattern_set_filter(pattern: Pcairo_pattern_t; filter: cairo_filter_t); cdecl; external LIB_CAIRO;
  516. function cairo_pattern_get_filter(pattern: Pcairo_pattern_t): cairo_filter_t; cdecl; external LIB_CAIRO;
  517. function cairo_pattern_get_rgba (pattern: Pcairo_pattern_t; red, green, blue, alpha: PDouble): cairo_status_t; cdecl; external LIB_CAIRO;
  518. function cairo_pattern_get_surface (pattern: Pcairo_pattern_t; surface: PPcairo_surface_t): cairo_status_t; cdecl; external LIB_CAIRO;
  519. function cairo_pattern_get_color_stop_rgba(pattern: Pcairo_pattern_t; index: LongInt; offset, red, green, blue, alpha: PDouble):cairo_status_t; cdecl; external LIB_CAIRO;
  520. function cairo_pattern_get_color_stop_count(pattern: Pcairo_pattern_t; count: PLongInt):cairo_status_t; cdecl; external LIB_CAIRO;
  521. function cairo_pattern_get_linear_points (pattern: Pcairo_pattern_t; x0, y0, x1, y1: PDouble): cairo_status_t; cdecl; external LIB_CAIRO;
  522. function cairo_pattern_get_radial_circles (pattern: Pcairo_pattern_t; x0, y0, r0, x1, y1, r1:PDouble): cairo_status_t; cdecl; external LIB_CAIRO;
  523. (* Matrix functions *)
  524. procedure cairo_matrix_init(matrix: Pcairo_matrix_t; xx, yx, xy, yy, x0, y0: Double); cdecl; external LIB_CAIRO;
  525. procedure cairo_matrix_init_identity(matrix: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  526. procedure cairo_matrix_init_translate(matrix: Pcairo_matrix_t; tx, ty: Double); cdecl; external LIB_CAIRO;
  527. procedure cairo_matrix_init_scale(matrix: Pcairo_matrix_t; sx, sy: Double); cdecl; external LIB_CAIRO;
  528. procedure cairo_matrix_init_rotate(matrix: Pcairo_matrix_t; radians: Double); cdecl; external LIB_CAIRO;
  529. procedure cairo_matrix_translate(matrix: Pcairo_matrix_t; tx, ty: Double); cdecl; external LIB_CAIRO;
  530. procedure cairo_matrix_scale(matrix: Pcairo_matrix_t; sx, sy: Double); cdecl; external LIB_CAIRO;
  531. procedure cairo_matrix_rotate(matrix: Pcairo_matrix_t; radians: Double); cdecl; external LIB_CAIRO;
  532. function cairo_matrix_invert(matrix: Pcairo_matrix_t): cairo_status_t; cdecl; external LIB_CAIRO;
  533. procedure cairo_matrix_multiply(result, a, b: Pcairo_matrix_t); cdecl; external LIB_CAIRO;
  534. procedure cairo_matrix_transform_distance(matrix: Pcairo_matrix_t; dx, dy: PDouble); cdecl; external LIB_CAIRO;
  535. procedure cairo_matrix_transform_point(matrix: Pcairo_matrix_t; x, y: PDouble); cdecl; external LIB_CAIRO;
  536. (* PDF functions *)
  537. function cairo_pdf_surface_create(filename: PChar; width_in_points, height_in_points: Double): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  538. function cairo_pdf_surface_create_for_stream(write_func: cairo_write_func_t; closure: Pointer; width_in_points, height_in_points: Double): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  539. procedure cairo_pdf_surface_set_size(surface: Pcairo_surface_t; width_in_points, height_in_points: Double); cdecl; external LIB_CAIRO;
  540. (* PS functions *)
  541. function cairo_ps_surface_create(filename: PChar; width_in_points, height_in_points: Double): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  542. function cairo_ps_surface_create_for_stream(write_func: cairo_write_func_t; closure: Pointer; width_in_points, height_in_points: Double): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  543. procedure cairo_ps_surface_set_size(surface: Pcairo_surface_t; width_in_points, height_in_points: Double); cdecl; external LIB_CAIRO;
  544. procedure cairo_ps_surface_dsc_comment(surface: Pcairo_surface_t; comment: PChar); cdecl; external LIB_CAIRO;
  545. procedure cairo_ps_surface_dsc_begin_setup(surface: Pcairo_surface_t); cdecl; external LIB_CAIRO;
  546. procedure cairo_ps_surface_dsc_begin_page_setup(surface: Pcairo_surface_t); cdecl; external LIB_CAIRO;
  547. (* SVG functions *)
  548. function cairo_svg_surface_create(filename: PChar; width_in_points, height_in_points: Double): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  549. function cairo_svg_surface_create_for_stream(write_func: cairo_write_func_t; closure: Pointer; width_in_points, height_in_points: Double): Pcairo_surface_t; cdecl; external LIB_CAIRO;
  550. procedure cairo_svg_surface_restrict_to_version(surface: Pcairo_surface_t; version: cairo_svg_version_t); cdecl; external LIB_CAIRO;
  551. procedure cairo_svg_get_versions(versions: ppcairo_svg_version_t;num_versions:pcint);cdecl; external LIB_CAIRO;
  552. function cairo_svg_version_to_string(version: cairo_svg_version_t): PChar; cdecl; external LIB_CAIRO;
  553. (* Functions to be used while debugging (not intended for use in production code) *)
  554. procedure cairo_debug_reset_static_data; cdecl; external LIB_CAIRO;
  555. implementation
  556. procedure cairo_version(out major, minor, micro: LongInt);
  557. var
  558. version: LongInt;
  559. begin
  560. version := cairo_version;
  561. major := version div 10000;
  562. minor := (version mod (major * 10000)) div 100;
  563. micro := (version mod ((major * 10000) + (minor * 100)));
  564. end;
  565. end.