Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/gtk-doc/html/cairo/language-bindings.html @ 68:5028fdace37b
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 16:23:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 68:5028fdace37b |
---|---|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
2 <html> | |
3 <head> | |
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
5 <title>Appendix A. Creating a language binding for cairo: Cairo: A Vector Graphics Library</title> | |
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> | |
7 <link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"> | |
8 <link rel="up" href="index.html" title="Cairo: A Vector Graphics Library"> | |
9 <link rel="prev" href="index-1.16.html" title="Index of new symbols in 1.16"> | |
10 <link rel="next" href="bindings-memory.html" title="Memory management"> | |
11 <meta name="generator" content="GTK-Doc V1.27 (XML mode)"> | |
12 <link rel="stylesheet" href="style.css" type="text/css"> | |
13 </head> | |
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> | |
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> | |
16 <td width="100%" align="left" class="shortcuts"></td> | |
17 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> | |
18 <td><img src="up-insensitive.png" width="16" height="16" border="0"></td> | |
19 <td><a accesskey="p" href="index-1.16.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> | |
20 <td><a accesskey="n" href="bindings-memory.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> | |
21 </tr></table> | |
22 <div class="appendix"> | |
23 <div class="titlepage"><div><div><h1 class="title"> | |
24 <a name="language-bindings"></a>Appendix A. Creating a language binding for cairo</h1></div></div></div> | |
25 <p> | |
26 While cairo is implemented and C, and has a C API, it is expected | |
27 that many users of cairo will be using it from languages other | |
28 than C. The glue that connects the core cairo library to another | |
29 language is known as a <em class="firstterm">language | |
30 binding</em>. This appendix attempts to collect together | |
31 issues that come up when creating a language bindings for cairo | |
32 and present standardized solutions to promote consistency among | |
33 the different language bindings. | |
34 </p> | |
35 <div class="sect1"> | |
36 <div class="titlepage"><div><div><h2 class="title" style="clear: both"> | |
37 <a name="bindings-general"></a>General considerations</h2></div></div></div> | |
38 <p> | |
39 The naming of the central <a class="link" href="cairo-cairo-t.html#cairo-t" title="cairo_t"><span class="type">cairo_t</span></a> type is a | |
40 special exception. The object is “a cairo context” not “a | |
41 cairo”, and names such as <span class="type">cairo_t</span> rather than | |
42 <span class="type">cairo_context_t</span> and | |
43 <code class="function">cairo_set_source()</code> rather than | |
44 <code class="function">cairo_context_set_source()</code> are simply | |
45 abbreviations to make the C API more palatable. In languages | |
46 which have object-oriented syntax, this abbreviation is much | |
47 less useful. In fact, if ‘Cairo’ is used as a namespace, then | |
48 in many languages, you'd end up with a ridiculous type name | |
49 like ‘Cairo.Cairo’. For this reason, and for inter-language | |
50 consistency all object-oriented languages should name this | |
51 type as if it were <span class="type">cairo_context_t</span>. | |
52 </p> | |
53 <p> | |
54 The punctuation and casing of the type names and | |
55 method names of cairo should be changed to match the general | |
56 convention of the language. In Java, where type names are written | |
57 in StudlyCaps and method names in javaCaps, cairo_font_extents_t | |
58 will become FontExtents and | |
59 <code class="literal">cairo_set_source(cr,source)</code>, | |
60 <code class="literal">cr.setSource(source)</code>. | |
61 As compared to changing the punctuation, and casing, much | |
62 more reluctance should be used in changing the method names | |
63 themselves. Even if get is usually omitted from getters in | |
64 your language, you shouldn't bind cairo_get_source() as | |
65 cr.source(). | |
66 </p> | |
67 </div> | |
68 </div> | |
69 <div class="footer"> | |
70 <hr>Generated by GTK-Doc V1.27</div> | |
71 </body> | |
72 </html> |