Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/gtk-doc/html/cairo/bindings-surfaces.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>Surfaces: 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="language-bindings.html" title="Appendix A. Creating a language binding for cairo"> | |
9 <link rel="prev" href="bindings-patterns.html" title="Patterns"> | |
10 <link rel="next" href="bindings-fonts.html" title="Fonts"> | |
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><a accesskey="u" href="language-bindings.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> | |
19 <td><a accesskey="p" href="bindings-patterns.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> | |
20 <td><a accesskey="n" href="bindings-fonts.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> | |
21 </tr></table> | |
22 <div class="sect1"> | |
23 <div class="titlepage"><div><div><h2 class="title" style="clear: both"> | |
24 <a name="bindings-surfaces"></a>Surfaces</h2></div></div></div> | |
25 <p> | |
26 Like patterns, surfaces, which use only the | |
27 <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> | |
28 type in the C API should be broken up into a hierarchy of types | |
29 in a language binding. | |
30 </p> | |
31 <pre class="programlisting"> | |
32 cairo_surface_t | |
33 cairo_image_surface_t | |
34 cairo_atsui_surface_t | |
35 cairo_win32_surface_t | |
36 cairo_xlib_surface_t | |
37 cairo_beos_surface_t | |
38 </pre> | |
39 <p> | |
40 Unlike patterns, the constructors and methods on these types are | |
41 clearly named, and can be trivially associated with the | |
42 appropriate subtype. Many language bindings will want to avoid | |
43 binding the platform-specific subtypes at all, since the | |
44 methods on these types are not useful without passing in native | |
45 C types. Unless there is a language binding for Xlib available, | |
46 there is no way to represent a XLib <span class="type">Display</span> * in | |
47 that language. | |
48 </p> | |
49 <p> | |
50 This doesn't mean that platform-specific surface types can't | |
51 be used in a language binding that doesn't bind the constructor. | |
52 A very common situation is to use a cairo language binding in | |
53 combination with a binding for a higher level system like | |
54 the <a class="ulink" href="http://www.gtk.org/" target="_top">GTK+</a> widget | |
55 toolkit. In such a situation, the higher level toolkit provides | |
56 ways to get references to platform specific surfaces. | |
57 </p> | |
58 <p> | |
59 The <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-set-user-data" title="cairo_surface_set_user_data ()"><code class="function">cairo_surface_set_user_data()</code></a>, | |
60 and <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-get-user-data" title="cairo_surface_get_user_data ()"><code class="function">cairo_surface_get_user_data()</code></a> | |
61 methods are provided for use in language bindings, and should | |
62 not be directly exposed to applications. One example of the use | |
63 of these functions in a language binding is creating a binding for: | |
64 </p> | |
65 <pre class="programlisting"> | |
66 cairo_surface_t * | |
67 <a class="link" href="cairo-Image-Surfaces.html#cairo-image-surface-create-for-data" title="cairo_image_surface_create_for_data ()"><code class="function">cairo_image_surface_create_for_data</code></a> (unsigned char *data, | |
68 cairo_format_t format, | |
69 int width, | |
70 int height, | |
71 int stride); | |
72 </pre> | |
73 <p> | |
74 The memory block passed in for <em class="parameter"><code>data</code></em> must be | |
75 kept around until the surface is destroyed, so the language | |
76 binding must have some way of determining when that happens. The | |
77 way to do this is to use the <em class="parameter"><code>destroy</code></em> | |
78 argument to <code class="function">cairo_surface_set_user_data()</code>. | |
79 </p> | |
80 <p class="remark"><em><span class="remark"> | |
81 Some languages may not have a suitable “pointer to a block of | |
82 data” type to pass in for <em class="parameter"><code>data</code></em>. And even | |
83 where a language does have such a type, the user will be | |
84 frequently able to cause the backing store to be reallocated | |
85 to a different location or truncated. Should we recommend a | |
86 standard type name and binding for a buffer object here? | |
87 </span></em></p> | |
88 </div> | |
89 <div class="footer"> | |
90 <hr>Generated by GTK-Doc V1.27</div> | |
91 </body> | |
92 </html> |