cairo.h 116 KB

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