File: classCairo_1_1ImageSurface.html

package info (click to toggle)
cairomm 1.8.4-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,952 kB
  • ctags: 1,655
  • sloc: sh: 10,132; cpp: 5,157; perl: 204; makefile: 159
file content (521 lines) | stat: -rw-r--r-- 33,695 bytes parent folder | download
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
        <title>cairomm: Cairo::ImageSurface Class Reference</title>
        <link href="cairomm.css" rel="stylesheet" type="text/css">
    </head>
<body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceCairo.html">Cairo</a>::<a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a>
  </div>
</div>
<div class="contents">
<h1>Cairo::ImageSurface Class Reference</h1><!-- doxytag: class="Cairo::ImageSurface" --><!-- doxytag: inherits="Cairo::Surface" -->Image surfaces provide the ability to render to memory buffers either allocated by cairo or by the calling code.  
<a href="#_details">More...</a>
<p>
Inherits <a class="el" href="classCairo_1_1Surface.html">Cairo::Surface</a>.
<p>

<p>
<a href="classCairo_1_1ImageSurface-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#19a7d3c6f4320c4d812629b3c18925ac">ImageSurface</a> (cairo_surface_t*<a class="el" href="classCairo_1_1Surface.html#d176eb7343b5902df3c19f9f56e59fb4">cobject</a>, bool has_reference=false)</td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a C++ wrapper for the C instance.  <a href="#19a7d3c6f4320c4d812629b3c18925ac"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#489f33357db18c23bdf8ebd5d07d8264">~ImageSurface</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#f75b30cde988ad6959bb75862f5b6e2a">get_width</a> () const </td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the width of the <a class="el" href="classCairo_1_1ImageSurface.html" title="Image surfaces provide the ability to render to memory buffers either allocated by...">ImageSurface</a> in pixels.  <a href="#f75b30cde988ad6959bb75862f5b6e2a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#a0e17bed71b125fd4725386ee1f14d07">get_height</a> () const </td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the height of the <a class="el" href="classCairo_1_1ImageSurface.html" title="Image surfaces provide the ability to render to memory buffers either allocated by...">ImageSurface</a> in pixels.  <a href="#a0e17bed71b125fd4725386ee1f14d07"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned char*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#94ba52fe4a201579c8a5541717822bdb">get_data</a> ()</td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a pointer to the data of the image surface, for direct inspection or modification.  <a href="#94ba52fe4a201579c8a5541717822bdb"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const unsigned char*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#8858eb704ebe2118baf83f2a104b9140">get_data</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Format</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#edccf9d08b3e5852c0bbb195cf1379a8">get_format</a> () const </td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">gets the format of the surface  <a href="#edccf9d08b3e5852c0bbb195cf1379a8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#4b33c7f1c03197eb66dac3e909c5a39a">get_stride</a> () const </td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return value: the stride of the image surface in bytes (or 0 if  is not an image surface).  <a href="#4b33c7f1c03197eb66dac3e909c5a39a"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#c74f130a3bb36bd9fd70003cd8562ce5">format_stride_for_width</a> (<a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Cairo::Format</a> format, int width)</td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This function provides a stride value that will respect all alignment requirements of the accelerated image-rendering code within cairo.  <a href="#c74f130a3bb36bd9fd70003cd8562ce5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#82887e1a0480ab16aa891e135f2b28d6">create</a> (<a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Format</a> format, int width, int height)</td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an image surface of the specified format and dimensions.  <a href="#82887e1a0480ab16aa891e135f2b28d6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#feb1b8203f9fa23ff4bca7b70723f370">create</a> (unsigned char* data, <a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Format</a> format, int width, int height, int <a class="elRef" doxygen="libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01005.html#g4d464eb22d9ad823ecb9b7eab22c6300">stride</a>)</td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an image surface for the provided pixel data.  <a href="#feb1b8203f9fa23ff4bca7b70723f370"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#ac35bcd255347574036746810f8a2978">create_from_png</a> (<a class="elRef" doxygen="libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00218.html">std::string</a> filename)</td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new image surface and initializes the contents to the given PNG file.  <a href="#ac35bcd255347574036746810f8a2978"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#7ac275170e7235457c9806aec7cf6f6a">create_from_png_stream</a> (const <a class="el" href="classCairo_1_1Surface.html#f66be8453e3fc558ea1282a911bf60e2">SlotReadFunc</a>&amp; read_func)</td></tr>

<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new image surface from PNG data read incrementally via the read_func function.  <a href="#7ac275170e7235457c9806aec7cf6f6a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1ImageSurface.html#43a9cf2aaaa8b2ef91da00bb244c7098">create_from_png</a> (cairo_read_func_t read_func, void* closure)</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Image surfaces provide the ability to render to memory buffers either allocated by cairo or by the calling code. 
<p>
The supported image formats are those defined in <a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Cairo::Format</a><p>
An <a class="el" href="classCairo_1_1ImageSurface.html" title="Image surfaces provide the ability to render to memory buffers either allocated by...">ImageSurface</a> is the most generic type of <a class="el" href="classCairo_1_1Surface.html" title="A cairo surface represents an image, either as the destination of a drawing operation...">Surface</a> and the only one that is available by default. You can either create an <a class="el" href="classCairo_1_1ImageSurface.html" title="Image surfaces provide the ability to render to memory buffers either allocated by...">ImageSurface</a> whose data is managed by <a class="el" href="namespaceCairo.html">Cairo</a>, or you can create an <a class="el" href="classCairo_1_1ImageSurface.html" title="Image surfaces provide the ability to render to memory buffers either allocated by...">ImageSurface</a> with a data buffer that you allocated yourself so that you can have full access to the data.<p>
When you create an <a class="el" href="classCairo_1_1ImageSurface.html" title="Image surfaces provide the ability to render to memory buffers either allocated by...">ImageSurface</a> with your own data buffer, you are free to examine the results at any point and do whatever you want with it. Note that if you modify anything and later want to continue to draw to the surface with cairo, you must let cairo know via <a class="el" href="classCairo_1_1Surface.html#77b1f860cc55f4ad168e100108e0b7bb" title="Tells cairo to consider the data buffer dirty.">Cairo::Surface::mark_dirty()</a><p>
Note that like all surfaces, an <a class="el" href="classCairo_1_1ImageSurface.html" title="Image surfaces provide the ability to render to memory buffers either allocated by...">ImageSurface</a> is a reference-counted object that should be used via <a class="el" href="classCairo_1_1RefPtr.html" title="RefPtr&lt;&gt; is a reference-counting shared smartpointer.">Cairo::RefPtr</a>. <hr><h2>Constructor&amp; Destructor Documentation</h2>
<a class="anchor" name="19a7d3c6f4320c4d812629b3c18925ac"></a><!-- doxytag: member="Cairo::ImageSurface::ImageSurface" ref="19a7d3c6f4320c4d812629b3c18925ac" args="(cairo_surface_t *cobject, bool has_reference=false)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Cairo::ImageSurface::ImageSurface           </td>
          <td>(</td>
          <td class="paramtype">cairo_surface_t *&#160;</td>
          <td class="paramname"> <em>cobject</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"> <em>has_reference</em> = <code>false</code></td><td>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [explicit]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Create a C++ wrapper for the C instance. 
<p>
This C++ instance should then be given to a <a class="el" href="classCairo_1_1RefPtr.html" title="RefPtr&lt;&gt; is a reference-counting shared smartpointer.">RefPtr</a>. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>cobject</em>&#160;</td><td>The C instance. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>has_reference</em>&#160;</td><td>Whether we already have a reference. Otherwise, the constructor will take an extra reference. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="489f33357db18c23bdf8ebd5d07d8264"></a><!-- doxytag: member="Cairo::ImageSurface::~ImageSurface" ref="489f33357db18c23bdf8ebd5d07d8264" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual Cairo::ImageSurface::~ImageSurface           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&#160;)&#160;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="feb1b8203f9fa23ff4bca7b70723f370"></a><!-- doxytag: member="Cairo::ImageSurface::create" ref="feb1b8203f9fa23ff4bca7b70723f370" args="(unsigned char *data, Format format, int width, int height, int stride)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt;<a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a>&gt; Cairo::ImageSurface::create           </td>
          <td>(</td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"> <em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Format</a>&#160;</td>
          <td class="paramname"> <em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"> <em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"> <em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"> <em>stride</em></td><td>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates an image surface for the provided pixel data. 
<p>
The output buffer must be kept around until the surface is destroyed or <a class="el" href="classCairo_1_1Surface.html#8d8afee4ddb4935b85698f27099646a0" title="This function finishes the surface and drops all references to external resources...">finish()</a> is called on the surface. The initial contents of buffer will be used as the initial image contents; you must explicitly clear the buffer, using, for example, <a class="el" href="classCairo_1_1Context.html#85ee124b89c43dc29ff0d964bd005c11" title="Adds a closed-subpath rectangle of the given size to the current path at position...">Context::rectangle()</a> and <a class="el" href="classCairo_1_1Context.html#0a484790884dd138108b07c0ebbbe21d" title="A drawing operator that fills the current path according to the current fill rule...">Context::fill()</a> if you want it cleared.<p>
Note that the stride may be larger than <em>width</em>* <em>bytes_per_pixel</em> to provide proper alignment for each pixel and row. This alignment is required to allow high-performance rendering within cairo. The correct way to obtain a legal stride value is to call <a class="el" href="classCairo_1_1ImageSurface.html#c74f130a3bb36bd9fd70003cd8562ce5" title="This function provides a stride value that will respect all alignment requirements...">format_stride_for_width()</a> with the desired format and maximum image width value, and the use the resulting stride value to allocate the data and to create the image surface. See <a class="el" href="classCairo_1_1ImageSurface.html#c74f130a3bb36bd9fd70003cd8562ce5" title="This function provides a stride value that will respect all alignment requirements...">format_stride_for_width()</a> for example code.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>data</em>&#160;</td><td>a pointer to a buffer supplied by the application in which to write contents. This pointer must be suitably aligned for any kind of variable, (for example, a pointer returned by malloc). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>format</em>&#160;</td><td>the format of pixels in the buffer </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>width</em>&#160;</td><td>the width of the image to be stored in the buffer </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>height</em>&#160;</td><td>the height of the image to be stored in the buffer </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stride</em>&#160;</td><td>the number of bytes between the start of rows in the buffer as allocated. This value should always be computed by cairo_format_stride_for_width() before allocating the data buffer. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>a <a class="el" href="classCairo_1_1RefPtr.html" title="RefPtr&lt;&gt; is a reference-counting shared smartpointer.">RefPtr</a> to the newly created surface. </dd></dl>

</div>
</div><p>
<a class="anchor" name="82887e1a0480ab16aa891e135f2b28d6"></a><!-- doxytag: member="Cairo::ImageSurface::create" ref="82887e1a0480ab16aa891e135f2b28d6" args="(Format format, int width, int height)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt;<a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a>&gt; Cairo::ImageSurface::create           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Format</a>&#160;</td>
          <td class="paramname"> <em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"> <em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"> <em>height</em></td><td>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates an image surface of the specified format and dimensions. 
<p>
Initially the surface contents are all 0. (Specifically, within each pixel, each color or alpha channel belonging to format will be 0. The contents of bits within a pixel, but not belonging to the given format are undefined).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>format</em>&#160;</td><td>format of pixels in the surface to create </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>width</em>&#160;</td><td>width of the surface, in pixels </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>height</em>&#160;</td><td>height of the surface, in pixels </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>a <a class="el" href="classCairo_1_1RefPtr.html" title="RefPtr&lt;&gt; is a reference-counting shared smartpointer.">RefPtr</a> to the newly created surface. </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="image-surface_8cc-example.html#a1">image-surface.cc</a>, <a class="el" href="toy-text_8cc-example.html#a1">toy-text.cc</a>, and <a class="el" href="user-font_8cc-example.html#a4">user-font.cc</a>.</dl>
</div>
</div><p>
<a class="anchor" name="43a9cf2aaaa8b2ef91da00bb244c7098"></a><!-- doxytag: member="Cairo::ImageSurface::create_from_png" ref="43a9cf2aaaa8b2ef91da00bb244c7098" args="(cairo_read_func_t read_func, void *closure)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt;<a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a>&gt; Cairo::ImageSurface::create_from_png           </td>
          <td>(</td>
          <td class="paramtype">cairo_read_func_t&#160;</td>
          <td class="paramname"> <em>read_func</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"> <em>closure</em></td><td>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<dl class="deprecated" compact><dt><b><a class="el" href="deprecated.html#_deprecated000006">Deprecated:</a></b></dt><dd>Use create_from_png_stream instead </dd></dl>

</div>
</div><p>
<a class="anchor" name="ac35bcd255347574036746810f8a2978"></a><!-- doxytag: member="Cairo::ImageSurface::create_from_png" ref="ac35bcd255347574036746810f8a2978" args="(std::string filename)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt;<a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a>&gt; Cairo::ImageSurface::create_from_png           </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00218.html">std::string</a>&#160;</td>
          <td class="paramname"> <em>filename</em>          </td>
          <td>&#160;)&#160;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a new image surface and initializes the contents to the given PNG file. 
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>For this function to be available, cairo must have been compiled with PNG support.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>filename</em>&#160;</td><td>name of PNG file to load </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>a <a class="el" href="classCairo_1_1RefPtr.html" title="RefPtr&lt;&gt; is a reference-counting shared smartpointer.">RefPtr</a> to the new cairo_surface_t initialized with the contents of the PNG image file. </dd></dl>

</div>
</div><p>
<a class="anchor" name="7ac275170e7235457c9806aec7cf6f6a"></a><!-- doxytag: member="Cairo::ImageSurface::create_from_png_stream" ref="7ac275170e7235457c9806aec7cf6f6a" args="(const SlotReadFunc &amp;read_func)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt;<a class="el" href="classCairo_1_1ImageSurface.html">ImageSurface</a>&gt; Cairo::ImageSurface::create_from_png_stream           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classCairo_1_1Surface.html#f66be8453e3fc558ea1282a911bf60e2">SlotReadFunc</a>&amp;&#160;</td>
          <td class="paramname"> <em>read_func</em>          </td>
          <td>&#160;)&#160;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a new image surface from PNG data read incrementally via the read_func function. 
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>For this function to be available, cairo must have been compiled with PNG support.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>read_func</em>&#160;</td><td>function called to read the data of the file </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>a <a class="el" href="classCairo_1_1RefPtr.html" title="RefPtr&lt;&gt; is a reference-counting shared smartpointer.">RefPtr</a> to the new cairo_surface_t initialized with the contents of the PNG image file. </dd></dl>

</div>
</div><p>
<a class="anchor" name="c74f130a3bb36bd9fd70003cd8562ce5"></a><!-- doxytag: member="Cairo::ImageSurface::format_stride_for_width" ref="c74f130a3bb36bd9fd70003cd8562ce5" args="(Cairo::Format format, int width)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static int Cairo::ImageSurface::format_stride_for_width           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Cairo::Format</a>&#160;</td>
          <td class="paramname"> <em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"> <em>width</em></td><td>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This function provides a stride value that will respect all alignment requirements of the accelerated image-rendering code within cairo. 
<p>
Typical usage will be of the form:<p>
<div class="fragment"><pre class="fragment"> <span class="keywordtype">int</span> <a class="codeRef" doxygen="libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01005.html#g4d464eb22d9ad823ecb9b7eab22c6300">stride</a>;
 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *data;
 <a class="code" href="classCairo_1_1RefPtr.html" title="RefPtr&amp;lt;&amp;gt; is a reference-counting shared smartpointer.">Cairo::RefPtr&lt;Cairo::ImageSurface&gt;</a> surface;

 stride = <a class="code" href="classCairo_1_1ImageSurface.html#c74f130a3bb36bd9fd70003cd8562ce5" title="This function provides a stride value that will respect all alignment requirements...">Cairo::ImageSurface::format_stride_for_width</a> (format, width);
 data = malloc (stride * height);
 surface = <a class="code" href="classCairo_1_1ImageSurface.html#82887e1a0480ab16aa891e135f2b28d6" title="Creates an image surface of the specified format and dimensions.">Cairo::ImageSurface::create</a> (data, format, width, height);
</pre></div><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>format</em>&#160;</td><td>A <a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Cairo::Format</a> value </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>width</em>&#160;</td><td>The desired width of an image surface to be created. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the appropriate stride to use given the desired format and width, or -1 if either the format is invalid or the width too large.</dd></dl>
<dl class="since" compact><dt><b>Since:</b></dt><dd>1.6 </dd></dl>

</div>
</div><p>
<a class="anchor" name="8858eb704ebe2118baf83f2a104b9140"></a><!-- doxytag: member="Cairo::ImageSurface::get_data" ref="8858eb704ebe2118baf83f2a104b9140" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const unsigned char* Cairo::ImageSurface::get_data           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&#160;)&#160;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

</div>
</div><p>
<a class="anchor" name="94ba52fe4a201579c8a5541717822bdb"></a><!-- doxytag: member="Cairo::ImageSurface::get_data" ref="94ba52fe4a201579c8a5541717822bdb" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned char* Cairo::ImageSurface::get_data           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&#160;)&#160;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Get a pointer to the data of the image surface, for direct inspection or modification. 
<p>
Return value: a pointer to the image data of this surface or NULL if  is not an image surface. 
</div>
</div><p>
<a class="anchor" name="edccf9d08b3e5852c0bbb195cf1379a8"></a><!-- doxytag: member="Cairo::ImageSurface::get_format" ref="edccf9d08b3e5852c0bbb195cf1379a8" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespaceCairo.html#d3f86970e1bd354b263303c9b8759166">Format</a> Cairo::ImageSurface::get_format           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&#160;)&#160;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
gets the format of the surface 
<p>

</div>
</div><p>
<a class="anchor" name="a0e17bed71b125fd4725386ee1f14d07"></a><!-- doxytag: member="Cairo::ImageSurface::get_height" ref="a0e17bed71b125fd4725386ee1f14d07" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Cairo::ImageSurface::get_height           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&#160;)&#160;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Gets the height of the <a class="el" href="classCairo_1_1ImageSurface.html" title="Image surfaces provide the ability to render to memory buffers either allocated by...">ImageSurface</a> in pixels. 
<p>

</div>
</div><p>
<a class="anchor" name="4b33c7f1c03197eb66dac3e909c5a39a"></a><!-- doxytag: member="Cairo::ImageSurface::get_stride" ref="4b33c7f1c03197eb66dac3e909c5a39a" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Cairo::ImageSurface::get_stride           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&#160;)&#160;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Return value: the stride of the image surface in bytes (or 0 if  is not an image surface). 
<p>
The stride is the distance in bytes from the beginning of one row of the image data to the beginning of the next row. 
</div>
</div><p>
<a class="anchor" name="f75b30cde988ad6959bb75862f5b6e2a"></a><!-- doxytag: member="Cairo::ImageSurface::get_width" ref="f75b30cde988ad6959bb75862f5b6e2a" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Cairo::ImageSurface::get_width           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&#160;)&#160;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Gets the width of the <a class="el" href="classCairo_1_1ImageSurface.html" title="Image surfaces provide the ability to render to memory buffers either allocated by...">ImageSurface</a> in pixels. 
<p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>cairomm/surface.h</ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Aug 13 11:40:14 2009 for cairomm by&#160;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>