-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcairo.html
More file actions
170 lines (163 loc) · 6.45 KB
/
cairo.html
File metadata and controls
170 lines (163 loc) · 6.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title> cairo - cairo graphics engine </title>
<script src="jquery.js"></script>
<script src="jquery-cookie.js"></script>
<script src="jquery-tablesorter.js"></script>
<script src="strftime.js"></script>
<script src="mustache.js"></script>
<script src="config.js"></script>
<script src="main.js"></script>
<link rel="stylesheet" type="text/css" href="templates/reset.css" />
<link rel="stylesheet" type="text/css" href="templates/hack.css" />
<link rel="stylesheet" type="text/css" id="lights_css" />
<script>
var DOCNAME = 'cairo'
var PROJECT = 'cairo'
//set the lights before rendering starts
set_lights()
</script>
</head>
<body>
<header>
<div class="container">
<div class="btn-container btn-lights-container">
<a href="#" class="btn btn-lights" id="lights">lights</a>
</div>
<div class="btn-container btn-home-container">
<a href="/" class="btn btn-home">luapower</a>
</div>
<table id="header_table">
<tr>
<td style="vertical-align: middle;" width="100%">
<h1> cairo </h1>
<h2> cairo graphics engine </h2>
</td>
<td style="vertical-align: middle;" align="right" style="height: 150px">
<table><tr><td>
<div class="doc" id="package_info_container">
<div id="package_info"> </div>
<div id="commit_log"> </div>
</div>
<a href="https://github.com/luapower/cairo" class="btn btn-rightside btn-github"><span class="icon"></span>View on GitHub</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/cairo/tarball/master" class="btn btn-rightside">Download as .tar.gz</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/cairo/zipball/master" class="btn btn-rightside">Download as .zip</a>
</td></tr></table>
</td>
</tr>
</table>
<div class="btn-container btn-discuss-container">
<a href="https://github.com/luapower/cairo/issues/new" target="_blank"
class="btn btn-rightside btn-discuss"><span class="icon"></span>Discuss</a>
</div>
</div>
</header>
<div class="bg-container">
<div class="bg-center-container">
<div class="bg bg-cairo" style="background-image: url('bg/cairo.png');"></div>
</div>
</div>
<div class="under-header">
<div class="container">
<div id="toc_container" class="toc_container doc"></div>
<button id=tab1_button class="tab_button hidden">Documentation</button>
<button id=tab2_button class="tab_button hidden">Package Info</button>
<div id="tabs_cointainer">
<div id="tab1_container">
<section class="doc">
<span id="module_info"></span>
<h2 id="local-cairo-requirecairo"><code>local cairo = require'cairo'</code></h2>
<p>A lightweight ffi binding of the <a href="http://cairographics.org/">cairo graphics</a> library with the following features:</p>
<ul>
<li>cairo types have associated methods, so you can use <code>context:paint()</code> instead of <code>cairo.cairo_paint(context)</code></li>
<li>pointers to objects for which cairo holds no references are bound to Lua's garbage collector to prevent leaks</li>
<li>ref-counted objects have a free() method that checks ref. count and a destroy() method that doesn't.</li>
<li>functions that work with <code>char*</code> are made to accept/return Lua strings.</li>
<li>output buffers are optional - if not passed on as arguments, temporary buffers are allocated instead; the values in the buffers are then returned as multiple return values, such as in <code>context:clip_extents([dx1][,dy1][,dx2[,dy2]) -> x1, y1, x2, y2</code>, where dx1 etc. are <code>double[1]</code> buffers.</li>
<li>the included binary is built with support for in-memory surfaces, recording surfaces, ps surfaces, pdf surfaces, svg surfaces, win32 surfaces, win32 fonts and freetype fonts.</li>
</ul>
<p>See the <a href="http://cairographics.org/manual/">cairo manual</a> for the function list, remembering that method call style is available for them.</p>
<p>Additional wrappers are provided for completeness:</p>
<table>
<tbody>
<tr class="odd">
<td align="left"><code>cr:quad_curve_to(x1, y1, x2, y2)</code></td>
<td align="left">add a quad bezier to the current path</td>
</tr>
<tr class="even">
<td align="left"><code>cr:rel_quad_curve_to(x1, y1, x2, y2)</code></td>
<td align="left">add a relative quad bezier to the current path</td>
</tr>
<tr class="odd">
<td align="left"><code>cr:circle(cx, cy, r)</code></td>
<td align="left">add a circle to the current path</td>
</tr>
<tr class="even">
<td align="left"><code>cr:ellipse(cx, cy, rx, ry)</code></td>
<td align="left">add an ellipse to the current path</td>
</tr>
<tr class="odd">
<td align="left"><code>cr:skew(ax, ay)</code></td>
<td align="left">skew current matrix</td>
</tr>
<tr class="even">
<td align="left"><code>cr:rotate_around(cx, cy, angle)</code></td>
<td align="left">rotate current matrix around point</td>
</tr>
<tr class="odd">
<td align="left"><code>cr:safe_transform(mt)</code></td>
<td align="left">transform current matrix if possible</td>
</tr>
<tr class="even">
<td align="left"><code>mt:transform(with_mt) -> mt</code></td>
<td align="left">transform matrix with other matrix</td>
</tr>
<tr class="odd">
<td align="left"><code>mt:invertible() -> true|false</code></td>
<td align="left">is matrix invertible?</td>
</tr>
<tr class="even">
<td align="left"><code>mt:safe_transform(with_mt)</code></td>
<td align="left">transform matrix if possible</td>
</tr>
<tr class="odd">
<td align="left"><code>mt:skew(ax, ay)</code></td>
<td align="left">skew matrix</td>
</tr>
<tr class="even">
<td align="left"><code>mt:rotate_around(cx, cy, angle)</code></td>
<td align="left">rotate matrix around point</td>
</tr>
<tr class="odd">
<td align="left"><code>surface:apply_alpha(alpha)</code></td>
<td align="left">make surface transparent</td>
</tr>
</tbody>
</table>
<p>See also: <a href="sg_cairo.html">sg_cairo</a>, <a href="cplayer.html">cplayer</a></p>
</section>
</div>
<div id="tab2_container" class="doc"></div>
</div>
</div>
<div class="container">
<footer>
<div id="disqus_thread"></div>
<div class="faint">cosmin.apreutesei@gmail.com | <a href="http://unlicense.org/">public domain</a></div>
</footer>
</div>
</div>
<script type="text/x-mustache" id=info_tab_template>
<h3>Modules</h3>
<ul>
{{#module_array}}
<li>{{name}}</li>
{{/module_array}}
</ul>
</script>
</body>
</html>