cairo.h 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186
  1. /* cairo - a vector graphics library with display and print output
  2. *
  3. * Copyright © 2002 University of Southern California
  4. * Copyright © 2005 Red Hat, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it either under the terms of the GNU Lesser General Public
  8. * License version 2.1 as published by the Free Software Foundation
  9. * (the "LGPL") or, at your option, under the terms of the Mozilla
  10. * Public License Version 1.1 (the "MPL"). If you do not alter this
  11. * notice, a recipient may use your version of this file under either
  12. * the MPL or the LGPL.
  13. *
  14. * You should have received a copy of the LGPL along with this library
  15. * in the file COPYING-LGPL-2.1; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
  17. * You should have received a copy of the MPL along with this library
  18. * in the file COPYING-MPL-1.1
  19. *
  20. * The contents of this file are subject to the Mozilla Public License
  21. * Version 1.1 (the "License"); you may not use this file except in
  22. * compliance with the License. You may obtain a copy of the License at
  23. * http://www.mozilla.org/MPL/
  24. *
  25. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
  26. * OF ANY KIND, either express or implied. See the LGPL or the MPL for
  27. * the specific language governing rights and limitations.
  28. *
  29. * The Original Code is the cairo graphics library.
  30. *
  31. * The Initial Developer of the Original Code is University of Southern
  32. * California.
  33. *
  34. * Contributor(s):
  35. * Carl D. Worth <cworth@cworth.org>
  36. */
  37. #ifndef CAIRO_H
  38. #define CAIRO_H
  39. #include "cairo-version.h"
  40. #include "cairo-features.h"
  41. #include "cairo-deprecated.h"
  42. #ifdef __cplusplus
  43. # define CAIRO_BEGIN_DECLS extern "C" {
  44. # define CAIRO_END_DECLS }
  45. #else
  46. # define CAIRO_BEGIN_DECLS
  47. # define CAIRO_END_DECLS
  48. #endif
  49. #ifndef cairo_public
  50. # if defined (_MSC_VER) && ! defined (CAIRO_WIN32_STATIC_BUILD)
  51. # define cairo_public __declspec(dllimport)
  52. # else
  53. # define cairo_public
  54. # endif
  55. #endif
  56. CAIRO_BEGIN_DECLS
  57. #define CAIRO_VERSION_ENCODE(major, minor, micro) ( \
  58. ((major) * 10000) \
  59. + ((minor) * 100) \
  60. + ((micro) * 1))
  61. #define CAIRO_VERSION CAIRO_VERSION_ENCODE( \
  62. CAIRO_VERSION_MAJOR, \
  63. CAIRO_VERSION_MINOR, \
  64. CAIRO_VERSION_MICRO)
  65. #define CAIRO_VERSION_STRINGIZE_(major, minor, micro) \
  66. #major"."#minor"."#micro
  67. #define CAIRO_VERSION_STRINGIZE(major, minor, micro) \
  68. CAIRO_VERSION_STRINGIZE_(major, minor, micro)
  69. #define CAIRO_VERSION_STRING CAIRO_VERSION_STRINGIZE( \
  70. CAIRO_VERSION_MAJOR, \
  71. CAIRO_VERSION_MINOR, \
  72. CAIRO_VERSION_MICRO)
  73. cairo_public int
  74. cairo_version (void);
  75. cairo_public const char*
  76. cairo_version_string (void);
  77. /**
  78. * cairo_bool_t:
  79. *
  80. * #cairo_bool_t is used for boolean values. Returns of type
  81. * #cairo_bool_t will always be either 0 or 1, but testing against
  82. * these values explicitly is not encouraged; just use the
  83. * value as a boolean condition.
  84. *
  85. * <informalexample><programlisting>
  86. * if (cairo_in_stroke (cr, x, y)) {
  87. * /<!-- -->* do something *<!-- -->/
  88. * }
  89. * </programlisting></informalexample>
  90. *
  91. * Since: 1.0
  92. **/
  93. typedef int cairo_bool_t;
  94. /**
  95. * cairo_t:
  96. *
  97. * A #cairo_t contains the current state of the rendering device,
  98. * including coordinates of yet to be drawn shapes.
  99. *
  100. * Cairo contexts, as #cairo_t objects are named, are central to
  101. * cairo and all drawing with cairo is always done to a #cairo_t
  102. * object.
  103. *
  104. * Memory management of #cairo_t is done with
  105. * cairo_reference() and cairo_destroy().
  106. *
  107. * Since: 1.0
  108. **/
  109. typedef struct _cairo cairo_t;
  110. /**
  111. * cairo_surface_t:
  112. *
  113. * A #cairo_surface_t represents an image, either as the destination
  114. * of a drawing operation or as source when drawing onto another
  115. * surface. To draw to a #cairo_surface_t, create a cairo context
  116. * with the surface as the target, using cairo_create().
  117. *
  118. * There are different subtypes of #cairo_surface_t for
  119. * different drawing backends; for example, cairo_image_surface_create()
  120. * creates a bitmap image in memory.
  121. * The type of a surface can be queried with cairo_surface_get_type().
  122. *
  123. * The initial contents of a surface after creation depend upon the manner
  124. * of its creation. If cairo creates the surface and backing storage for
  125. * the user, it will be initially cleared; for example,
  126. * cairo_image_surface_create() and cairo_surface_create_similar().
  127. * Alternatively, if the user passes in a reference to some backing storage
  128. * and asks cairo to wrap that in a #cairo_surface_t, then the contents are
  129. * not modified; for example, cairo_image_surface_create_for_data() and
  130. * cairo_xlib_surface_create().
  131. *
  132. * Memory management of #cairo_surface_t is done with
  133. * cairo_surface_reference() and cairo_surface_destroy().
  134. *
  135. * Since: 1.0
  136. **/
  137. typedef struct _cairo_surface cairo_surface_t;
  138. /**
  139. * cairo_device_t:
  140. *
  141. * A #cairo_device_t represents the driver interface for drawing
  142. * operations to a #cairo_surface_t. There are different subtypes of
  143. * #cairo_device_t for different drawing backends; for example,
  144. * cairo_egl_device_create() creates a device that wraps an EGL display and
  145. * context.
  146. *
  147. * The type of a device can be queried with cairo_device_get_type().
  148. *
  149. * Memory management of #cairo_device_t is done with
  150. * cairo_device_reference() and cairo_device_destroy().
  151. *
  152. * Since: 1.10
  153. **/
  154. typedef struct _cairo_device cairo_device_t;
  155. /**
  156. * cairo_matrix_t:
  157. * @xx: xx component of the affine transformation
  158. * @yx: yx component of the affine transformation
  159. * @xy: xy component of the affine transformation
  160. * @yy: yy component of the affine transformation
  161. * @x0: X translation component of the affine transformation
  162. * @y0: Y translation component of the affine transformation
  163. *
  164. * A #cairo_matrix_t holds an affine transformation, such as a scale,
  165. * rotation, shear, or a combination of those. The transformation of
  166. * a point (x, y) is given by:
  167. * <programlisting>
  168. * x_new = xx * x + xy * y + x0;
  169. * y_new = yx * x + yy * y + y0;
  170. * </programlisting>
  171. *
  172. * Since: 1.0
  173. **/
  174. typedef struct _cairo_matrix {
  175. double xx; double yx;
  176. double xy; double yy;
  177. double x0; double y0;
  178. } cairo_matrix_t;
  179. /**
  180. * cairo_pattern_t:
  181. *
  182. * A #cairo_pattern_t represents a source when drawing onto a
  183. * surface. There are different subtypes of #cairo_pattern_t,
  184. * for different types of sources; for example,
  185. * cairo_pattern_create_rgb() creates a pattern for a solid
  186. * opaque color.
  187. *
  188. * Other than various
  189. * <function>cairo_pattern_create_<emphasis>type</emphasis>()</function>
  190. * functions, some of the pattern types can be implicitly created using various
  191. * <function>cairo_set_source_<emphasis>type</emphasis>()</function> functions;
  192. * for example cairo_set_source_rgb().
  193. *
  194. * The type of a pattern can be queried with cairo_pattern_get_type().
  195. *
  196. * Memory management of #cairo_pattern_t is done with
  197. * cairo_pattern_reference() and cairo_pattern_destroy().
  198. *
  199. * Since: 1.0
  200. **/
  201. typedef struct _cairo_pattern cairo_pattern_t;
  202. /**
  203. * cairo_destroy_func_t:
  204. * @data: The data element being destroyed.
  205. *
  206. * #cairo_destroy_func_t the type of function which is called when a
  207. * data element is destroyed. It is passed the pointer to the data
  208. * element and should free any memory and resources allocated for it.
  209. *
  210. * Since: 1.0
  211. **/
  212. typedef void (*cairo_destroy_func_t) (void *data);
  213. /**
  214. * cairo_user_data_key_t:
  215. * @unused: not used; ignore.
  216. *
  217. * #cairo_user_data_key_t is used for attaching user data to cairo
  218. * data structures. The actual contents of the struct is never used,
  219. * and there is no need to initialize the object; only the unique
  220. * address of a #cairo_data_key_t object is used. Typically, you
  221. * would just use the address of a static #cairo_data_key_t object.
  222. *
  223. * Since: 1.0
  224. **/
  225. typedef struct _cairo_user_data_key {
  226. int unused;
  227. } cairo_user_data_key_t;
  228. /**
  229. * cairo_status_t:
  230. * @CAIRO_STATUS_SUCCESS: no error has occurred (Since 1.0)
  231. * @CAIRO_STATUS_NO_MEMORY: out of memory (Since 1.0)
  232. * @CAIRO_STATUS_INVALID_RESTORE: cairo_restore() called without matching cairo_save() (Since 1.0)
  233. * @CAIRO_STATUS_INVALID_POP_GROUP: no saved group to pop, i.e. cairo_pop_group() without matching cairo_push_group() (Since 1.0)
  234. * @CAIRO_STATUS_NO_CURRENT_POINT: no current point defined (Since 1.0)
  235. * @CAIRO_STATUS_INVALID_MATRIX: invalid matrix (not invertible) (Since 1.0)
  236. * @CAIRO_STATUS_INVALID_STATUS: invalid value for an input #cairo_status_t (Since 1.0)
  237. * @CAIRO_STATUS_NULL_POINTER: %NULL pointer (Since 1.0)
  238. * @CAIRO_STATUS_INVALID_STRING: input string not valid UTF-8 (Since 1.0)
  239. * @CAIRO_STATUS_INVALID_PATH_DATA: input path data not valid (Since 1.0)
  240. * @CAIRO_STATUS_READ_ERROR: error while reading from input stream (Since 1.0)
  241. * @CAIRO_STATUS_WRITE_ERROR: error while writing to output stream (Since 1.0)
  242. * @CAIRO_STATUS_SURFACE_FINISHED: target surface has been finished (Since 1.0)
  243. * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH: the surface type is not appropriate for the operation (Since 1.0)
  244. * @CAIRO_STATUS_PATTERN_TYPE_MISMATCH: the pattern type is not appropriate for the operation (Since 1.0)
  245. * @CAIRO_STATUS_INVALID_CONTENT: invalid value for an input #cairo_content_t (Since 1.0)
  246. * @CAIRO_STATUS_INVALID_FORMAT: invalid value for an input #cairo_format_t (Since 1.0)
  247. * @CAIRO_STATUS_INVALID_VISUAL: invalid value for an input Visual* (Since 1.0)
  248. * @CAIRO_STATUS_FILE_NOT_FOUND: file not found (Since 1.0)
  249. * @CAIRO_STATUS_INVALID_DASH: invalid value for a dash setting (Since 1.0)
  250. * @CAIRO_STATUS_INVALID_DSC_COMMENT: invalid value for a DSC comment (Since 1.2)
  251. * @CAIRO_STATUS_INVALID_INDEX: invalid index passed to getter (Since 1.4)
  252. * @CAIRO_STATUS_CLIP_NOT_REPRESENTABLE: clip region not representable in desired format (Since 1.4)
  253. * @CAIRO_STATUS_TEMP_FILE_ERROR: error creating or writing to a temporary file (Since 1.6)
  254. * @CAIRO_STATUS_INVALID_STRIDE: invalid value for stride (Since 1.6)
  255. * @CAIRO_STATUS_FONT_TYPE_MISMATCH: the font type is not appropriate for the operation (Since 1.8)
  256. * @CAIRO_STATUS_USER_FONT_IMMUTABLE: the user-font is immutable (Since 1.8)
  257. * @CAIRO_STATUS_USER_FONT_ERROR: error occurred in a user-font callback function (Since 1.8)
  258. * @CAIRO_STATUS_NEGATIVE_COUNT: negative number used where it is not allowed (Since 1.8)
  259. * @CAIRO_STATUS_INVALID_CLUSTERS: input clusters do not represent the accompanying text and glyph array (Since 1.8)
  260. * @CAIRO_STATUS_INVALID_SLANT: invalid value for an input #cairo_font_slant_t (Since 1.8)
  261. * @CAIRO_STATUS_INVALID_WEIGHT: invalid value for an input #cairo_font_weight_t (Since 1.8)
  262. * @CAIRO_STATUS_INVALID_SIZE: invalid value (typically too big) for the size of the input (surface, pattern, etc.) (Since 1.10)
  263. * @CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED: user-font method not implemented (Since 1.10)
  264. * @CAIRO_STATUS_DEVICE_TYPE_MISMATCH: the device type is not appropriate for the operation (Since 1.10)
  265. * @CAIRO_STATUS_DEVICE_ERROR: an operation to the device caused an unspecified error (Since 1.10)
  266. * @CAIRO_STATUS_INVALID_MESH_CONSTRUCTION: a mesh pattern
  267. * construction operation was used outside of a
  268. * cairo_mesh_pattern_begin_patch()/cairo_mesh_pattern_end_patch()
  269. * pair (Since 1.12)
  270. * @CAIRO_STATUS_DEVICE_FINISHED: target device has been finished (Since 1.12)
  271. * @CAIRO_STATUS_JBIG2_GLOBAL_MISSING: %CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID has been used on at least one image
  272. * but no image provided %CAIRO_MIME_TYPE_JBIG2_GLOBAL (Since 1.14)
  273. * @CAIRO_STATUS_PNG_ERROR: error occurred in libpng while reading from or writing to a PNG file (Since 1.16)
  274. * @CAIRO_STATUS_FREETYPE_ERROR: error occurred in libfreetype (Since 1.16)
  275. * @CAIRO_STATUS_WIN32_GDI_ERROR: error occurred in the Windows Graphics Device Interface (Since 1.16)
  276. * @CAIRO_STATUS_TAG_ERROR: invalid tag name, attributes, or nesting (Since 1.16)
  277. * @CAIRO_STATUS_LAST_STATUS: this is a special value indicating the number of
  278. * status values defined in this enumeration. When using this value, note
  279. * that the version of cairo at run-time may have additional status values
  280. * defined than the value of this symbol at compile-time. (Since 1.10)
  281. *
  282. * #cairo_status_t is used to indicate errors that can occur when
  283. * using Cairo. In some cases it is returned directly by functions.
  284. * but when using #cairo_t, the last error, if any, is stored in
  285. * the context and can be retrieved with cairo_status().
  286. *
  287. * New entries may be added in future versions. Use cairo_status_to_string()
  288. * to get a human-readable representation of an error message.
  289. *
  290. * Since: 1.0
  291. **/
  292. typedef enum _cairo_status {
  293. CAIRO_STATUS_SUCCESS = 0,
  294. CAIRO_STATUS_NO_MEMORY,
  295. CAIRO_STATUS_INVALID_RESTORE,
  296. CAIRO_STATUS_INVALID_POP_GROUP,
  297. CAIRO_STATUS_NO_CURRENT_POINT,
  298. CAIRO_STATUS_INVALID_MATRIX,
  299. CAIRO_STATUS_INVALID_STATUS,
  300. CAIRO_STATUS_NULL_POINTER,
  301. CAIRO_STATUS_INVALID_STRING,
  302. CAIRO_STATUS_INVALID_PATH_DATA,
  303. CAIRO_STATUS_READ_ERROR,
  304. CAIRO_STATUS_WRITE_ERROR,
  305. CAIRO_STATUS_SURFACE_FINISHED,
  306. CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
  307. CAIRO_STATUS_PATTERN_TYPE_MISMATCH,
  308. CAIRO_STATUS_INVALID_CONTENT,
  309. CAIRO_STATUS_INVALID_FORMAT,
  310. CAIRO_STATUS_INVALID_VISUAL,
  311. CAIRO_STATUS_FILE_NOT_FOUND,
  312. CAIRO_STATUS_INVALID_DASH,
  313. CAIRO_STATUS_INVALID_DSC_COMMENT,
  314. CAIRO_STATUS_INVALID_INDEX,
  315. CAIRO_STATUS_CLIP_NOT_REPRESENTABLE,
  316. CAIRO_STATUS_TEMP_FILE_ERROR,
  317. CAIRO_STATUS_INVALID_STRIDE,
  318. CAIRO_STATUS_FONT_TYPE_MISMATCH,
  319. CAIRO_STATUS_USER_FONT_IMMUTABLE,
  320. CAIRO_STATUS_USER_FONT_ERROR,
  321. CAIRO_STATUS_NEGATIVE_COUNT,
  322. CAIRO_STATUS_INVALID_CLUSTERS,
  323. CAIRO_STATUS_INVALID_SLANT,
  324. CAIRO_STATUS_INVALID_WEIGHT,
  325. CAIRO_STATUS_INVALID_SIZE,
  326. CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED,
  327. CAIRO_STATUS_DEVICE_TYPE_MISMATCH,
  328. CAIRO_STATUS_DEVICE_ERROR,
  329. CAIRO_STATUS_INVALID_MESH_CONSTRUCTION,
  330. CAIRO_STATUS_DEVICE_FINISHED,
  331. CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
  332. CAIRO_STATUS_PNG_ERROR,
  333. CAIRO_STATUS_FREETYPE_ERROR,
  334. CAIRO_STATUS_WIN32_GDI_ERROR,
  335. CAIRO_STATUS_TAG_ERROR,
  336. CAIRO_STATUS_LAST_STATUS
  337. } cairo_status_t;
  338. /**
  339. * cairo_content_t:
  340. * @CAIRO_CONTENT_COLOR: The surface will hold color content only. (Since 1.0)
  341. * @CAIRO_CONTENT_ALPHA: The surface will hold alpha content only. (Since 1.0)
  342. * @CAIRO_CONTENT_COLOR_ALPHA: The surface will hold color and alpha content. (Since 1.0)
  343. *
  344. * #cairo_content_t is used to describe the content that a surface will
  345. * contain, whether color information, alpha information (translucence
  346. * vs. opacity), or both.
  347. *
  348. * Note: The large values here are designed to keep #cairo_content_t
  349. * values distinct from #cairo_format_t values so that the
  350. * implementation can detect the error if users confuse the two types.
  351. *
  352. * Since: 1.0
  353. **/
  354. typedef enum _cairo_content {
  355. CAIRO_CONTENT_COLOR = 0x1000,
  356. CAIRO_CONTENT_ALPHA = 0x2000,
  357. CAIRO_CONTENT_COLOR_ALPHA = 0x3000
  358. } cairo_content_t;
  359. /**
  360. * cairo_format_t:
  361. * @CAIRO_FORMAT_INVALID: no such format exists or is supported.
  362. * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
  363. * alpha in the upper 8 bits, then red, then green, then blue.
  364. * The 32-bit quantities are stored native-endian. Pre-multiplied
  365. * alpha is used. (That is, 50% transparent red is 0x80800000,
  366. * not 0x80ff0000.) (Since 1.0)
  367. * @CAIRO_FORMAT_RGB24: each pixel is a 32-bit quantity, with
  368. * the upper 8 bits unused. Red, Green, and Blue are stored
  369. * in the remaining 24 bits in that order. (Since 1.0)
  370. * @CAIRO_FORMAT_A8: each pixel is a 8-bit quantity holding
  371. * an alpha value. (Since 1.0)
  372. * @CAIRO_FORMAT_A1: each pixel is a 1-bit quantity holding
  373. * an alpha value. Pixels are packed together into 32-bit
  374. * quantities. The ordering of the bits matches the
  375. * endianness of the platform. On a big-endian machine, the
  376. * first pixel is in the uppermost bit, on a little-endian
  377. * machine the first pixel is in the least-significant bit. (Since 1.0)
  378. * @CAIRO_FORMAT_RGB16_565: each pixel is a 16-bit quantity
  379. * with red in the upper 5 bits, then green in the middle
  380. * 6 bits, and blue in the lower 5 bits. (Since 1.2)
  381. * @CAIRO_FORMAT_RGB30: like RGB24 but with 10bpc. (Since 1.12)
  382. * @CAIRO_FORMAT_RGB96F: 3 floats, R, G, B. (Since 1.17.2)
  383. * @CAIRO_FORMAT_RGBA128F: 4 floats, R, G, B, A. (Since 1.17.2)
  384. *
  385. * #cairo_format_t is used to identify the memory format of
  386. * image data.
  387. *
  388. * New entries may be added in future versions.
  389. *
  390. * Since: 1.0
  391. **/
  392. typedef enum _cairo_format {
  393. CAIRO_FORMAT_INVALID = -1,
  394. CAIRO_FORMAT_ARGB32 = 0,
  395. CAIRO_FORMAT_RGB24 = 1,
  396. CAIRO_FORMAT_A8 = 2,
  397. CAIRO_FORMAT_A1 = 3,
  398. CAIRO_FORMAT_RGB16_565 = 4,
  399. CAIRO_FORMAT_RGB30 = 5,
  400. CAIRO_FORMAT_RGB96F = 6,
  401. CAIRO_FORMAT_RGBA128F = 7
  402. } cairo_format_t;
  403. /**
  404. * cairo_write_func_t:
  405. * @closure: the output closure
  406. * @data: the buffer containing the data to write
  407. * @length: the amount of data to write
  408. *
  409. * #cairo_write_func_t is the type of function which is called when a
  410. * backend needs to write data to an output stream. It is passed the
  411. * closure which was specified by the user at the time the write
  412. * function was registered, the data to write and the length of the
  413. * data in bytes. The write function should return
  414. * %CAIRO_STATUS_SUCCESS if all the data was successfully written,
  415. * %CAIRO_STATUS_WRITE_ERROR otherwise.
  416. *
  417. * Returns: the status code of the write operation
  418. *
  419. * Since: 1.0
  420. **/
  421. typedef cairo_status_t (*cairo_write_func_t) (void *closure,
  422. const unsigned char *data,
  423. unsigned int length);
  424. /**
  425. * cairo_read_func_t:
  426. * @closure: the input closure
  427. * @data: the buffer into which to read the data
  428. * @length: the amount of data to read
  429. *
  430. * #cairo_read_func_t is the type of function which is called when a
  431. * backend needs to read data from an input stream. It is passed the
  432. * closure which was specified by the user at the time the read
  433. * function was registered, the buffer to read the data into and the
  434. * length of the data in bytes. The read function should return
  435. * %CAIRO_STATUS_SUCCESS if all the data was successfully read,
  436. * %CAIRO_STATUS_READ_ERROR otherwise.
  437. *
  438. * Returns: the status code of the read operation
  439. *
  440. * Since: 1.0
  441. **/
  442. typedef cairo_status_t (*cairo_read_func_t) (void *closure,
  443. unsigned char *data,
  444. unsigned int length);
  445. /**
  446. * cairo_rectangle_int_t:
  447. * @x: X coordinate of the left side of the rectangle
  448. * @y: Y coordinate of the the top side of the rectangle
  449. * @width: width of the rectangle
  450. * @height: height of the rectangle
  451. *
  452. * A data structure for holding a rectangle with integer coordinates.
  453. *
  454. * Since: 1.10
  455. **/
  456. typedef struct _cairo_rectangle_int {
  457. int x, y;
  458. int width, height;
  459. } cairo_rectangle_int_t;
  460. /* Functions for manipulating state objects */
  461. cairo_public cairo_t *
  462. cairo_create (cairo_surface_t *target);
  463. cairo_public cairo_t *
  464. cairo_reference (cairo_t *cr);
  465. cairo_public void
  466. cairo_destroy (cairo_t *cr);
  467. cairo_public unsigned int
  468. cairo_get_reference_count (cairo_t *cr);
  469. cairo_public void *
  470. cairo_get_user_data (cairo_t *cr,
  471. const cairo_user_data_key_t *key);
  472. cairo_public cairo_status_t
  473. cairo_set_user_data (cairo_t *cr,
  474. const cairo_user_data_key_t *key,
  475. void *user_data,
  476. cairo_destroy_func_t destroy);
  477. cairo_public void
  478. cairo_save (cairo_t *cr);
  479. cairo_public void
  480. cairo_restore (cairo_t *cr);
  481. cairo_public void
  482. cairo_push_group (cairo_t *cr);
  483. cairo_public void
  484. cairo_push_group_with_content (cairo_t *cr, cairo_content_t content);
  485. cairo_public cairo_pattern_t *
  486. cairo_pop_group (cairo_t *cr);
  487. cairo_public void
  488. cairo_pop_group_to_source (cairo_t *cr);
  489. /* Modify state */
  490. /**
  491. * cairo_operator_t:
  492. * @CAIRO_OPERATOR_CLEAR: clear destination layer (bounded) (Since 1.0)
  493. * @CAIRO_OPERATOR_SOURCE: replace destination layer (bounded) (Since 1.0)
  494. * @CAIRO_OPERATOR_OVER: draw source layer on top of destination layer
  495. * (bounded) (Since 1.0)
  496. * @CAIRO_OPERATOR_IN: draw source where there was destination content
  497. * (unbounded) (Since 1.0)
  498. * @CAIRO_OPERATOR_OUT: draw source where there was no destination
  499. * content (unbounded) (Since 1.0)
  500. * @CAIRO_OPERATOR_ATOP: draw source on top of destination content and
  501. * only there (Since 1.0)
  502. * @CAIRO_OPERATOR_DEST: ignore the source (Since 1.0)
  503. * @CAIRO_OPERATOR_DEST_OVER: draw destination on top of source (Since 1.0)
  504. * @CAIRO_OPERATOR_DEST_IN: leave destination only where there was
  505. * source content (unbounded) (Since 1.0)
  506. * @CAIRO_OPERATOR_DEST_OUT: leave destination only where there was no
  507. * source content (Since 1.0)
  508. * @CAIRO_OPERATOR_DEST_ATOP: leave destination on top of source content
  509. * and only there (unbounded) (Since 1.0)
  510. * @CAIRO_OPERATOR_XOR: source and destination are shown where there is only
  511. * one of them (Since 1.0)
  512. * @CAIRO_OPERATOR_ADD: source and destination layers are accumulated (Since 1.0)
  513. * @CAIRO_OPERATOR_SATURATE: like over, but assuming source and dest are
  514. * disjoint geometries (Since 1.0)
  515. * @CAIRO_OPERATOR_MULTIPLY: source and destination layers are multiplied.
  516. * This causes the result to be at least as dark as the darker inputs. (Since 1.10)
  517. * @CAIRO_OPERATOR_SCREEN: source and destination are complemented and
  518. * multiplied. This causes the result to be at least as light as the lighter
  519. * inputs. (Since 1.10)
  520. * @CAIRO_OPERATOR_OVERLAY: multiplies or screens, depending on the
  521. * lightness of the destination color. (Since 1.10)
  522. * @CAIRO_OPERATOR_DARKEN: replaces the destination with the source if it
  523. * is darker, otherwise keeps the source. (Since 1.10)
  524. * @CAIRO_OPERATOR_LIGHTEN: replaces the destination with the source if it
  525. * is lighter, otherwise keeps the source. (Since 1.10)
  526. * @CAIRO_OPERATOR_COLOR_DODGE: brightens the destination color to reflect
  527. * the source color. (Since 1.10)
  528. * @CAIRO_OPERATOR_COLOR_BURN: darkens the destination color to reflect
  529. * the source color. (Since 1.10)
  530. * @CAIRO_OPERATOR_HARD_LIGHT: Multiplies or screens, dependent on source
  531. * color. (Since 1.10)
  532. * @CAIRO_OPERATOR_SOFT_LIGHT: Darkens or lightens, dependent on source
  533. * color. (Since 1.10)
  534. * @CAIRO_OPERATOR_DIFFERENCE: Takes the difference of the source and
  535. * destination color. (Since 1.10)
  536. * @CAIRO_OPERATOR_EXCLUSION: Produces an effect similar to difference, but
  537. * with lower contrast. (Since 1.10)
  538. * @CAIRO_OPERATOR_HSL_HUE: Creates a color with the hue of the source
  539. * and the saturation and luminosity of the target. (Since 1.10)
  540. * @CAIRO_OPERATOR_HSL_SATURATION: Creates a color with the saturation
  541. * of the source and the hue and luminosity of the target. Painting with
  542. * this mode onto a gray area produces no change. (Since 1.10)
  543. * @CAIRO_OPERATOR_HSL_COLOR: Creates a color with the hue and saturation
  544. * of the source and the luminosity of the target. This preserves the gray
  545. * levels of the target and is useful for coloring monochrome images or
  546. * tinting color images. (Since 1.10)
  547. * @CAIRO_OPERATOR_HSL_LUMINOSITY: Creates a color with the luminosity of
  548. * the source and the hue and saturation of the target. This produces an
  549. * inverse effect to @CAIRO_OPERATOR_HSL_COLOR. (Since 1.10)
  550. *
  551. * #cairo_operator_t is used to set the compositing operator for all cairo
  552. * drawing operations.
  553. *
  554. * The default operator is %CAIRO_OPERATOR_OVER.
  555. *
  556. * The operators marked as <firstterm>unbounded</firstterm> modify their
  557. * destination even outside of the mask layer (that is, their effect is not
  558. * bound by the mask layer). However, their effect can still be limited by
  559. * way of clipping.
  560. *
  561. * To keep things simple, the operator descriptions here
  562. * document the behavior for when both source and destination are either fully
  563. * transparent or fully opaque. The actual implementation works for
  564. * translucent layers too.
  565. * For a more detailed explanation of the effects of each operator, including
  566. * the mathematical definitions, see
  567. * <ulink url="https://cairographics.org/operators/">https://cairographics.org/operators/</ulink>.
  568. *
  569. * Since: 1.0
  570. **/
  571. typedef enum _cairo_operator {
  572. CAIRO_OPERATOR_CLEAR,
  573. CAIRO_OPERATOR_SOURCE,
  574. CAIRO_OPERATOR_OVER,
  575. CAIRO_OPERATOR_IN,
  576. CAIRO_OPERATOR_OUT,
  577. CAIRO_OPERATOR_ATOP,
  578. CAIRO_OPERATOR_DEST,
  579. CAIRO_OPERATOR_DEST_OVER,
  580. CAIRO_OPERATOR_DEST_IN,
  581. CAIRO_OPERATOR_DEST_OUT,
  582. CAIRO_OPERATOR_DEST_ATOP,
  583. CAIRO_OPERATOR_XOR,
  584. CAIRO_OPERATOR_ADD,
  585. CAIRO_OPERATOR_SATURATE,
  586. CAIRO_OPERATOR_MULTIPLY,
  587. CAIRO_OPERATOR_SCREEN,
  588. CAIRO_OPERATOR_OVERLAY,
  589. CAIRO_OPERATOR_DARKEN,
  590. CAIRO_OPERATOR_LIGHTEN,
  591. CAIRO_OPERATOR_COLOR_DODGE,
  592. CAIRO_OPERATOR_COLOR_BURN,
  593. CAIRO_OPERATOR_HARD_LIGHT,
  594. CAIRO_OPERATOR_SOFT_LIGHT,
  595. CAIRO_OPERATOR_DIFFERENCE,
  596. CAIRO_OPERATOR_EXCLUSION,
  597. CAIRO_OPERATOR_HSL_HUE,
  598. CAIRO_OPERATOR_HSL_SATURATION,
  599. CAIRO_OPERATOR_HSL_COLOR,
  600. CAIRO_OPERATOR_HSL_LUMINOSITY
  601. } cairo_operator_t;
  602. cairo_public void
  603. cairo_set_operator (cairo_t *cr, cairo_operator_t op);
  604. cairo_public void
  605. cairo_set_source (cairo_t *cr, cairo_pattern_t *source);
  606. cairo_public void
  607. cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue);
  608. cairo_public void
  609. cairo_set_source_rgba (cairo_t *cr,
  610. double red, double green, double blue,
  611. double alpha);
  612. cairo_public void
  613. cairo_set_source_surface (cairo_t *cr,
  614. cairo_surface_t *surface,
  615. double x,
  616. double y);
  617. cairo_public void
  618. cairo_set_tolerance (cairo_t *cr, double tolerance);
  619. /**
  620. * cairo_antialias_t:
  621. * @CAIRO_ANTIALIAS_DEFAULT: Use the default antialiasing for
  622. * the subsystem and target device, since 1.0
  623. * @CAIRO_ANTIALIAS_NONE: Use a bilevel alpha mask, since 1.0
  624. * @CAIRO_ANTIALIAS_GRAY: Perform single-color antialiasing (using
  625. * shades of gray for black text on a white background, for example), since 1.0
  626. * @CAIRO_ANTIALIAS_SUBPIXEL: Perform antialiasing by taking
  627. * advantage of the order of subpixel elements on devices
  628. * such as LCD panels, since 1.0
  629. * @CAIRO_ANTIALIAS_FAST: Hint that the backend should perform some
  630. * antialiasing but prefer speed over quality, since 1.12
  631. * @CAIRO_ANTIALIAS_GOOD: The backend should balance quality against
  632. * performance, since 1.12
  633. * @CAIRO_ANTIALIAS_BEST: Hint that the backend should render at the highest
  634. * quality, sacrificing speed if necessary, since 1.12
  635. *
  636. * Specifies the type of antialiasing to do when rendering text or shapes.
  637. *
  638. * As it is not necessarily clear from the above what advantages a particular
  639. * antialias method provides, since 1.12, there is also a set of hints:
  640. * @CAIRO_ANTIALIAS_FAST: Allow the backend to degrade raster quality for speed
  641. * @CAIRO_ANTIALIAS_GOOD: A balance between speed and quality
  642. * @CAIRO_ANTIALIAS_BEST: A high-fidelity, but potentially slow, raster mode
  643. *
  644. * These make no guarantee on how the backend will perform its rasterisation
  645. * (if it even rasterises!), nor that they have any differing effect other
  646. * than to enable some form of antialiasing. In the case of glyph rendering,
  647. * @CAIRO_ANTIALIAS_FAST and @CAIRO_ANTIALIAS_GOOD will be mapped to
  648. * @CAIRO_ANTIALIAS_GRAY, with @CAIRO_ANTALIAS_BEST being equivalent to
  649. * @CAIRO_ANTIALIAS_SUBPIXEL.
  650. *
  651. * The interpretation of @CAIRO_ANTIALIAS_DEFAULT is left entirely up to
  652. * the backend, typically this will be similar to @CAIRO_ANTIALIAS_GOOD.
  653. *
  654. * Since: 1.0
  655. **/
  656. typedef enum _cairo_antialias {
  657. CAIRO_ANTIALIAS_DEFAULT,
  658. /* method */
  659. CAIRO_ANTIALIAS_NONE,
  660. CAIRO_ANTIALIAS_GRAY,
  661. CAIRO_ANTIALIAS_SUBPIXEL,
  662. /* hints */
  663. CAIRO_ANTIALIAS_FAST,
  664. CAIRO_ANTIALIAS_GOOD,
  665. CAIRO_ANTIALIAS_BEST
  666. } cairo_antialias_t;
  667. cairo_public void
  668. cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias);
  669. /**
  670. * cairo_fill_rule_t:
  671. * @CAIRO_FILL_RULE_WINDING: If the path crosses the ray from
  672. * left-to-right, counts +1. If the path crosses the ray
  673. * from right to left, counts -1. (Left and right are determined
  674. * from the perspective of looking along the ray from the starting
  675. * point.) If the total count is non-zero, the point will be filled. (Since 1.0)
  676. * @CAIRO_FILL_RULE_EVEN_ODD: Counts the total number of
  677. * intersections, without regard to the orientation of the contour. If
  678. * the total number of intersections is odd, the point will be
  679. * filled. (Since 1.0)
  680. *
  681. * #cairo_fill_rule_t is used to select how paths are filled. For both
  682. * fill rules, whether or not a point is included in the fill is
  683. * determined by taking a ray from that point to infinity and looking
  684. * at intersections with the path. The ray can be in any direction,
  685. * as long as it doesn't pass through the end point of a segment
  686. * or have a tricky intersection such as intersecting tangent to the path.
  687. * (Note that filling is not actually implemented in this way. This
  688. * is just a description of the rule that is applied.)
  689. *
  690. * The default fill rule is %CAIRO_FILL_RULE_WINDING.
  691. *
  692. * New entries may be added in future versions.
  693. *
  694. * Since: 1.0
  695. **/
  696. typedef enum _cairo_fill_rule {
  697. CAIRO_FILL_RULE_WINDING,
  698. CAIRO_FILL_RULE_EVEN_ODD
  699. } cairo_fill_rule_t;
  700. cairo_public void
  701. cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule);
  702. cairo_public void
  703. cairo_set_line_width (cairo_t *cr, double width);
  704. /**
  705. * cairo_line_cap_t:
  706. * @CAIRO_LINE_CAP_BUTT: start(stop) the line exactly at the start(end) point (Since 1.0)
  707. * @CAIRO_LINE_CAP_ROUND: use a round ending, the center of the circle is the end point (Since 1.0)
  708. * @CAIRO_LINE_CAP_SQUARE: use squared ending, the center of the square is the end point (Since 1.0)
  709. *
  710. * Specifies how to render the endpoints of the path when stroking.
  711. *
  712. * The default line cap style is %CAIRO_LINE_CAP_BUTT.
  713. *
  714. * Since: 1.0
  715. **/
  716. typedef enum _cairo_line_cap {
  717. CAIRO_LINE_CAP_BUTT,
  718. CAIRO_LINE_CAP_ROUND,
  719. CAIRO_LINE_CAP_SQUARE
  720. } cairo_line_cap_t;
  721. cairo_public void
  722. cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap);
  723. /**
  724. * cairo_line_join_t:
  725. * @CAIRO_LINE_JOIN_MITER: use a sharp (angled) corner, see
  726. * cairo_set_miter_limit() (Since 1.0)
  727. * @CAIRO_LINE_JOIN_ROUND: use a rounded join, the center of the circle is the
  728. * joint point (Since 1.0)
  729. * @CAIRO_LINE_JOIN_BEVEL: use a cut-off join, the join is cut off at half
  730. * the line width from the joint point (Since 1.0)
  731. *
  732. * Specifies how to render the junction of two lines when stroking.
  733. *
  734. * The default line join style is %CAIRO_LINE_JOIN_MITER.
  735. *
  736. * Since: 1.0
  737. **/
  738. typedef enum _cairo_line_join {
  739. CAIRO_LINE_JOIN_MITER,
  740. CAIRO_LINE_JOIN_ROUND,
  741. CAIRO_LINE_JOIN_BEVEL
  742. } cairo_line_join_t;
  743. cairo_public void
  744. cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join);
  745. cairo_public void
  746. cairo_set_dash (cairo_t *cr,
  747. const double *dashes,
  748. int num_dashes,
  749. double offset);
  750. cairo_public void
  751. cairo_set_miter_limit (cairo_t *cr, double limit);
  752. cairo_public void
  753. cairo_translate (cairo_t *cr, double tx, double ty);
  754. cairo_public void
  755. cairo_scale (cairo_t *cr, double sx, double sy);
  756. cairo_public void
  757. cairo_rotate (cairo_t *cr, double angle);
  758. cairo_public void
  759. cairo_transform (cairo_t *cr,
  760. const cairo_matrix_t *matrix);
  761. cairo_public void
  762. cairo_set_matrix (cairo_t *cr,
  763. const cairo_matrix_t *matrix);
  764. cairo_public void
  765. cairo_identity_matrix (cairo_t *cr);
  766. cairo_public void
  767. cairo_user_to_device (cairo_t *cr, double *x, double *y);
  768. cairo_public void
  769. cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);
  770. cairo_public void
  771. cairo_device_to_user (cairo_t *cr, double *x, double *y);
  772. cairo_public void
  773. cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);
  774. /* Path creation functions */
  775. cairo_public void
  776. cairo_new_path (cairo_t *cr);
  777. cairo_public void
  778. cairo_move_to (cairo_t *cr, double x, double y);
  779. cairo_public void
  780. cairo_new_sub_path (cairo_t *cr);
  781. cairo_public void
  782. cairo_line_to (cairo_t *cr, double x, double y);
  783. cairo_public void
  784. cairo_curve_to (cairo_t *cr,
  785. double x1, double y1,
  786. double x2, double y2,
  787. double x3, double y3);
  788. cairo_public void
  789. cairo_arc (cairo_t *cr,
  790. double xc, double yc,
  791. double radius,
  792. double angle1, double angle2);
  793. cairo_public void
  794. cairo_arc_negative (cairo_t *cr,
  795. double xc, double yc,
  796. double radius,
  797. double angle1, double angle2);
  798. /* XXX: NYI
  799. cairo_public void
  800. cairo_arc_to (cairo_t *cr,
  801. double x1, double y1,
  802. double x2, double y2,
  803. double radius);
  804. */
  805. cairo_public void
  806. cairo_rel_move_to (cairo_t *cr, double dx, double dy);
  807. cairo_public void
  808. cairo_rel_line_to (cairo_t *cr, double dx, double dy);
  809. cairo_public void
  810. cairo_rel_curve_to (cairo_t *cr,
  811. double dx1, double dy1,
  812. double dx2, double dy2,
  813. double dx3, double dy3);
  814. cairo_public void
  815. cairo_rectangle (cairo_t *cr,
  816. double x, double y,
  817. double width, double height);
  818. /* XXX: NYI
  819. cairo_public void
  820. cairo_stroke_to_path (cairo_t *cr);
  821. */
  822. cairo_public void
  823. cairo_close_path (cairo_t *cr);
  824. cairo_public void
  825. cairo_path_extents (cairo_t *cr,
  826. double *x1, double *y1,
  827. double *x2, double *y2);
  828. /* Painting functions */
  829. cairo_public void
  830. cairo_paint (cairo_t *cr);
  831. cairo_public void
  832. cairo_paint_with_alpha (cairo_t *cr,
  833. double alpha);
  834. cairo_public void
  835. cairo_mask (cairo_t *cr,
  836. cairo_pattern_t *pattern);
  837. cairo_public void
  838. cairo_mask_surface (cairo_t *cr,
  839. cairo_surface_t *surface,
  840. double surface_x,
  841. double surface_y);
  842. cairo_public void
  843. cairo_stroke (cairo_t *cr);
  844. cairo_public void
  845. cairo_stroke_preserve (cairo_t *cr);
  846. cairo_public void
  847. cairo_fill (cairo_t *cr);
  848. cairo_public void
  849. cairo_fill_preserve (cairo_t *cr);
  850. cairo_public void
  851. cairo_copy_page (cairo_t *cr);
  852. cairo_public void
  853. cairo_show_page (cairo_t *cr);
  854. /* Insideness testing */
  855. cairo_public cairo_bool_t
  856. cairo_in_stroke (cairo_t *cr, double x, double y);
  857. cairo_public cairo_bool_t
  858. cairo_in_fill (cairo_t *cr, double x, double y);
  859. cairo_public cairo_bool_t
  860. cairo_in_clip (cairo_t *cr, double x, double y);
  861. /* Rectangular extents */
  862. cairo_public void
  863. cairo_stroke_extents (cairo_t *cr,
  864. double *x1, double *y1,
  865. double *x2, double *y2);
  866. cairo_public void
  867. cairo_fill_extents (cairo_t *cr,
  868. double *x1, double *y1,
  869. double *x2, double *y2);
  870. /* Clipping */
  871. cairo_public void
  872. cairo_reset_clip (cairo_t *cr);
  873. cairo_public void
  874. cairo_clip (cairo_t *cr);
  875. cairo_public void
  876. cairo_clip_preserve (cairo_t *cr);
  877. cairo_public void
  878. cairo_clip_extents (cairo_t *cr,
  879. double *x1, double *y1,
  880. double *x2, double *y2);
  881. /**
  882. * cairo_rectangle_t:
  883. * @x: X coordinate of the left side of the rectangle
  884. * @y: Y coordinate of the the top side of the rectangle
  885. * @width: width of the rectangle
  886. * @height: height of the rectangle
  887. *
  888. * A data structure for holding a rectangle.
  889. *
  890. * Since: 1.4
  891. **/
  892. typedef struct _cairo_rectangle {
  893. double x, y, width, height;
  894. } cairo_rectangle_t;
  895. /**
  896. * cairo_rectangle_list_t:
  897. * @status: Error status of the rectangle list
  898. * @rectangles: Array containing the rectangles
  899. * @num_rectangles: Number of rectangles in this list
  900. *
  901. * A data structure for holding a dynamically allocated
  902. * array of rectangles.
  903. *
  904. * Since: 1.4
  905. **/
  906. typedef struct _cairo_rectangle_list {
  907. cairo_status_t status;
  908. cairo_rectangle_t *rectangles;
  909. int num_rectangles;
  910. } cairo_rectangle_list_t;
  911. cairo_public cairo_rectangle_list_t *
  912. cairo_copy_clip_rectangle_list (cairo_t *cr);
  913. cairo_public void
  914. cairo_rectangle_list_destroy (cairo_rectangle_list_t *rectangle_list);
  915. /* Logical structure tagging functions */
  916. #define CAIRO_TAG_DEST "cairo.dest"
  917. #define CAIRO_TAG_LINK "Link"
  918. cairo_public void
  919. cairo_tag_begin (cairo_t *cr, const char *tag_name, const char *attributes);
  920. cairo_public void
  921. cairo_tag_end (cairo_t *cr, const char *tag_name);
  922. /* Font/Text functions */
  923. /**
  924. * cairo_scaled_font_t:
  925. *
  926. * A #cairo_scaled_font_t is a font scaled to a particular size and device
  927. * resolution. A #cairo_scaled_font_t is most useful for low-level font
  928. * usage where a library or application wants to cache a reference
  929. * to a scaled font to speed up the computation of metrics.
  930. *
  931. * There are various types of scaled fonts, depending on the
  932. * <firstterm>font backend</firstterm> they use. The type of a
  933. * scaled font can be queried using cairo_scaled_font_get_type().
  934. *
  935. * Memory management of #cairo_scaled_font_t is done with
  936. * cairo_scaled_font_reference() and cairo_scaled_font_destroy().
  937. *
  938. * Since: 1.0
  939. **/
  940. typedef struct _cairo_scaled_font cairo_scaled_font_t;
  941. /**
  942. * cairo_font_face_t:
  943. *
  944. * A #cairo_font_face_t specifies all aspects of a font other
  945. * than the size or font matrix (a font matrix is used to distort
  946. * a font by shearing it or scaling it unequally in the two
  947. * directions) . A font face can be set on a #cairo_t by using
  948. * cairo_set_font_face(); the size and font matrix are set with
  949. * cairo_set_font_size() and cairo_set_font_matrix().
  950. *
  951. * There are various types of font faces, depending on the
  952. * <firstterm>font backend</firstterm> they use. The type of a
  953. * font face can be queried using cairo_font_face_get_type().
  954. *
  955. * Memory management of #cairo_font_face_t is done with
  956. * cairo_font_face_reference() and cairo_font_face_destroy().
  957. *
  958. * Since: 1.0
  959. **/
  960. typedef struct _cairo_font_face cairo_font_face_t;
  961. /**
  962. * cairo_glyph_t:
  963. * @index: glyph index in the font. The exact interpretation of the
  964. * glyph index depends on the font technology being used.
  965. * @x: the offset in the X direction between the origin used for
  966. * drawing or measuring the string and the origin of this glyph.
  967. * @y: the offset in the Y direction between the origin used for
  968. * drawing or measuring the string and the origin of this glyph.
  969. *
  970. * The #cairo_glyph_t structure holds information about a single glyph
  971. * when drawing or measuring text. A font is (in simple terms) a
  972. * collection of shapes used to draw text. A glyph is one of these
  973. * shapes. There can be multiple glyphs for a single character
  974. * (alternates to be used in different contexts, for example), or a
  975. * glyph can be a <firstterm>ligature</firstterm> of multiple
  976. * characters. Cairo doesn't expose any way of converting input text
  977. * into glyphs, so in order to use the Cairo interfaces that take
  978. * arrays of glyphs, you must directly access the appropriate
  979. * underlying font system.
  980. *
  981. * Note that the offsets given by @x and @y are not cumulative. When
  982. * drawing or measuring text, each glyph is individually positioned
  983. * with respect to the overall origin
  984. *
  985. * Since: 1.0
  986. **/
  987. typedef struct {
  988. unsigned long index;
  989. double x;
  990. double y;
  991. } cairo_glyph_t;
  992. cairo_public cairo_glyph_t *
  993. cairo_glyph_allocate (int num_glyphs);
  994. cairo_public void
  995. cairo_glyph_free (cairo_glyph_t *glyphs);
  996. /**
  997. * cairo_text_cluster_t:
  998. * @num_bytes: the number of bytes of UTF-8 text covered by cluster
  999. * @num_glyphs: the number of glyphs covered by cluster
  1000. *
  1001. * The #cairo_text_cluster_t structure holds information about a single
  1002. * <firstterm>text cluster</firstterm>. A text cluster is a minimal
  1003. * mapping of some glyphs corresponding to some UTF-8 text.
  1004. *
  1005. * For a cluster to be valid, both @num_bytes and @num_glyphs should
  1006. * be non-negative, and at least one should be non-zero.
  1007. * Note that clusters with zero glyphs are not as well supported as
  1008. * normal clusters. For example, PDF rendering applications typically
  1009. * ignore those clusters when PDF text is being selected.
  1010. *
  1011. * See cairo_show_text_glyphs() for how clusters are used in advanced
  1012. * text operations.
  1013. *
  1014. * Since: 1.8
  1015. **/
  1016. typedef struct {
  1017. int num_bytes;
  1018. int num_glyphs;
  1019. } cairo_text_cluster_t;
  1020. cairo_public cairo_text_cluster_t *
  1021. cairo_text_cluster_allocate (int num_clusters);
  1022. cairo_public void
  1023. cairo_text_cluster_free (cairo_text_cluster_t *clusters);
  1024. /**
  1025. * cairo_text_cluster_flags_t:
  1026. * @CAIRO_TEXT_CLUSTER_FLAG_BACKWARD: The clusters in the cluster array
  1027. * map to glyphs in the glyph array from end to start. (Since 1.8)
  1028. *
  1029. * Specifies properties of a text cluster mapping.
  1030. *
  1031. * Since: 1.8
  1032. **/
  1033. typedef enum _cairo_text_cluster_flags {
  1034. CAIRO_TEXT_CLUSTER_FLAG_BACKWARD = 0x00000001
  1035. } cairo_text_cluster_flags_t;
  1036. /**
  1037. * cairo_text_extents_t:
  1038. * @x_bearing: the horizontal distance from the origin to the
  1039. * leftmost part of the glyphs as drawn. Positive if the
  1040. * glyphs lie entirely to the right of the origin.
  1041. * @y_bearing: the vertical distance from the origin to the
  1042. * topmost part of the glyphs as drawn. Positive only if the
  1043. * glyphs lie completely below the origin; will usually be
  1044. * negative.
  1045. * @width: width of the glyphs as drawn
  1046. * @height: height of the glyphs as drawn
  1047. * @x_advance:distance to advance in the X direction
  1048. * after drawing these glyphs
  1049. * @y_advance: distance to advance in the Y direction
  1050. * after drawing these glyphs. Will typically be zero except
  1051. * for vertical text layout as found in East-Asian languages.
  1052. *
  1053. * The #cairo_text_extents_t structure stores the extents of a single
  1054. * glyph or a string of glyphs in user-space coordinates. Because text
  1055. * extents are in user-space coordinates, they are mostly, but not
  1056. * entirely, independent of the current transformation matrix. If you call
  1057. * <literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will
  1058. * be drawn twice as big, but the reported text extents will not be
  1059. * doubled. They will change slightly due to hinting (so you can't
  1060. * assume that metrics are independent of the transformation matrix),
  1061. * but otherwise will remain unchanged.
  1062. *
  1063. * Since: 1.0
  1064. **/
  1065. typedef struct {
  1066. double x_bearing;
  1067. double y_bearing;
  1068. double width;
  1069. double height;
  1070. double x_advance;
  1071. double y_advance;
  1072. } cairo_text_extents_t;
  1073. /**
  1074. * cairo_font_extents_t:
  1075. * @ascent: the distance that the font extends above the baseline.
  1076. * Note that this is not always exactly equal to the maximum
  1077. * of the extents of all the glyphs in the font, but rather
  1078. * is picked to express the font designer's intent as to
  1079. * how the font should align with elements above it.
  1080. * @descent: the distance that the font extends below the baseline.
  1081. * This value is positive for typical fonts that include
  1082. * portions below the baseline. Note that this is not always
  1083. * exactly equal to the maximum of the extents of all the
  1084. * glyphs in the font, but rather is picked to express the
  1085. * font designer's intent as to how the font should
  1086. * align with elements below it.
  1087. * @height: the recommended vertical distance between baselines when
  1088. * setting consecutive lines of text with the font. This
  1089. * is greater than @ascent+@descent by a
  1090. * quantity known as the <firstterm>line spacing</firstterm>
  1091. * or <firstterm>external leading</firstterm>. When space
  1092. * is at a premium, most fonts can be set with only
  1093. * a distance of @ascent+@descent between lines.
  1094. * @max_x_advance: the maximum distance in the X direction that
  1095. * the origin is advanced for any glyph in the font.
  1096. * @max_y_advance: the maximum distance in the Y direction that
  1097. * the origin is advanced for any glyph in the font.
  1098. * This will be zero for normal fonts used for horizontal
  1099. * writing. (The scripts of East Asia are sometimes written
  1100. * vertically.)
  1101. *
  1102. * The #cairo_font_extents_t structure stores metric information for
  1103. * a font. Values are given in the current user-space coordinate
  1104. * system.
  1105. *
  1106. * Because font metrics are in user-space coordinates, they are
  1107. * mostly, but not entirely, independent of the current transformation
  1108. * matrix. If you call <literal>cairo_scale(cr, 2.0, 2.0)</literal>,
  1109. * text will be drawn twice as big, but the reported text extents will
  1110. * not be doubled. They will change slightly due to hinting (so you
  1111. * can't assume that metrics are independent of the transformation
  1112. * matrix), but otherwise will remain unchanged.
  1113. *
  1114. * Since: 1.0
  1115. **/
  1116. typedef struct {
  1117. double ascent;
  1118. double descent;
  1119. double height;
  1120. double max_x_advance;
  1121. double max_y_advance;
  1122. } cairo_font_extents_t;
  1123. /**
  1124. * cairo_font_slant_t:
  1125. * @CAIRO_FONT_SLANT_NORMAL: Upright font style, since 1.0
  1126. * @CAIRO_FONT_SLANT_ITALIC: Italic font style, since 1.0
  1127. * @CAIRO_FONT_SLANT_OBLIQUE: Oblique font style, since 1.0
  1128. *
  1129. * Specifies variants of a font face based on their slant.
  1130. *
  1131. * Since: 1.0
  1132. **/
  1133. typedef enum _cairo_font_slant {
  1134. CAIRO_FONT_SLANT_NORMAL,
  1135. CAIRO_FONT_SLANT_ITALIC,
  1136. CAIRO_FONT_SLANT_OBLIQUE
  1137. } cairo_font_slant_t;
  1138. /**
  1139. * cairo_font_weight_t:
  1140. * @CAIRO_FONT_WEIGHT_NORMAL: Normal font weight, since 1.0
  1141. * @CAIRO_FONT_WEIGHT_BOLD: Bold font weight, since 1.0
  1142. *
  1143. * Specifies variants of a font face based on their weight.
  1144. *
  1145. * Since: 1.0
  1146. **/
  1147. typedef enum _cairo_font_weight {
  1148. CAIRO_FONT_WEIGHT_NORMAL,
  1149. CAIRO_FONT_WEIGHT_BOLD
  1150. } cairo_font_weight_t;
  1151. /**
  1152. * cairo_subpixel_order_t:
  1153. * @CAIRO_SUBPIXEL_ORDER_DEFAULT: Use the default subpixel order for
  1154. * for the target device, since 1.0
  1155. * @CAIRO_SUBPIXEL_ORDER_RGB: Subpixel elements are arranged horizontally
  1156. * with red at the left, since 1.0
  1157. * @CAIRO_SUBPIXEL_ORDER_BGR: Subpixel elements are arranged horizontally
  1158. * with blue at the left, since 1.0
  1159. * @CAIRO_SUBPIXEL_ORDER_VRGB: Subpixel elements are arranged vertically
  1160. * with red at the top, since 1.0
  1161. * @CAIRO_SUBPIXEL_ORDER_VBGR: Subpixel elements are arranged vertically
  1162. * with blue at the top, since 1.0
  1163. *
  1164. * The subpixel order specifies the order of color elements within
  1165. * each pixel on the display device when rendering with an
  1166. * antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL.
  1167. *
  1168. * Since: 1.0
  1169. **/
  1170. typedef enum _cairo_subpixel_order {
  1171. CAIRO_SUBPIXEL_ORDER_DEFAULT,
  1172. CAIRO_SUBPIXEL_ORDER_RGB,
  1173. CAIRO_SUBPIXEL_ORDER_BGR,
  1174. CAIRO_SUBPIXEL_ORDER_VRGB,
  1175. CAIRO_SUBPIXEL_ORDER_VBGR
  1176. } cairo_subpixel_order_t;
  1177. /**
  1178. * cairo_hint_style_t:
  1179. * @CAIRO_HINT_STYLE_DEFAULT: Use the default hint style for
  1180. * font backend and target device, since 1.0
  1181. * @CAIRO_HINT_STYLE_NONE: Do not hint outlines, since 1.0
  1182. * @CAIRO_HINT_STYLE_SLIGHT: Hint outlines slightly to improve
  1183. * contrast while retaining good fidelity to the original
  1184. * shapes, since 1.0
  1185. * @CAIRO_HINT_STYLE_MEDIUM: Hint outlines with medium strength
  1186. * giving a compromise between fidelity to the original shapes
  1187. * and contrast, since 1.0
  1188. * @CAIRO_HINT_STYLE_FULL: Hint outlines to maximize contrast, since 1.0
  1189. *
  1190. * Specifies the type of hinting to do on font outlines. Hinting
  1191. * is the process of fitting outlines to the pixel grid in order
  1192. * to improve the appearance of the result. Since hinting outlines
  1193. * involves distorting them, it also reduces the faithfulness
  1194. * to the original outline shapes. Not all of the outline hinting
  1195. * styles are supported by all font backends.
  1196. *
  1197. * New entries may be added in future versions.
  1198. *
  1199. * Since: 1.0
  1200. **/
  1201. typedef enum _cairo_hint_style {
  1202. CAIRO_HINT_STYLE_DEFAULT,
  1203. CAIRO_HINT_STYLE_NONE,
  1204. CAIRO_HINT_STYLE_SLIGHT,
  1205. CAIRO_HINT_STYLE_MEDIUM,
  1206. CAIRO_HINT_STYLE_FULL
  1207. } cairo_hint_style_t;
  1208. /**
  1209. * cairo_hint_metrics_t:
  1210. * @CAIRO_HINT_METRICS_DEFAULT: Hint metrics in the default
  1211. * manner for the font backend and target device, since 1.0
  1212. * @CAIRO_HINT_METRICS_OFF: Do not hint font metrics, since 1.0
  1213. * @CAIRO_HINT_METRICS_ON: Hint font metrics, since 1.0
  1214. *
  1215. * Specifies whether to hint font metrics; hinting font metrics
  1216. * means quantizing them so that they are integer values in
  1217. * device space. Doing this improves the consistency of
  1218. * letter and line spacing, however it also means that text
  1219. * will be laid out differently at different zoom factors.
  1220. *
  1221. * Since: 1.0
  1222. **/
  1223. typedef enum _cairo_hint_metrics {
  1224. CAIRO_HINT_METRICS_DEFAULT,
  1225. CAIRO_HINT_METRICS_OFF,
  1226. CAIRO_HINT_METRICS_ON
  1227. } cairo_hint_metrics_t;
  1228. /**
  1229. * cairo_font_options_t:
  1230. *
  1231. * An opaque structure holding all options that are used when
  1232. * rendering fonts.
  1233. *
  1234. * Individual features of a #cairo_font_options_t can be set or
  1235. * accessed using functions named
  1236. * <function>cairo_font_options_set_<emphasis>feature_name</emphasis>()</function> and
  1237. * <function>cairo_font_options_get_<emphasis>feature_name</emphasis>()</function>, like
  1238. * cairo_font_options_set_antialias() and
  1239. * cairo_font_options_get_antialias().
  1240. *
  1241. * New features may be added to a #cairo_font_options_t in the
  1242. * future. For this reason, cairo_font_options_copy(),
  1243. * cairo_font_options_equal(), cairo_font_options_merge(), and
  1244. * cairo_font_options_hash() should be used to copy, check
  1245. * for equality, merge, or compute a hash value of
  1246. * #cairo_font_options_t objects.
  1247. *
  1248. * Since: 1.0
  1249. **/
  1250. typedef struct _cairo_font_options cairo_font_options_t;
  1251. cairo_public cairo_font_options_t *
  1252. cairo_font_options_create (void);
  1253. cairo_public cairo_font_options_t *
  1254. cairo_font_options_copy (const cairo_font_options_t *original);
  1255. cairo_public void
  1256. cairo_font_options_destroy (cairo_font_options_t *options);
  1257. cairo_public cairo_status_t
  1258. cairo_font_options_status (cairo_font_options_t *options);
  1259. cairo_public void
  1260. cairo_font_options_merge (cairo_font_options_t *options,
  1261. const cairo_font_options_t *other);
  1262. cairo_public cairo_bool_t
  1263. cairo_font_options_equal (const cairo_font_options_t *options,
  1264. const cairo_font_options_t *other);
  1265. cairo_public unsigned long
  1266. cairo_font_options_hash (const cairo_font_options_t *options);
  1267. cairo_public void
  1268. cairo_font_options_set_antialias (cairo_font_options_t *options,
  1269. cairo_antialias_t antialias);
  1270. cairo_public cairo_antialias_t
  1271. cairo_font_options_get_antialias (const cairo_font_options_t *options);
  1272. cairo_public void
  1273. cairo_font_options_set_subpixel_order (cairo_font_options_t *options,
  1274. cairo_subpixel_order_t subpixel_order);
  1275. cairo_public cairo_subpixel_order_t
  1276. cairo_font_options_get_subpixel_order (const cairo_font_options_t *options);
  1277. cairo_public void
  1278. cairo_font_options_set_hint_style (cairo_font_options_t *options,
  1279. cairo_hint_style_t hint_style);
  1280. cairo_public cairo_hint_style_t
  1281. cairo_font_options_get_hint_style (const cairo_font_options_t *options);
  1282. cairo_public void
  1283. cairo_font_options_set_hint_metrics (cairo_font_options_t *options,
  1284. cairo_hint_metrics_t hint_metrics);
  1285. cairo_public cairo_hint_metrics_t
  1286. cairo_font_options_get_hint_metrics (const cairo_font_options_t *options);
  1287. cairo_public const char *
  1288. cairo_font_options_get_variations (cairo_font_options_t *options);
  1289. cairo_public void
  1290. cairo_font_options_set_variations (cairo_font_options_t *options,
  1291. const char *variations);
  1292. /* This interface is for dealing with text as text, not caring about the
  1293. font object inside the the cairo_t. */
  1294. cairo_public void
  1295. cairo_select_font_face (cairo_t *cr,
  1296. const char *family,
  1297. cairo_font_slant_t slant,
  1298. cairo_font_weight_t weight);
  1299. cairo_public void
  1300. cairo_set_font_size (cairo_t *cr, double size);
  1301. cairo_public void
  1302. cairo_set_font_matrix (cairo_t *cr,
  1303. const cairo_matrix_t *matrix);
  1304. cairo_public void
  1305. cairo_get_font_matrix (cairo_t *cr,
  1306. cairo_matrix_t *matrix);
  1307. cairo_public void
  1308. cairo_set_font_options (cairo_t *cr,
  1309. const cairo_font_options_t *options);
  1310. cairo_public void
  1311. cairo_get_font_options (cairo_t *cr,
  1312. cairo_font_options_t *options);
  1313. cairo_public void
  1314. cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);
  1315. cairo_public cairo_font_face_t *
  1316. cairo_get_font_face (cairo_t *cr);
  1317. cairo_public void
  1318. cairo_set_scaled_font (cairo_t *cr,
  1319. const cairo_scaled_font_t *scaled_font);
  1320. cairo_public cairo_scaled_font_t *
  1321. cairo_get_scaled_font (cairo_t *cr);
  1322. cairo_public void
  1323. cairo_show_text (cairo_t *cr, const char *utf8);
  1324. cairo_public void
  1325. cairo_show_glyphs (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs);
  1326. cairo_public void
  1327. cairo_show_text_glyphs (cairo_t *cr,
  1328. const char *utf8,
  1329. int utf8_len,
  1330. const cairo_glyph_t *glyphs,
  1331. int num_glyphs,
  1332. const cairo_text_cluster_t *clusters,
  1333. int num_clusters,
  1334. cairo_text_cluster_flags_t cluster_flags);
  1335. cairo_public void
  1336. cairo_text_path (cairo_t *cr, const char *utf8);
  1337. cairo_public void
  1338. cairo_glyph_path (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs);
  1339. cairo_public void
  1340. cairo_text_extents (cairo_t *cr,
  1341. const char *utf8,
  1342. cairo_text_extents_t *extents);
  1343. cairo_public void
  1344. cairo_glyph_extents (cairo_t *cr,
  1345. const cairo_glyph_t *glyphs,
  1346. int num_glyphs,
  1347. cairo_text_extents_t *extents);
  1348. cairo_public void
  1349. cairo_font_extents (cairo_t *cr,
  1350. cairo_font_extents_t *extents);
  1351. /* Generic identifier for a font style */
  1352. cairo_public cairo_font_face_t *
  1353. cairo_font_face_reference (cairo_font_face_t *font_face);
  1354. cairo_public void
  1355. cairo_font_face_destroy (cairo_font_face_t *font_face);
  1356. cairo_public unsigned int
  1357. cairo_font_face_get_reference_count (cairo_font_face_t *font_face);
  1358. cairo_public cairo_status_t
  1359. cairo_font_face_status (cairo_font_face_t *font_face);
  1360. /**
  1361. * cairo_font_type_t:
  1362. * @CAIRO_FONT_TYPE_TOY: The font was created using cairo's toy font api (Since: 1.2)
  1363. * @CAIRO_FONT_TYPE_FT: The font is of type FreeType (Since: 1.2)
  1364. * @CAIRO_FONT_TYPE_WIN32: The font is of type Win32 (Since: 1.2)
  1365. * @CAIRO_FONT_TYPE_QUARTZ: The font is of type Quartz (Since: 1.6, in 1.2 and
  1366. * 1.4 it was named CAIRO_FONT_TYPE_ATSUI)
  1367. * @CAIRO_FONT_TYPE_USER: The font was create using cairo's user font api (Since: 1.8)
  1368. *
  1369. * #cairo_font_type_t is used to describe the type of a given font
  1370. * face or scaled font. The font types are also known as "font
  1371. * backends" within cairo.
  1372. *
  1373. * The type of a font face is determined by the function used to
  1374. * create it, which will generally be of the form
  1375. * <function>cairo_<emphasis>type</emphasis>_font_face_create(<!-- -->)</function>.
  1376. * The font face type can be queried with cairo_font_face_get_type()
  1377. *
  1378. * The various #cairo_font_face_t functions can be used with a font face
  1379. * of any type.
  1380. *
  1381. * The type of a scaled font is determined by the type of the font
  1382. * face passed to cairo_scaled_font_create(). The scaled font type can
  1383. * be queried with cairo_scaled_font_get_type()
  1384. *
  1385. * The various #cairo_scaled_font_t functions can be used with scaled
  1386. * fonts of any type, but some font backends also provide
  1387. * type-specific functions that must only be called with a scaled font
  1388. * of the appropriate type. These functions have names that begin with
  1389. * <function>cairo_<emphasis>type</emphasis>_scaled_font(<!-- -->)</function>
  1390. * such as cairo_ft_scaled_font_lock_face().
  1391. *
  1392. * The behavior of calling a type-specific function with a scaled font
  1393. * of the wrong type is undefined.
  1394. *
  1395. * New entries may be added in future versions.
  1396. *
  1397. * Since: 1.2
  1398. **/
  1399. typedef enum _cairo_font_type {
  1400. CAIRO_FONT_TYPE_TOY,
  1401. CAIRO_FONT_TYPE_FT,
  1402. CAIRO_FONT_TYPE_WIN32,
  1403. CAIRO_FONT_TYPE_QUARTZ,
  1404. CAIRO_FONT_TYPE_USER
  1405. } cairo_font_type_t;
  1406. cairo_public cairo_font_type_t
  1407. cairo_font_face_get_type (cairo_font_face_t *font_face);
  1408. cairo_public void *
  1409. cairo_font_face_get_user_data (cairo_font_face_t *font_face,
  1410. const cairo_user_data_key_t *key);
  1411. cairo_public cairo_status_t
  1412. cairo_font_face_set_user_data (cairo_font_face_t *font_face,
  1413. const cairo_user_data_key_t *key,
  1414. void *user_data,
  1415. cairo_destroy_func_t destroy);
  1416. /* Portable interface to general font features. */
  1417. cairo_public cairo_scaled_font_t *
  1418. cairo_scaled_font_create (cairo_font_face_t *font_face,
  1419. const cairo_matrix_t *font_matrix,
  1420. const cairo_matrix_t *ctm,
  1421. const cairo_font_options_t *options);
  1422. cairo_public cairo_scaled_font_t *
  1423. cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
  1424. cairo_public void
  1425. cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
  1426. cairo_public unsigned int
  1427. cairo_scaled_font_get_reference_count (cairo_scaled_font_t *scaled_font);
  1428. cairo_public cairo_status_t
  1429. cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
  1430. cairo_public cairo_font_type_t
  1431. cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
  1432. cairo_public void *
  1433. cairo_scaled_font_get_user_data (cairo_scaled_font_t *scaled_font,
  1434. const cairo_user_data_key_t *key);
  1435. cairo_public cairo_status_t
  1436. cairo_scaled_font_set_user_data (cairo_scaled_font_t *scaled_font,
  1437. const cairo_user_data_key_t *key,
  1438. void *user_data,
  1439. cairo_destroy_func_t destroy);
  1440. cairo_public void
  1441. cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font,
  1442. cairo_font_extents_t *extents);
  1443. cairo_public void
  1444. cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font,
  1445. const char *utf8,
  1446. cairo_text_extents_t *extents);
  1447. cairo_public void
  1448. cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
  1449. const cairo_glyph_t *glyphs,
  1450. int num_glyphs,
  1451. cairo_text_extents_t *extents);
  1452. cairo_public cairo_status_t
  1453. cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
  1454. double x,
  1455. double y,
  1456. const char *utf8,
  1457. int utf8_len,
  1458. cairo_glyph_t **glyphs,
  1459. int *num_glyphs,
  1460. cairo_text_cluster_t **clusters,
  1461. int *num_clusters,
  1462. cairo_text_cluster_flags_t *cluster_flags);
  1463. cairo_public cairo_font_face_t *
  1464. cairo_scaled_font_get_font_face (cairo_scaled_font_t *scaled_font);
  1465. cairo_public void
  1466. cairo_scaled_font_get_font_matrix (cairo_scaled_font_t *scaled_font,
  1467. cairo_matrix_t *font_matrix);
  1468. cairo_public void
  1469. cairo_scaled_font_get_ctm (cairo_scaled_font_t *scaled_font,
  1470. cairo_matrix_t *ctm);
  1471. cairo_public void
  1472. cairo_scaled_font_get_scale_matrix (cairo_scaled_font_t *scaled_font,
  1473. cairo_matrix_t *scale_matrix);
  1474. cairo_public void
  1475. cairo_scaled_font_get_font_options (cairo_scaled_font_t *scaled_font,
  1476. cairo_font_options_t *options);
  1477. /* Toy fonts */
  1478. cairo_public cairo_font_face_t *
  1479. cairo_toy_font_face_create (const char *family,
  1480. cairo_font_slant_t slant,
  1481. cairo_font_weight_t weight);
  1482. cairo_public const char *
  1483. cairo_toy_font_face_get_family (cairo_font_face_t *font_face);
  1484. cairo_public cairo_font_slant_t
  1485. cairo_toy_font_face_get_slant (cairo_font_face_t *font_face);
  1486. cairo_public cairo_font_weight_t
  1487. cairo_toy_font_face_get_weight (cairo_font_face_t *font_face);
  1488. /* User fonts */
  1489. cairo_public cairo_font_face_t *
  1490. cairo_user_font_face_create (void);
  1491. /* User-font method signatures */
  1492. /**
  1493. * cairo_user_scaled_font_init_func_t:
  1494. * @scaled_font: the scaled-font being created
  1495. * @cr: a cairo context, in font space
  1496. * @extents: font extents to fill in, in font space
  1497. *
  1498. * #cairo_user_scaled_font_init_func_t is the type of function which is
  1499. * called when a scaled-font needs to be created for a user font-face.
  1500. *
  1501. * The cairo context @cr is not used by the caller, but is prepared in font
  1502. * space, similar to what the cairo contexts passed to the render_glyph
  1503. * method will look like. The callback can use this context for extents
  1504. * computation for example. After the callback is called, @cr is checked
  1505. * for any error status.
  1506. *
  1507. * The @extents argument is where the user font sets the font extents for
  1508. * @scaled_font. It is in font space, which means that for most cases its
  1509. * ascent and descent members should add to 1.0. @extents is preset to
  1510. * hold a value of 1.0 for ascent, height, and max_x_advance, and 0.0 for
  1511. * descent and max_y_advance members.
  1512. *
  1513. * The callback is optional. If not set, default font extents as described
  1514. * in the previous paragraph will be used.
  1515. *
  1516. * Note that @scaled_font is not fully initialized at this
  1517. * point and trying to use it for text operations in the callback will result
  1518. * in deadlock.
  1519. *
  1520. * Returns: %CAIRO_STATUS_SUCCESS upon success, or an error status on error.
  1521. *
  1522. * Since: 1.8
  1523. **/
  1524. typedef cairo_status_t (*cairo_user_scaled_font_init_func_t) (cairo_scaled_font_t *scaled_font,
  1525. cairo_t *cr,
  1526. cairo_font_extents_t *extents);
  1527. /**
  1528. * cairo_user_scaled_font_render_glyph_func_t:
  1529. * @scaled_font: user scaled-font
  1530. * @glyph: glyph code to render
  1531. * @cr: cairo context to draw to, in font space
  1532. * @extents: glyph extents to fill in, in font space
  1533. *
  1534. * #cairo_user_scaled_font_render_glyph_func_t is the type of function which
  1535. * is called when a user scaled-font needs to render a glyph.
  1536. *
  1537. * The callback is mandatory, and expected to draw the glyph with code @glyph to
  1538. * the cairo context @cr. @cr is prepared such that the glyph drawing is done in
  1539. * font space. That is, the matrix set on @cr is the scale matrix of @scaled_font,
  1540. * The @extents argument is where the user font sets the font extents for
  1541. * @scaled_font. However, if user prefers to draw in user space, they can
  1542. * achieve that by changing the matrix on @cr. All cairo rendering operations
  1543. * to @cr are permitted, however, the result is undefined if any source other
  1544. * than the default source on @cr is used. That means, glyph bitmaps should
  1545. * be rendered using cairo_mask() instead of cairo_paint().
  1546. *
  1547. * Other non-default settings on @cr include a font size of 1.0 (given that
  1548. * it is set up to be in font space), and font options corresponding to
  1549. * @scaled_font.
  1550. *
  1551. * The @extents argument is preset to have <literal>x_bearing</literal>,
  1552. * <literal>width</literal>, and <literal>y_advance</literal> of zero,
  1553. * <literal>y_bearing</literal> set to <literal>-font_extents.ascent</literal>,
  1554. * <literal>height</literal> to <literal>font_extents.ascent+font_extents.descent</literal>,
  1555. * and <literal>x_advance</literal> to <literal>font_extents.max_x_advance</literal>.
  1556. * The only field user needs to set in majority of cases is
  1557. * <literal>x_advance</literal>.
  1558. * If the <literal>width</literal> field is zero upon the callback returning
  1559. * (which is its preset value), the glyph extents are automatically computed
  1560. * based on the drawings done to @cr. This is in most cases exactly what the
  1561. * desired behavior is. However, if for any reason the callback sets the
  1562. * extents, it must be ink extents, and include the extents of all drawing
  1563. * done to @cr in the callback.
  1564. *
  1565. * Returns: %CAIRO_STATUS_SUCCESS upon success, or
  1566. * %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
  1567. *
  1568. * Since: 1.8
  1569. **/
  1570. typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scaled_font_t *scaled_font,
  1571. unsigned long glyph,
  1572. cairo_t *cr,
  1573. cairo_text_extents_t *extents);
  1574. /**
  1575. * cairo_user_scaled_font_text_to_glyphs_func_t:
  1576. * @scaled_font: the scaled-font being created
  1577. * @utf8: a string of text encoded in UTF-8
  1578. * @utf8_len: length of @utf8 in bytes
  1579. * @glyphs: pointer to array of glyphs to fill, in font space
  1580. * @num_glyphs: pointer to number of glyphs
  1581. * @clusters: pointer to array of cluster mapping information to fill, or %NULL
  1582. * @num_clusters: pointer to number of clusters
  1583. * @cluster_flags: pointer to location to store cluster flags corresponding to the
  1584. * output @clusters
  1585. *
  1586. * #cairo_user_scaled_font_text_to_glyphs_func_t is the type of function which
  1587. * is called to convert input text to an array of glyphs. This is used by the
  1588. * cairo_show_text() operation.
  1589. *
  1590. * Using this callback the user-font has full control on glyphs and their
  1591. * positions. That means, it allows for features like ligatures and kerning,
  1592. * as well as complex <firstterm>shaping</firstterm> required for scripts like
  1593. * Arabic and Indic.
  1594. *
  1595. * The @num_glyphs argument is preset to the number of glyph entries available
  1596. * in the @glyphs buffer. If the @glyphs buffer is %NULL, the value of
  1597. * @num_glyphs will be zero. If the provided glyph array is too short for
  1598. * the conversion (or for convenience), a new glyph array may be allocated
  1599. * using cairo_glyph_allocate() and placed in @glyphs. Upon return,
  1600. * @num_glyphs should contain the number of generated glyphs. If the value
  1601. * @glyphs points at has changed after the call, the caller will free the
  1602. * allocated glyph array using cairo_glyph_free(). The caller will also free
  1603. * the original value of @glyphs, so the callback shouldn't do so.
  1604. * The callback should populate the glyph indices and positions (in font space)
  1605. * assuming that the text is to be shown at the origin.
  1606. *
  1607. * If @clusters is not %NULL, @num_clusters and @cluster_flags are also
  1608. * non-%NULL, and cluster mapping should be computed. The semantics of how
  1609. * cluster array allocation works is similar to the glyph array. That is,
  1610. * if @clusters initially points to a non-%NULL value, that array may be used
  1611. * as a cluster buffer, and @num_clusters points to the number of cluster
  1612. * entries available there. If the provided cluster array is too short for
  1613. * the conversion (or for convenience), a new cluster array may be allocated
  1614. * using cairo_text_cluster_allocate() and placed in @clusters. In this case,
  1615. * the original value of @clusters will still be freed by the caller. Upon
  1616. * return, @num_clusters should contain the number of generated clusters.
  1617. * If the value @clusters points at has changed after the call, the caller
  1618. * will free the allocated cluster array using cairo_text_cluster_free().
  1619. *
  1620. * The callback is optional. If @num_glyphs is negative upon
  1621. * the callback returning or if the return value
  1622. * is %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, the unicode_to_glyph callback
  1623. * is tried. See #cairo_user_scaled_font_unicode_to_glyph_func_t.
  1624. *
  1625. * Note: While cairo does not impose any limitation on glyph indices,
  1626. * some applications may assume that a glyph index fits in a 16-bit
  1627. * unsigned integer. As such, it is advised that user-fonts keep their
  1628. * glyphs in the 0 to 65535 range. Furthermore, some applications may
  1629. * assume that glyph 0 is a special glyph-not-found glyph. User-fonts
  1630. * are advised to use glyph 0 for such purposes and do not use that
  1631. * glyph value for other purposes.
  1632. *
  1633. * Returns: %CAIRO_STATUS_SUCCESS upon success,
  1634. * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried,
  1635. * or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
  1636. *
  1637. * Since: 1.8
  1638. **/
  1639. typedef cairo_status_t (*cairo_user_scaled_font_text_to_glyphs_func_t) (cairo_scaled_font_t *scaled_font,
  1640. const char *utf8,
  1641. int utf8_len,
  1642. cairo_glyph_t **glyphs,
  1643. int *num_glyphs,
  1644. cairo_text_cluster_t **clusters,
  1645. int *num_clusters,
  1646. cairo_text_cluster_flags_t *cluster_flags);
  1647. /**
  1648. * cairo_user_scaled_font_unicode_to_glyph_func_t:
  1649. * @scaled_font: the scaled-font being created
  1650. * @unicode: input unicode character code-point
  1651. * @glyph_index: output glyph index
  1652. *
  1653. * #cairo_user_scaled_font_unicode_to_glyph_func_t is the type of function which
  1654. * is called to convert an input Unicode character to a single glyph.
  1655. * This is used by the cairo_show_text() operation.
  1656. *
  1657. * This callback is used to provide the same functionality as the
  1658. * text_to_glyphs callback does (see #cairo_user_scaled_font_text_to_glyphs_func_t)
  1659. * but has much less control on the output,
  1660. * in exchange for increased ease of use. The inherent assumption to using
  1661. * this callback is that each character maps to one glyph, and that the
  1662. * mapping is context independent. It also assumes that glyphs are positioned
  1663. * according to their advance width. These mean no ligatures, kerning, or
  1664. * complex scripts can be implemented using this callback.
  1665. *
  1666. * The callback is optional, and only used if text_to_glyphs callback is not
  1667. * set or fails to return glyphs. If this callback is not set or if it returns
  1668. * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, an identity mapping from Unicode
  1669. * code-points to glyph indices is assumed.
  1670. *
  1671. * Note: While cairo does not impose any limitation on glyph indices,
  1672. * some applications may assume that a glyph index fits in a 16-bit
  1673. * unsigned integer. As such, it is advised that user-fonts keep their
  1674. * glyphs in the 0 to 65535 range. Furthermore, some applications may
  1675. * assume that glyph 0 is a special glyph-not-found glyph. User-fonts
  1676. * are advised to use glyph 0 for such purposes and do not use that
  1677. * glyph value for other purposes.
  1678. *
  1679. * Returns: %CAIRO_STATUS_SUCCESS upon success,
  1680. * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried,
  1681. * or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
  1682. *
  1683. * Since: 1.8
  1684. **/
  1685. typedef cairo_status_t (*cairo_user_scaled_font_unicode_to_glyph_func_t) (cairo_scaled_font_t *scaled_font,
  1686. unsigned long unicode,
  1687. unsigned long *glyph_index);
  1688. /* User-font method setters */
  1689. cairo_public void
  1690. cairo_user_font_face_set_init_func (cairo_font_face_t *font_face,
  1691. cairo_user_scaled_font_init_func_t init_func);
  1692. cairo_public void
  1693. cairo_user_font_face_set_render_glyph_func (cairo_font_face_t *font_face,
  1694. cairo_user_scaled_font_render_glyph_func_t render_glyph_func);
  1695. cairo_public void
  1696. cairo_user_font_face_set_text_to_glyphs_func (cairo_font_face_t *font_face,
  1697. cairo_user_scaled_font_text_to_glyphs_func_t text_to_glyphs_func);
  1698. cairo_public void
  1699. cairo_user_font_face_set_unicode_to_glyph_func (cairo_font_face_t *font_face,
  1700. cairo_user_scaled_font_unicode_to_glyph_func_t unicode_to_glyph_func);
  1701. /* User-font method getters */
  1702. cairo_public cairo_user_scaled_font_init_func_t
  1703. cairo_user_font_face_get_init_func (cairo_font_face_t *font_face);
  1704. cairo_public cairo_user_scaled_font_render_glyph_func_t
  1705. cairo_user_font_face_get_render_glyph_func (cairo_font_face_t *font_face);
  1706. cairo_public cairo_user_scaled_font_text_to_glyphs_func_t
  1707. cairo_user_font_face_get_text_to_glyphs_func (cairo_font_face_t *font_face);
  1708. cairo_public cairo_user_scaled_font_unicode_to_glyph_func_t
  1709. cairo_user_font_face_get_unicode_to_glyph_func (cairo_font_face_t *font_face);
  1710. /* Query functions */
  1711. cairo_public cairo_operator_t
  1712. cairo_get_operator (cairo_t *cr);
  1713. cairo_public cairo_pattern_t *
  1714. cairo_get_source (cairo_t *cr);
  1715. cairo_public double
  1716. cairo_get_tolerance (cairo_t *cr);
  1717. cairo_public cairo_antialias_t
  1718. cairo_get_antialias (cairo_t *cr);
  1719. cairo_public cairo_bool_t
  1720. cairo_has_current_point (cairo_t *cr);
  1721. cairo_public void
  1722. cairo_get_current_point (cairo_t *cr, double *x, double *y);
  1723. cairo_public cairo_fill_rule_t
  1724. cairo_get_fill_rule (cairo_t *cr);
  1725. cairo_public double
  1726. cairo_get_line_width (cairo_t *cr);
  1727. cairo_public cairo_line_cap_t
  1728. cairo_get_line_cap (cairo_t *cr);
  1729. cairo_public cairo_line_join_t
  1730. cairo_get_line_join (cairo_t *cr);
  1731. cairo_public double
  1732. cairo_get_miter_limit (cairo_t *cr);
  1733. cairo_public int
  1734. cairo_get_dash_count (cairo_t *cr);
  1735. cairo_public void
  1736. cairo_get_dash (cairo_t *cr, double *dashes, double *offset);
  1737. cairo_public void
  1738. cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix);
  1739. cairo_public cairo_surface_t *
  1740. cairo_get_target (cairo_t *cr);
  1741. cairo_public cairo_surface_t *
  1742. cairo_get_group_target (cairo_t *cr);
  1743. /**
  1744. * cairo_path_data_type_t:
  1745. * @CAIRO_PATH_MOVE_TO: A move-to operation, since 1.0
  1746. * @CAIRO_PATH_LINE_TO: A line-to operation, since 1.0
  1747. * @CAIRO_PATH_CURVE_TO: A curve-to operation, since 1.0
  1748. * @CAIRO_PATH_CLOSE_PATH: A close-path operation, since 1.0
  1749. *
  1750. * #cairo_path_data_t is used to describe the type of one portion
  1751. * of a path when represented as a #cairo_path_t.
  1752. * See #cairo_path_data_t for details.
  1753. *
  1754. * Since: 1.0
  1755. **/
  1756. typedef enum _cairo_path_data_type {
  1757. CAIRO_PATH_MOVE_TO,
  1758. CAIRO_PATH_LINE_TO,
  1759. CAIRO_PATH_CURVE_TO,
  1760. CAIRO_PATH_CLOSE_PATH
  1761. } cairo_path_data_type_t;
  1762. /**
  1763. * cairo_path_data_t:
  1764. *
  1765. * #cairo_path_data_t is used to represent the path data inside a
  1766. * #cairo_path_t.
  1767. *
  1768. * The data structure is designed to try to balance the demands of
  1769. * efficiency and ease-of-use. A path is represented as an array of
  1770. * #cairo_path_data_t, which is a union of headers and points.
  1771. *
  1772. * Each portion of the path is represented by one or more elements in
  1773. * the array, (one header followed by 0 or more points). The length
  1774. * value of the header is the number of array elements for the current
  1775. * portion including the header, (ie. length == 1 + # of points), and
  1776. * where the number of points for each element type is as follows:
  1777. *
  1778. * <programlisting>
  1779. * %CAIRO_PATH_MOVE_TO: 1 point
  1780. * %CAIRO_PATH_LINE_TO: 1 point
  1781. * %CAIRO_PATH_CURVE_TO: 3 points
  1782. * %CAIRO_PATH_CLOSE_PATH: 0 points
  1783. * </programlisting>
  1784. *
  1785. * The semantics and ordering of the coordinate values are consistent
  1786. * with cairo_move_to(), cairo_line_to(), cairo_curve_to(), and
  1787. * cairo_close_path().
  1788. *
  1789. * Here is sample code for iterating through a #cairo_path_t:
  1790. *
  1791. * <informalexample><programlisting>
  1792. * int i;
  1793. * cairo_path_t *path;
  1794. * cairo_path_data_t *data;
  1795. * &nbsp;
  1796. * path = cairo_copy_path (cr);
  1797. * &nbsp;
  1798. * for (i=0; i < path->num_data; i += path->data[i].header.length) {
  1799. * data = &amp;path->data[i];
  1800. * switch (data->header.type) {
  1801. * case CAIRO_PATH_MOVE_TO:
  1802. * do_move_to_things (data[1].point.x, data[1].point.y);
  1803. * break;
  1804. * case CAIRO_PATH_LINE_TO:
  1805. * do_line_to_things (data[1].point.x, data[1].point.y);
  1806. * break;
  1807. * case CAIRO_PATH_CURVE_TO:
  1808. * do_curve_to_things (data[1].point.x, data[1].point.y,
  1809. * data[2].point.x, data[2].point.y,
  1810. * data[3].point.x, data[3].point.y);
  1811. * break;
  1812. * case CAIRO_PATH_CLOSE_PATH:
  1813. * do_close_path_things ();
  1814. * break;
  1815. * }
  1816. * }
  1817. * cairo_path_destroy (path);
  1818. * </programlisting></informalexample>
  1819. *
  1820. * As of cairo 1.4, cairo does not mind if there are more elements in
  1821. * a portion of the path than needed. Such elements can be used by
  1822. * users of the cairo API to hold extra values in the path data
  1823. * structure. For this reason, it is recommended that applications
  1824. * always use <literal>data->header.length</literal> to
  1825. * iterate over the path data, instead of hardcoding the number of
  1826. * elements for each element type.
  1827. *
  1828. * Since: 1.0
  1829. **/
  1830. typedef union _cairo_path_data_t cairo_path_data_t;
  1831. union _cairo_path_data_t {
  1832. struct {
  1833. cairo_path_data_type_t type;
  1834. int length;
  1835. } header;
  1836. struct {
  1837. double x, y;
  1838. } point;
  1839. };
  1840. /**
  1841. * cairo_path_t:
  1842. * @status: the current error status
  1843. * @data: the elements in the path
  1844. * @num_data: the number of elements in the data array
  1845. *
  1846. * A data structure for holding a path. This data structure serves as
  1847. * the return value for cairo_copy_path() and
  1848. * cairo_copy_path_flat() as well the input value for
  1849. * cairo_append_path().
  1850. *
  1851. * See #cairo_path_data_t for hints on how to iterate over the
  1852. * actual data within the path.
  1853. *
  1854. * The num_data member gives the number of elements in the data
  1855. * array. This number is larger than the number of independent path
  1856. * portions (defined in #cairo_path_data_type_t), since the data
  1857. * includes both headers and coordinates for each portion.
  1858. *
  1859. * Since: 1.0
  1860. **/
  1861. typedef struct cairo_path {
  1862. cairo_status_t status;
  1863. cairo_path_data_t *data;
  1864. int num_data;
  1865. } cairo_path_t;
  1866. cairo_public cairo_path_t *
  1867. cairo_copy_path (cairo_t *cr);
  1868. cairo_public cairo_path_t *
  1869. cairo_copy_path_flat (cairo_t *cr);
  1870. cairo_public void
  1871. cairo_append_path (cairo_t *cr,
  1872. const cairo_path_t *path);
  1873. cairo_public void
  1874. cairo_path_destroy (cairo_path_t *path);
  1875. /* Error status queries */
  1876. cairo_public cairo_status_t
  1877. cairo_status (cairo_t *cr);
  1878. cairo_public const char *
  1879. cairo_status_to_string (cairo_status_t status);
  1880. /* Backend device manipulation */
  1881. cairo_public cairo_device_t *
  1882. cairo_device_reference (cairo_device_t *device);
  1883. /**
  1884. * cairo_device_type_t:
  1885. * @CAIRO_DEVICE_TYPE_DRM: The device is of type Direct Render Manager, since 1.10
  1886. * @CAIRO_DEVICE_TYPE_GL: The device is of type OpenGL, since 1.10
  1887. * @CAIRO_DEVICE_TYPE_SCRIPT: The device is of type script, since 1.10
  1888. * @CAIRO_DEVICE_TYPE_XCB: The device is of type xcb, since 1.10
  1889. * @CAIRO_DEVICE_TYPE_XLIB: The device is of type xlib, since 1.10
  1890. * @CAIRO_DEVICE_TYPE_XML: The device is of type XML, since 1.10
  1891. * @CAIRO_DEVICE_TYPE_COGL: The device is of type cogl, since 1.12
  1892. * @CAIRO_DEVICE_TYPE_WIN32: The device is of type win32, since 1.12
  1893. * @CAIRO_DEVICE_TYPE_INVALID: The device is invalid, since 1.10
  1894. *
  1895. * #cairo_device_type_t is used to describe the type of a given
  1896. * device. The devices types are also known as "backends" within cairo.
  1897. *
  1898. * The device type can be queried with cairo_device_get_type()
  1899. *
  1900. * The various #cairo_device_t functions can be used with devices of
  1901. * any type, but some backends also provide type-specific functions
  1902. * that must only be called with a device of the appropriate
  1903. * type. These functions have names that begin with
  1904. * <literal>cairo_<emphasis>type</emphasis>_device</literal> such as
  1905. * cairo_xcb_device_debug_cap_xrender_version().
  1906. *
  1907. * The behavior of calling a type-specific function with a device of
  1908. * the wrong type is undefined.
  1909. *
  1910. * New entries may be added in future versions.
  1911. *
  1912. * Since: 1.10
  1913. **/
  1914. typedef enum _cairo_device_type {
  1915. CAIRO_DEVICE_TYPE_DRM,
  1916. CAIRO_DEVICE_TYPE_GL,
  1917. CAIRO_DEVICE_TYPE_SCRIPT,
  1918. CAIRO_DEVICE_TYPE_XCB,
  1919. CAIRO_DEVICE_TYPE_XLIB,
  1920. CAIRO_DEVICE_TYPE_XML,
  1921. CAIRO_DEVICE_TYPE_COGL,
  1922. CAIRO_DEVICE_TYPE_WIN32,
  1923. CAIRO_DEVICE_TYPE_INVALID = -1
  1924. } cairo_device_type_t;
  1925. cairo_public cairo_device_type_t
  1926. cairo_device_get_type (cairo_device_t *device);
  1927. cairo_public cairo_status_t
  1928. cairo_device_status (cairo_device_t *device);
  1929. cairo_public cairo_status_t
  1930. cairo_device_acquire (cairo_device_t *device);
  1931. cairo_public void
  1932. cairo_device_release (cairo_device_t *device);
  1933. cairo_public void
  1934. cairo_device_flush (cairo_device_t *device);
  1935. cairo_public void
  1936. cairo_device_finish (cairo_device_t *device);
  1937. cairo_public void
  1938. cairo_device_destroy (cairo_device_t *device);
  1939. cairo_public unsigned int
  1940. cairo_device_get_reference_count (cairo_device_t *device);
  1941. cairo_public void *
  1942. cairo_device_get_user_data (cairo_device_t *device,
  1943. const cairo_user_data_key_t *key);
  1944. cairo_public cairo_status_t
  1945. cairo_device_set_user_data (cairo_device_t *device,
  1946. const cairo_user_data_key_t *key,
  1947. void *user_data,
  1948. cairo_destroy_func_t destroy);
  1949. /* Surface manipulation */
  1950. cairo_public cairo_surface_t *
  1951. cairo_surface_create_similar (cairo_surface_t *other,
  1952. cairo_content_t content,
  1953. int width,
  1954. int height);
  1955. cairo_public cairo_surface_t *
  1956. cairo_surface_create_similar_image (cairo_surface_t *other,
  1957. cairo_format_t format,
  1958. int width,
  1959. int height);
  1960. cairo_public cairo_surface_t *
  1961. cairo_surface_map_to_image (cairo_surface_t *surface,
  1962. const cairo_rectangle_int_t *extents);
  1963. cairo_public void
  1964. cairo_surface_unmap_image (cairo_surface_t *surface,
  1965. cairo_surface_t *image);
  1966. cairo_public cairo_surface_t *
  1967. cairo_surface_create_for_rectangle (cairo_surface_t *target,
  1968. double x,
  1969. double y,
  1970. double width,
  1971. double height);
  1972. /**
  1973. * cairo_surface_observer_mode_t:
  1974. * @CAIRO_SURFACE_OBSERVER_NORMAL: no recording is done
  1975. * @CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS: operations are recorded
  1976. *
  1977. * Whether operations should be recorded.
  1978. *
  1979. * Since: 1.12
  1980. **/
  1981. typedef enum {
  1982. CAIRO_SURFACE_OBSERVER_NORMAL = 0,
  1983. CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS = 0x1
  1984. } cairo_surface_observer_mode_t;
  1985. cairo_public cairo_surface_t *
  1986. cairo_surface_create_observer (cairo_surface_t *target,
  1987. cairo_surface_observer_mode_t mode);
  1988. typedef void (*cairo_surface_observer_callback_t) (cairo_surface_t *observer,
  1989. cairo_surface_t *target,
  1990. void *data);
  1991. cairo_public cairo_status_t
  1992. cairo_surface_observer_add_paint_callback (cairo_surface_t *abstract_surface,
  1993. cairo_surface_observer_callback_t func,
  1994. void *data);
  1995. cairo_public cairo_status_t
  1996. cairo_surface_observer_add_mask_callback (cairo_surface_t *abstract_surface,
  1997. cairo_surface_observer_callback_t func,
  1998. void *data);
  1999. cairo_public cairo_status_t
  2000. cairo_surface_observer_add_fill_callback (cairo_surface_t *abstract_surface,
  2001. cairo_surface_observer_callback_t func,
  2002. void *data);
  2003. cairo_public cairo_status_t
  2004. cairo_surface_observer_add_stroke_callback (cairo_surface_t *abstract_surface,
  2005. cairo_surface_observer_callback_t func,
  2006. void *data);
  2007. cairo_public cairo_status_t
  2008. cairo_surface_observer_add_glyphs_callback (cairo_surface_t *abstract_surface,
  2009. cairo_surface_observer_callback_t func,
  2010. void *data);
  2011. cairo_public cairo_status_t
  2012. cairo_surface_observer_add_flush_callback (cairo_surface_t *abstract_surface,
  2013. cairo_surface_observer_callback_t func,
  2014. void *data);
  2015. cairo_public cairo_status_t
  2016. cairo_surface_observer_add_finish_callback (cairo_surface_t *abstract_surface,
  2017. cairo_surface_observer_callback_t func,
  2018. void *data);
  2019. cairo_public cairo_status_t
  2020. cairo_surface_observer_print (cairo_surface_t *surface,
  2021. cairo_write_func_t write_func,
  2022. void *closure);
  2023. cairo_public double
  2024. cairo_surface_observer_elapsed (cairo_surface_t *surface);
  2025. cairo_public cairo_status_t
  2026. cairo_device_observer_print (cairo_device_t *device,
  2027. cairo_write_func_t write_func,
  2028. void *closure);
  2029. cairo_public double
  2030. cairo_device_observer_elapsed (cairo_device_t *device);
  2031. cairo_public double
  2032. cairo_device_observer_paint_elapsed (cairo_device_t *device);
  2033. cairo_public double
  2034. cairo_device_observer_mask_elapsed (cairo_device_t *device);
  2035. cairo_public double
  2036. cairo_device_observer_fill_elapsed (cairo_device_t *device);
  2037. cairo_public double
  2038. cairo_device_observer_stroke_elapsed (cairo_device_t *device);
  2039. cairo_public double
  2040. cairo_device_observer_glyphs_elapsed (cairo_device_t *device);
  2041. cairo_public cairo_surface_t *
  2042. cairo_surface_reference (cairo_surface_t *surface);
  2043. cairo_public void
  2044. cairo_surface_finish (cairo_surface_t *surface);
  2045. cairo_public void
  2046. cairo_surface_destroy (cairo_surface_t *surface);
  2047. cairo_public cairo_device_t *
  2048. cairo_surface_get_device (cairo_surface_t *surface);
  2049. cairo_public unsigned int
  2050. cairo_surface_get_reference_count (cairo_surface_t *surface);
  2051. cairo_public cairo_status_t
  2052. cairo_surface_status (cairo_surface_t *surface);
  2053. /**
  2054. * cairo_surface_type_t:
  2055. * @CAIRO_SURFACE_TYPE_IMAGE: The surface is of type image, since 1.2
  2056. * @CAIRO_SURFACE_TYPE_PDF: The surface is of type pdf, since 1.2
  2057. * @CAIRO_SURFACE_TYPE_PS: The surface is of type ps, since 1.2
  2058. * @CAIRO_SURFACE_TYPE_XLIB: The surface is of type xlib, since 1.2
  2059. * @CAIRO_SURFACE_TYPE_XCB: The surface is of type xcb, since 1.2
  2060. * @CAIRO_SURFACE_TYPE_GLITZ: The surface is of type glitz, since 1.2
  2061. * @CAIRO_SURFACE_TYPE_QUARTZ: The surface is of type quartz, since 1.2
  2062. * @CAIRO_SURFACE_TYPE_WIN32: The surface is of type win32, since 1.2
  2063. * @CAIRO_SURFACE_TYPE_BEOS: The surface is of type beos, since 1.2
  2064. * @CAIRO_SURFACE_TYPE_DIRECTFB: The surface is of type directfb, since 1.2
  2065. * @CAIRO_SURFACE_TYPE_SVG: The surface is of type svg, since 1.2
  2066. * @CAIRO_SURFACE_TYPE_OS2: The surface is of type os2, since 1.4
  2067. * @CAIRO_SURFACE_TYPE_WIN32_PRINTING: The surface is a win32 printing surface, since 1.6
  2068. * @CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: The surface is of type quartz_image, since 1.6
  2069. * @CAIRO_SURFACE_TYPE_SCRIPT: The surface is of type script, since 1.10
  2070. * @CAIRO_SURFACE_TYPE_QT: The surface is of type Qt, since 1.10
  2071. * @CAIRO_SURFACE_TYPE_RECORDING: The surface is of type recording, since 1.10
  2072. * @CAIRO_SURFACE_TYPE_VG: The surface is a OpenVG surface, since 1.10
  2073. * @CAIRO_SURFACE_TYPE_GL: The surface is of type OpenGL, since 1.10
  2074. * @CAIRO_SURFACE_TYPE_DRM: The surface is of type Direct Render Manager, since 1.10
  2075. * @CAIRO_SURFACE_TYPE_TEE: The surface is of type 'tee' (a multiplexing surface), since 1.10
  2076. * @CAIRO_SURFACE_TYPE_XML: The surface is of type XML (for debugging), since 1.10
  2077. * @CAIRO_SURFACE_TYPE_SUBSURFACE: The surface is a subsurface created with
  2078. * cairo_surface_create_for_rectangle(), since 1.10
  2079. * @CAIRO_SURFACE_TYPE_COGL: This surface is of type Cogl, since 1.12
  2080. *
  2081. * #cairo_surface_type_t is used to describe the type of a given
  2082. * surface. The surface types are also known as "backends" or "surface
  2083. * backends" within cairo.
  2084. *
  2085. * The type of a surface is determined by the function used to create
  2086. * it, which will generally be of the form
  2087. * <function>cairo_<emphasis>type</emphasis>_surface_create(<!-- -->)</function>,
  2088. * (though see cairo_surface_create_similar() as well).
  2089. *
  2090. * The surface type can be queried with cairo_surface_get_type()
  2091. *
  2092. * The various #cairo_surface_t functions can be used with surfaces of
  2093. * any type, but some backends also provide type-specific functions
  2094. * that must only be called with a surface of the appropriate
  2095. * type. These functions have names that begin with
  2096. * <literal>cairo_<emphasis>type</emphasis>_surface</literal> such as cairo_image_surface_get_width().
  2097. *
  2098. * The behavior of calling a type-specific function with a surface of
  2099. * the wrong type is undefined.
  2100. *
  2101. * New entries may be added in future versions.
  2102. *
  2103. * Since: 1.2
  2104. **/
  2105. typedef enum _cairo_surface_type {
  2106. CAIRO_SURFACE_TYPE_IMAGE,
  2107. CAIRO_SURFACE_TYPE_PDF,
  2108. CAIRO_SURFACE_TYPE_PS,
  2109. CAIRO_SURFACE_TYPE_XLIB,
  2110. CAIRO_SURFACE_TYPE_XCB,
  2111. CAIRO_SURFACE_TYPE_GLITZ,
  2112. CAIRO_SURFACE_TYPE_QUARTZ,
  2113. CAIRO_SURFACE_TYPE_WIN32,
  2114. CAIRO_SURFACE_TYPE_BEOS,
  2115. CAIRO_SURFACE_TYPE_DIRECTFB,
  2116. CAIRO_SURFACE_TYPE_SVG,
  2117. CAIRO_SURFACE_TYPE_OS2,
  2118. CAIRO_SURFACE_TYPE_WIN32_PRINTING,
  2119. CAIRO_SURFACE_TYPE_QUARTZ_IMAGE,
  2120. CAIRO_SURFACE_TYPE_SCRIPT,
  2121. CAIRO_SURFACE_TYPE_QT,
  2122. CAIRO_SURFACE_TYPE_RECORDING,
  2123. CAIRO_SURFACE_TYPE_VG,
  2124. CAIRO_SURFACE_TYPE_GL,
  2125. CAIRO_SURFACE_TYPE_DRM,
  2126. CAIRO_SURFACE_TYPE_TEE,
  2127. CAIRO_SURFACE_TYPE_XML,
  2128. CAIRO_SURFACE_TYPE_SKIA,
  2129. CAIRO_SURFACE_TYPE_SUBSURFACE,
  2130. CAIRO_SURFACE_TYPE_COGL
  2131. } cairo_surface_type_t;
  2132. cairo_public cairo_surface_type_t
  2133. cairo_surface_get_type (cairo_surface_t *surface);
  2134. cairo_public cairo_content_t
  2135. cairo_surface_get_content (cairo_surface_t *surface);
  2136. #if CAIRO_HAS_PNG_FUNCTIONS
  2137. cairo_public cairo_status_t
  2138. cairo_surface_write_to_png (cairo_surface_t *surface,
  2139. const char *filename);
  2140. cairo_public cairo_status_t
  2141. cairo_surface_write_to_png_stream (cairo_surface_t *surface,
  2142. cairo_write_func_t write_func,
  2143. void *closure);
  2144. #endif
  2145. cairo_public void *
  2146. cairo_surface_get_user_data (cairo_surface_t *surface,
  2147. const cairo_user_data_key_t *key);
  2148. cairo_public cairo_status_t
  2149. cairo_surface_set_user_data (cairo_surface_t *surface,
  2150. const cairo_user_data_key_t *key,
  2151. void *user_data,
  2152. cairo_destroy_func_t destroy);
  2153. #define CAIRO_MIME_TYPE_JPEG "image/jpeg"
  2154. #define CAIRO_MIME_TYPE_PNG "image/png"
  2155. #define CAIRO_MIME_TYPE_JP2 "image/jp2"
  2156. #define CAIRO_MIME_TYPE_URI "text/x-uri"
  2157. #define CAIRO_MIME_TYPE_UNIQUE_ID "application/x-cairo.uuid"
  2158. #define CAIRO_MIME_TYPE_JBIG2 "application/x-cairo.jbig2"
  2159. #define CAIRO_MIME_TYPE_JBIG2_GLOBAL "application/x-cairo.jbig2-global"
  2160. #define CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID "application/x-cairo.jbig2-global-id"
  2161. #define CAIRO_MIME_TYPE_CCITT_FAX "image/g3fax"
  2162. #define CAIRO_MIME_TYPE_CCITT_FAX_PARAMS "application/x-cairo.ccitt.params"
  2163. #define CAIRO_MIME_TYPE_EPS "application/postscript"
  2164. #define CAIRO_MIME_TYPE_EPS_PARAMS "application/x-cairo.eps.params"
  2165. cairo_public void
  2166. cairo_surface_get_mime_data (cairo_surface_t *surface,
  2167. const char *mime_type,
  2168. const unsigned char **data,
  2169. unsigned long *length);
  2170. cairo_public cairo_status_t
  2171. cairo_surface_set_mime_data (cairo_surface_t *surface,
  2172. const char *mime_type,
  2173. const unsigned char *data,
  2174. unsigned long length,
  2175. cairo_destroy_func_t destroy,
  2176. void *closure);
  2177. cairo_public cairo_bool_t
  2178. cairo_surface_supports_mime_type (cairo_surface_t *surface,
  2179. const char *mime_type);
  2180. cairo_public void
  2181. cairo_surface_get_font_options (cairo_surface_t *surface,
  2182. cairo_font_options_t *options);
  2183. cairo_public void
  2184. cairo_surface_flush (cairo_surface_t *surface);
  2185. cairo_public void
  2186. cairo_surface_mark_dirty (cairo_surface_t *surface);
  2187. cairo_public void
  2188. cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
  2189. int x,
  2190. int y,
  2191. int width,
  2192. int height);
  2193. cairo_public void
  2194. cairo_surface_set_device_scale (cairo_surface_t *surface,
  2195. double x_scale,
  2196. double y_scale);
  2197. cairo_public void
  2198. cairo_surface_get_device_scale (cairo_surface_t *surface,
  2199. double *x_scale,
  2200. double *y_scale);
  2201. cairo_public void
  2202. cairo_surface_set_device_offset (cairo_surface_t *surface,
  2203. double x_offset,
  2204. double y_offset);
  2205. cairo_public void
  2206. cairo_surface_get_device_offset (cairo_surface_t *surface,
  2207. double *x_offset,
  2208. double *y_offset);
  2209. cairo_public void
  2210. cairo_surface_set_fallback_resolution (cairo_surface_t *surface,
  2211. double x_pixels_per_inch,
  2212. double y_pixels_per_inch);
  2213. cairo_public void
  2214. cairo_surface_get_fallback_resolution (cairo_surface_t *surface,
  2215. double *x_pixels_per_inch,
  2216. double *y_pixels_per_inch);
  2217. cairo_public void
  2218. cairo_surface_copy_page (cairo_surface_t *surface);
  2219. cairo_public void
  2220. cairo_surface_show_page (cairo_surface_t *surface);
  2221. cairo_public cairo_bool_t
  2222. cairo_surface_has_show_text_glyphs (cairo_surface_t *surface);
  2223. /* Image-surface functions */
  2224. cairo_public cairo_surface_t *
  2225. cairo_image_surface_create (cairo_format_t format,
  2226. int width,
  2227. int height);
  2228. cairo_public int
  2229. cairo_format_stride_for_width (cairo_format_t format,
  2230. int width);
  2231. cairo_public cairo_surface_t *
  2232. cairo_image_surface_create_for_data (unsigned char *data,
  2233. cairo_format_t format,
  2234. int width,
  2235. int height,
  2236. int stride);
  2237. cairo_public unsigned char *
  2238. cairo_image_surface_get_data (cairo_surface_t *surface);
  2239. cairo_public cairo_format_t
  2240. cairo_image_surface_get_format (cairo_surface_t *surface);
  2241. cairo_public int
  2242. cairo_image_surface_get_width (cairo_surface_t *surface);
  2243. cairo_public int
  2244. cairo_image_surface_get_height (cairo_surface_t *surface);
  2245. cairo_public int
  2246. cairo_image_surface_get_stride (cairo_surface_t *surface);
  2247. #if CAIRO_HAS_PNG_FUNCTIONS
  2248. cairo_public cairo_surface_t *
  2249. cairo_image_surface_create_from_png (const char *filename);
  2250. cairo_public cairo_surface_t *
  2251. cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
  2252. void *closure);
  2253. #endif
  2254. /* Recording-surface functions */
  2255. cairo_public cairo_surface_t *
  2256. cairo_recording_surface_create (cairo_content_t content,
  2257. const cairo_rectangle_t *extents);
  2258. cairo_public void
  2259. cairo_recording_surface_ink_extents (cairo_surface_t *surface,
  2260. double *x0,
  2261. double *y0,
  2262. double *width,
  2263. double *height);
  2264. cairo_public cairo_bool_t
  2265. cairo_recording_surface_get_extents (cairo_surface_t *surface,
  2266. cairo_rectangle_t *extents);
  2267. /* raster-source pattern (callback) functions */
  2268. /**
  2269. * cairo_raster_source_acquire_func_t:
  2270. * @pattern: the pattern being rendered from
  2271. * @callback_data: the user data supplied during creation
  2272. * @target: the rendering target surface
  2273. * @extents: rectangular region of interest in pixels in sample space
  2274. *
  2275. * #cairo_raster_source_acquire_func_t is the type of function which is
  2276. * called when a pattern is being rendered from. It should create a surface
  2277. * that provides the pixel data for the region of interest as defined by
  2278. * extents, though the surface itself does not have to be limited to that
  2279. * area. For convenience the surface should probably be of image type,
  2280. * created with cairo_surface_create_similar_image() for the target (which
  2281. * enables the number of copies to be reduced during transfer to the
  2282. * device). Another option, might be to return a similar surface to the
  2283. * target for explicit handling by the application of a set of cached sources
  2284. * on the device. The region of sample data provided should be defined using
  2285. * cairo_surface_set_device_offset() to specify the top-left corner of the
  2286. * sample data (along with width and height of the surface).
  2287. *
  2288. * Returns: a #cairo_surface_t
  2289. *
  2290. * Since: 1.12
  2291. **/
  2292. typedef cairo_surface_t *
  2293. (*cairo_raster_source_acquire_func_t) (cairo_pattern_t *pattern,
  2294. void *callback_data,
  2295. cairo_surface_t *target,
  2296. const cairo_rectangle_int_t *extents);
  2297. /**
  2298. * cairo_raster_source_release_func_t:
  2299. * @pattern: the pattern being rendered from
  2300. * @callback_data: the user data supplied during creation
  2301. * @surface: the surface created during acquire
  2302. *
  2303. * #cairo_raster_source_release_func_t is the type of function which is
  2304. * called when the pixel data is no longer being access by the pattern
  2305. * for the rendering operation. Typically this function will simply
  2306. * destroy the surface created during acquire.
  2307. *
  2308. * Since: 1.12
  2309. **/
  2310. typedef void
  2311. (*cairo_raster_source_release_func_t) (cairo_pattern_t *pattern,
  2312. void *callback_data,
  2313. cairo_surface_t *surface);
  2314. /**
  2315. * cairo_raster_source_snapshot_func_t:
  2316. * @pattern: the pattern being rendered from
  2317. * @callback_data: the user data supplied during creation
  2318. *
  2319. * #cairo_raster_source_snapshot_func_t is the type of function which is
  2320. * called when the pixel data needs to be preserved for later use
  2321. * during printing. This pattern will be accessed again later, and it
  2322. * is expected to provide the pixel data that was current at the time
  2323. * of snapshotting.
  2324. *
  2325. * Return value: CAIRO_STATUS_SUCCESS on success, or one of the
  2326. * #cairo_status_t error codes for failure.
  2327. *
  2328. * Since: 1.12
  2329. **/
  2330. typedef cairo_status_t
  2331. (*cairo_raster_source_snapshot_func_t) (cairo_pattern_t *pattern,
  2332. void *callback_data);
  2333. /**
  2334. * cairo_raster_source_copy_func_t:
  2335. * @pattern: the #cairo_pattern_t that was copied to
  2336. * @callback_data: the user data supplied during creation
  2337. * @other: the #cairo_pattern_t being used as the source for the copy
  2338. *
  2339. * #cairo_raster_source_copy_func_t is the type of function which is
  2340. * called when the pattern gets copied as a normal part of rendering.
  2341. *
  2342. * Return value: CAIRO_STATUS_SUCCESS on success, or one of the
  2343. * #cairo_status_t error codes for failure.
  2344. *
  2345. * Since: 1.12
  2346. **/
  2347. typedef cairo_status_t
  2348. (*cairo_raster_source_copy_func_t) (cairo_pattern_t *pattern,
  2349. void *callback_data,
  2350. const cairo_pattern_t *other);
  2351. /**
  2352. * cairo_raster_source_finish_func_t:
  2353. * @pattern: the pattern being rendered from
  2354. * @callback_data: the user data supplied during creation
  2355. *
  2356. * #cairo_raster_source_finish_func_t is the type of function which is
  2357. * called when the pattern (or a copy thereof) is no longer required.
  2358. *
  2359. * Since: 1.12
  2360. **/
  2361. typedef void
  2362. (*cairo_raster_source_finish_func_t) (cairo_pattern_t *pattern,
  2363. void *callback_data);
  2364. cairo_public cairo_pattern_t *
  2365. cairo_pattern_create_raster_source (void *user_data,
  2366. cairo_content_t content,
  2367. int width, int height);
  2368. cairo_public void
  2369. cairo_raster_source_pattern_set_callback_data (cairo_pattern_t *pattern,
  2370. void *data);
  2371. cairo_public void *
  2372. cairo_raster_source_pattern_get_callback_data (cairo_pattern_t *pattern);
  2373. cairo_public void
  2374. cairo_raster_source_pattern_set_acquire (cairo_pattern_t *pattern,
  2375. cairo_raster_source_acquire_func_t acquire,
  2376. cairo_raster_source_release_func_t release);
  2377. cairo_public void
  2378. cairo_raster_source_pattern_get_acquire (cairo_pattern_t *pattern,
  2379. cairo_raster_source_acquire_func_t *acquire,
  2380. cairo_raster_source_release_func_t *release);
  2381. cairo_public void
  2382. cairo_raster_source_pattern_set_snapshot (cairo_pattern_t *pattern,
  2383. cairo_raster_source_snapshot_func_t snapshot);
  2384. cairo_public cairo_raster_source_snapshot_func_t
  2385. cairo_raster_source_pattern_get_snapshot (cairo_pattern_t *pattern);
  2386. cairo_public void
  2387. cairo_raster_source_pattern_set_copy (cairo_pattern_t *pattern,
  2388. cairo_raster_source_copy_func_t copy);
  2389. cairo_public cairo_raster_source_copy_func_t
  2390. cairo_raster_source_pattern_get_copy (cairo_pattern_t *pattern);
  2391. cairo_public void
  2392. cairo_raster_source_pattern_set_finish (cairo_pattern_t *pattern,
  2393. cairo_raster_source_finish_func_t finish);
  2394. cairo_public cairo_raster_source_finish_func_t
  2395. cairo_raster_source_pattern_get_finish (cairo_pattern_t *pattern);
  2396. /* Pattern creation functions */
  2397. cairo_public cairo_pattern_t *
  2398. cairo_pattern_create_rgb (double red, double green, double blue);
  2399. cairo_public cairo_pattern_t *
  2400. cairo_pattern_create_rgba (double red, double green, double blue,
  2401. double alpha);
  2402. cairo_public cairo_pattern_t *
  2403. cairo_pattern_create_for_surface (cairo_surface_t *surface);
  2404. cairo_public cairo_pattern_t *
  2405. cairo_pattern_create_linear (double x0, double y0,
  2406. double x1, double y1);
  2407. cairo_public cairo_pattern_t *
  2408. cairo_pattern_create_radial (double cx0, double cy0, double radius0,
  2409. double cx1, double cy1, double radius1);
  2410. cairo_public cairo_pattern_t *
  2411. cairo_pattern_create_mesh (void);
  2412. cairo_public cairo_pattern_t *
  2413. cairo_pattern_reference (cairo_pattern_t *pattern);
  2414. cairo_public void
  2415. cairo_pattern_destroy (cairo_pattern_t *pattern);
  2416. cairo_public unsigned int
  2417. cairo_pattern_get_reference_count (cairo_pattern_t *pattern);
  2418. cairo_public cairo_status_t
  2419. cairo_pattern_status (cairo_pattern_t *pattern);
  2420. cairo_public void *
  2421. cairo_pattern_get_user_data (cairo_pattern_t *pattern,
  2422. const cairo_user_data_key_t *key);
  2423. cairo_public cairo_status_t
  2424. cairo_pattern_set_user_data (cairo_pattern_t *pattern,
  2425. const cairo_user_data_key_t *key,
  2426. void *user_data,
  2427. cairo_destroy_func_t destroy);
  2428. /**
  2429. * cairo_pattern_type_t:
  2430. * @CAIRO_PATTERN_TYPE_SOLID: The pattern is a solid (uniform)
  2431. * color. It may be opaque or translucent, since 1.2.
  2432. * @CAIRO_PATTERN_TYPE_SURFACE: The pattern is a based on a surface (an image), since 1.2.
  2433. * @CAIRO_PATTERN_TYPE_LINEAR: The pattern is a linear gradient, since 1.2.
  2434. * @CAIRO_PATTERN_TYPE_RADIAL: The pattern is a radial gradient, since 1.2.
  2435. * @CAIRO_PATTERN_TYPE_MESH: The pattern is a mesh, since 1.12.
  2436. * @CAIRO_PATTERN_TYPE_RASTER_SOURCE: The pattern is a user pattern providing raster data, since 1.12.
  2437. *
  2438. * #cairo_pattern_type_t is used to describe the type of a given pattern.
  2439. *
  2440. * The type of a pattern is determined by the function used to create
  2441. * it. The cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
  2442. * functions create SOLID patterns. The remaining
  2443. * cairo_pattern_create<!-- --> functions map to pattern types in obvious
  2444. * ways.
  2445. *
  2446. * The pattern type can be queried with cairo_pattern_get_type()
  2447. *
  2448. * Most #cairo_pattern_t functions can be called with a pattern of any
  2449. * type, (though trying to change the extend or filter for a solid
  2450. * pattern will have no effect). A notable exception is
  2451. * cairo_pattern_add_color_stop_rgb() and
  2452. * cairo_pattern_add_color_stop_rgba() which must only be called with
  2453. * gradient patterns (either LINEAR or RADIAL). Otherwise the pattern
  2454. * will be shutdown and put into an error state.
  2455. *
  2456. * New entries may be added in future versions.
  2457. *
  2458. * Since: 1.2
  2459. **/
  2460. typedef enum _cairo_pattern_type {
  2461. CAIRO_PATTERN_TYPE_SOLID,
  2462. CAIRO_PATTERN_TYPE_SURFACE,
  2463. CAIRO_PATTERN_TYPE_LINEAR,
  2464. CAIRO_PATTERN_TYPE_RADIAL,
  2465. CAIRO_PATTERN_TYPE_MESH,
  2466. CAIRO_PATTERN_TYPE_RASTER_SOURCE
  2467. } cairo_pattern_type_t;
  2468. cairo_public cairo_pattern_type_t
  2469. cairo_pattern_get_type (cairo_pattern_t *pattern);
  2470. cairo_public void
  2471. cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,
  2472. double offset,
  2473. double red, double green, double blue);
  2474. cairo_public void
  2475. cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern,
  2476. double offset,
  2477. double red, double green, double blue,
  2478. double alpha);
  2479. cairo_public void
  2480. cairo_mesh_pattern_begin_patch (cairo_pattern_t *pattern);
  2481. cairo_public void
  2482. cairo_mesh_pattern_end_patch (cairo_pattern_t *pattern);
  2483. cairo_public void
  2484. cairo_mesh_pattern_curve_to (cairo_pattern_t *pattern,
  2485. double x1, double y1,
  2486. double x2, double y2,
  2487. double x3, double y3);
  2488. cairo_public void
  2489. cairo_mesh_pattern_line_to (cairo_pattern_t *pattern,
  2490. double x, double y);
  2491. cairo_public void
  2492. cairo_mesh_pattern_move_to (cairo_pattern_t *pattern,
  2493. double x, double y);
  2494. cairo_public void
  2495. cairo_mesh_pattern_set_control_point (cairo_pattern_t *pattern,
  2496. unsigned int point_num,
  2497. double x, double y);
  2498. cairo_public void
  2499. cairo_mesh_pattern_set_corner_color_rgb (cairo_pattern_t *pattern,
  2500. unsigned int corner_num,
  2501. double red, double green, double blue);
  2502. cairo_public void
  2503. cairo_mesh_pattern_set_corner_color_rgba (cairo_pattern_t *pattern,
  2504. unsigned int corner_num,
  2505. double red, double green, double blue,
  2506. double alpha);
  2507. cairo_public void
  2508. cairo_pattern_set_matrix (cairo_pattern_t *pattern,
  2509. const cairo_matrix_t *matrix);
  2510. cairo_public void
  2511. cairo_pattern_get_matrix (cairo_pattern_t *pattern,
  2512. cairo_matrix_t *matrix);
  2513. /**
  2514. * cairo_extend_t:
  2515. * @CAIRO_EXTEND_NONE: pixels outside of the source pattern
  2516. * are fully transparent (Since 1.0)
  2517. * @CAIRO_EXTEND_REPEAT: the pattern is tiled by repeating (Since 1.0)
  2518. * @CAIRO_EXTEND_REFLECT: the pattern is tiled by reflecting
  2519. * at the edges (Since 1.0; but only implemented for surface patterns since 1.6)
  2520. * @CAIRO_EXTEND_PAD: pixels outside of the pattern copy
  2521. * the closest pixel from the source (Since 1.2; but only
  2522. * implemented for surface patterns since 1.6)
  2523. *
  2524. * #cairo_extend_t is used to describe how pattern color/alpha will be
  2525. * determined for areas "outside" the pattern's natural area, (for
  2526. * example, outside the surface bounds or outside the gradient
  2527. * geometry).
  2528. *
  2529. * Mesh patterns are not affected by the extend mode.
  2530. *
  2531. * The default extend mode is %CAIRO_EXTEND_NONE for surface patterns
  2532. * and %CAIRO_EXTEND_PAD for gradient patterns.
  2533. *
  2534. * New entries may be added in future versions.
  2535. *
  2536. * Since: 1.0
  2537. **/
  2538. typedef enum _cairo_extend {
  2539. CAIRO_EXTEND_NONE,
  2540. CAIRO_EXTEND_REPEAT,
  2541. CAIRO_EXTEND_REFLECT,
  2542. CAIRO_EXTEND_PAD
  2543. } cairo_extend_t;
  2544. cairo_public void
  2545. cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
  2546. cairo_public cairo_extend_t
  2547. cairo_pattern_get_extend (cairo_pattern_t *pattern);
  2548. /**
  2549. * cairo_filter_t:
  2550. * @CAIRO_FILTER_FAST: A high-performance filter, with quality similar
  2551. * to %CAIRO_FILTER_NEAREST (Since 1.0)
  2552. * @CAIRO_FILTER_GOOD: A reasonable-performance filter, with quality
  2553. * similar to %CAIRO_FILTER_BILINEAR (Since 1.0)
  2554. * @CAIRO_FILTER_BEST: The highest-quality available, performance may
  2555. * not be suitable for interactive use. (Since 1.0)
  2556. * @CAIRO_FILTER_NEAREST: Nearest-neighbor filtering (Since 1.0)
  2557. * @CAIRO_FILTER_BILINEAR: Linear interpolation in two dimensions (Since 1.0)
  2558. * @CAIRO_FILTER_GAUSSIAN: This filter value is currently
  2559. * unimplemented, and should not be used in current code. (Since 1.0)
  2560. *
  2561. * #cairo_filter_t is used to indicate what filtering should be
  2562. * applied when reading pixel values from patterns. See
  2563. * cairo_pattern_set_filter() for indicating the desired filter to be
  2564. * used with a particular pattern.
  2565. *
  2566. * Since: 1.0
  2567. **/
  2568. typedef enum _cairo_filter {
  2569. CAIRO_FILTER_FAST,
  2570. CAIRO_FILTER_GOOD,
  2571. CAIRO_FILTER_BEST,
  2572. CAIRO_FILTER_NEAREST,
  2573. CAIRO_FILTER_BILINEAR,
  2574. CAIRO_FILTER_GAUSSIAN
  2575. } cairo_filter_t;
  2576. cairo_public void
  2577. cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);
  2578. cairo_public cairo_filter_t
  2579. cairo_pattern_get_filter (cairo_pattern_t *pattern);
  2580. cairo_public cairo_status_t
  2581. cairo_pattern_get_rgba (cairo_pattern_t *pattern,
  2582. double *red, double *green,
  2583. double *blue, double *alpha);
  2584. cairo_public cairo_status_t
  2585. cairo_pattern_get_surface (cairo_pattern_t *pattern,
  2586. cairo_surface_t **surface);
  2587. cairo_public cairo_status_t
  2588. cairo_pattern_get_color_stop_rgba (cairo_pattern_t *pattern,
  2589. int index, double *offset,
  2590. double *red, double *green,
  2591. double *blue, double *alpha);
  2592. cairo_public cairo_status_t
  2593. cairo_pattern_get_color_stop_count (cairo_pattern_t *pattern,
  2594. int *count);
  2595. cairo_public cairo_status_t
  2596. cairo_pattern_get_linear_points (cairo_pattern_t *pattern,
  2597. double *x0, double *y0,
  2598. double *x1, double *y1);
  2599. cairo_public cairo_status_t
  2600. cairo_pattern_get_radial_circles (cairo_pattern_t *pattern,
  2601. double *x0, double *y0, double *r0,
  2602. double *x1, double *y1, double *r1);
  2603. cairo_public cairo_status_t
  2604. cairo_mesh_pattern_get_patch_count (cairo_pattern_t *pattern,
  2605. unsigned int *count);
  2606. cairo_public cairo_path_t *
  2607. cairo_mesh_pattern_get_path (cairo_pattern_t *pattern,
  2608. unsigned int patch_num);
  2609. cairo_public cairo_status_t
  2610. cairo_mesh_pattern_get_corner_color_rgba (cairo_pattern_t *pattern,
  2611. unsigned int patch_num,
  2612. unsigned int corner_num,
  2613. double *red, double *green,
  2614. double *blue, double *alpha);
  2615. cairo_public cairo_status_t
  2616. cairo_mesh_pattern_get_control_point (cairo_pattern_t *pattern,
  2617. unsigned int patch_num,
  2618. unsigned int point_num,
  2619. double *x, double *y);
  2620. /* Matrix functions */
  2621. cairo_public void
  2622. cairo_matrix_init (cairo_matrix_t *matrix,
  2623. double xx, double yx,
  2624. double xy, double yy,
  2625. double x0, double y0);
  2626. cairo_public void
  2627. cairo_matrix_init_identity (cairo_matrix_t *matrix);
  2628. cairo_public void
  2629. cairo_matrix_init_translate (cairo_matrix_t *matrix,
  2630. double tx, double ty);
  2631. cairo_public void
  2632. cairo_matrix_init_scale (cairo_matrix_t *matrix,
  2633. double sx, double sy);
  2634. cairo_public void
  2635. cairo_matrix_init_rotate (cairo_matrix_t *matrix,
  2636. double radians);
  2637. cairo_public void
  2638. cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty);
  2639. cairo_public void
  2640. cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy);
  2641. cairo_public void
  2642. cairo_matrix_rotate (cairo_matrix_t *matrix, double radians);
  2643. cairo_public cairo_status_t
  2644. cairo_matrix_invert (cairo_matrix_t *matrix);
  2645. cairo_public void
  2646. cairo_matrix_multiply (cairo_matrix_t *result,
  2647. const cairo_matrix_t *a,
  2648. const cairo_matrix_t *b);
  2649. cairo_public void
  2650. cairo_matrix_transform_distance (const cairo_matrix_t *matrix,
  2651. double *dx, double *dy);
  2652. cairo_public void
  2653. cairo_matrix_transform_point (const cairo_matrix_t *matrix,
  2654. double *x, double *y);
  2655. /* Region functions */
  2656. /**
  2657. * cairo_region_t:
  2658. *
  2659. * A #cairo_region_t represents a set of integer-aligned rectangles.
  2660. *
  2661. * It allows set-theoretical operations like cairo_region_union() and
  2662. * cairo_region_intersect() to be performed on them.
  2663. *
  2664. * Memory management of #cairo_region_t is done with
  2665. * cairo_region_reference() and cairo_region_destroy().
  2666. *
  2667. * Since: 1.10
  2668. **/
  2669. typedef struct _cairo_region cairo_region_t;
  2670. /**
  2671. * cairo_region_overlap_t:
  2672. * @CAIRO_REGION_OVERLAP_IN: The contents are entirely inside the region. (Since 1.10)
  2673. * @CAIRO_REGION_OVERLAP_OUT: The contents are entirely outside the region. (Since 1.10)
  2674. * @CAIRO_REGION_OVERLAP_PART: The contents are partially inside and
  2675. * partially outside the region. (Since 1.10)
  2676. *
  2677. * Used as the return value for cairo_region_contains_rectangle().
  2678. *
  2679. * Since: 1.10
  2680. **/
  2681. typedef enum _cairo_region_overlap {
  2682. CAIRO_REGION_OVERLAP_IN, /* completely inside region */
  2683. CAIRO_REGION_OVERLAP_OUT, /* completely outside region */
  2684. CAIRO_REGION_OVERLAP_PART /* partly inside region */
  2685. } cairo_region_overlap_t;
  2686. cairo_public cairo_region_t *
  2687. cairo_region_create (void);
  2688. cairo_public cairo_region_t *
  2689. cairo_region_create_rectangle (const cairo_rectangle_int_t *rectangle);
  2690. cairo_public cairo_region_t *
  2691. cairo_region_create_rectangles (const cairo_rectangle_int_t *rects,
  2692. int count);
  2693. cairo_public cairo_region_t *
  2694. cairo_region_copy (const cairo_region_t *original);
  2695. cairo_public cairo_region_t *
  2696. cairo_region_reference (cairo_region_t *region);
  2697. cairo_public void
  2698. cairo_region_destroy (cairo_region_t *region);
  2699. cairo_public cairo_bool_t
  2700. cairo_region_equal (const cairo_region_t *a, const cairo_region_t *b);
  2701. cairo_public cairo_status_t
  2702. cairo_region_status (const cairo_region_t *region);
  2703. cairo_public void
  2704. cairo_region_get_extents (const cairo_region_t *region,
  2705. cairo_rectangle_int_t *extents);
  2706. cairo_public int
  2707. cairo_region_num_rectangles (const cairo_region_t *region);
  2708. cairo_public void
  2709. cairo_region_get_rectangle (const cairo_region_t *region,
  2710. int nth,
  2711. cairo_rectangle_int_t *rectangle);
  2712. cairo_public cairo_bool_t
  2713. cairo_region_is_empty (const cairo_region_t *region);
  2714. cairo_public cairo_region_overlap_t
  2715. cairo_region_contains_rectangle (const cairo_region_t *region,
  2716. const cairo_rectangle_int_t *rectangle);
  2717. cairo_public cairo_bool_t
  2718. cairo_region_contains_point (const cairo_region_t *region, int x, int y);
  2719. cairo_public void
  2720. cairo_region_translate (cairo_region_t *region, int dx, int dy);
  2721. cairo_public cairo_status_t
  2722. cairo_region_subtract (cairo_region_t *dst, const cairo_region_t *other);
  2723. cairo_public cairo_status_t
  2724. cairo_region_subtract_rectangle (cairo_region_t *dst,
  2725. const cairo_rectangle_int_t *rectangle);
  2726. cairo_public cairo_status_t
  2727. cairo_region_intersect (cairo_region_t *dst, const cairo_region_t *other);
  2728. cairo_public cairo_status_t
  2729. cairo_region_intersect_rectangle (cairo_region_t *dst,
  2730. const cairo_rectangle_int_t *rectangle);
  2731. cairo_public cairo_status_t
  2732. cairo_region_union (cairo_region_t *dst, const cairo_region_t *other);
  2733. cairo_public cairo_status_t
  2734. cairo_region_union_rectangle (cairo_region_t *dst,
  2735. const cairo_rectangle_int_t *rectangle);
  2736. cairo_public cairo_status_t
  2737. cairo_region_xor (cairo_region_t *dst, const cairo_region_t *other);
  2738. cairo_public cairo_status_t
  2739. cairo_region_xor_rectangle (cairo_region_t *dst,
  2740. const cairo_rectangle_int_t *rectangle);
  2741. /* Functions to be used while debugging (not intended for use in production code) */
  2742. cairo_public void
  2743. cairo_debug_reset_static_data (void);
  2744. CAIRO_END_DECLS
  2745. #endif /* CAIRO_H */