?? cairo-image-surfaces.html
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Image Surfaces</title><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="Surfaces.html" title="Surfaces"><link rel="prev" href="cairo-cairo-surface-t.html" title="cairo_surface_t"><link rel="next" href="cairo-PDF-Surfaces.html" title="PDF Surfaces"><meta name="generator" content="GTK-Doc V1.6 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="Part I. Tutorial"><link rel="part" href="pt02.html" title="Part II. Reference"><link rel="chapter" href="Drawing.html" title="Drawing"><link rel="chapter" href="Fonts.html" title="Fonts"><link rel="chapter" href="Surfaces.html" title="Surfaces"><link rel="chapter" href="Support.html" title="Utilities"><link rel="index" href="ix01.html" title="Index"><link rel="appendix" href="language-bindings.html" title="Appendix A. Creating a language binding for cairo"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-cairo-surface-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="Surfaces.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-PDF-Surfaces.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#top_of_page" class="shortcut">Top</a>  |  <a href="#desc" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="cairo-Image-Surfaces"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle"><a name="top_of_page"></a>Image Surfaces</span></h2><p>Image Surfaces — Rendering to memory buffers</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><a name="synopsis"></a><h2>Synopsis</h2><pre class="synopsis">enum <a href="cairo-Image-Surfaces.html#cairo-format-t">cairo_format_t</a>;<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-Image-Surfaces.html#cairo-image-surface-create">cairo_image_surface_create</a> (<a href="cairo-Image-Surfaces.html#cairo-format-t">cairo_format_t</a> format, int width, int height);<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-Image-Surfaces.html#cairo-image-surface-create-for-data">cairo_image_surface_create_for_data</a> (unsigned char *data, <a href="cairo-Image-Surfaces.html#cairo-format-t">cairo_format_t</a> format, int width, int height, int stride);unsigned char* <a href="cairo-Image-Surfaces.html#cairo-image-surface-get-data">cairo_image_surface_get_data</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);<a href="cairo-Image-Surfaces.html#cairo-format-t">cairo_format_t</a> <a href="cairo-Image-Surfaces.html#cairo-image-surface-get-format">cairo_image_surface_get_format</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);int <a href="cairo-Image-Surfaces.html#cairo-image-surface-get-width">cairo_image_surface_get_width</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);int <a href="cairo-Image-Surfaces.html#cairo-image-surface-get-height">cairo_image_surface_get_height</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);int <a href="cairo-Image-Surfaces.html#cairo-image-surface-get-stride">cairo_image_surface_get_stride</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre></div><div class="refsect1" lang="en"><a name="desc"></a><h2>Description</h2><p> Image surfaces provide the ability to render to memory buffers either allocated by cairo or by the calling code. The supported image formats are those defined in <a href="cairo-Image-Surfaces.html#cairo-format-t"><span class="type">cairo_format_t</span></a>. </p></div><div class="refsect1" lang="en"><a name="details"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2570315"></a><h3><a name="cairo-format-t"></a>enum cairo_format_t</h3><a class="indexterm" name="id2570327"></a><pre class="programlisting">typedef enum _cairo_format { CAIRO_FORMAT_ARGB32, CAIRO_FORMAT_RGB24, CAIRO_FORMAT_A8, CAIRO_FORMAT_A1, CAIRO_FORMAT_RGB16_565} cairo_format_t;</pre><p><a href="cairo-Image-Surfaces.html#cairo-format-t"><span class="type">cairo_format_t</span></a> is used to identify the memory format ofimage data.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><a name="CAIRO-FORMAT-ARGB32:CAPS"></a><code class="literal">CAIRO_FORMAT_ARGB32</code></span></td><td> each pixel is a 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue. The 32-bit quantities are stored native-endian. Pre-multiplied alpha is used. (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)</td></tr><tr><td><span class="term"><a name="CAIRO-FORMAT-RGB24:CAPS"></a><code class="literal">CAIRO_FORMAT_RGB24</code></span></td><td> each pixel is a 32-bit quantity, with the upper 8 bits unused. Red, Green, and Blue are stored in the remaining 24 bits in that order.</td></tr><tr><td><span class="term"><a name="CAIRO-FORMAT-A8:CAPS"></a><code class="literal">CAIRO_FORMAT_A8</code></span></td><td> each pixel is a 8-bit quantity holding an alpha value.</td></tr><tr><td><span class="term"><a name="CAIRO-FORMAT-A1:CAPS"></a><code class="literal">CAIRO_FORMAT_A1</code></span></td><td> each pixel is a 1-bit quantity holding an alpha value. Pixels are packed together into 32-bit quantities. The ordering of the bits matches the endianess of the platform. On a big-endian machine, the first pixel is in the uppermost bit, on a little-endian machine the first pixel is in the least-significant bit.</td></tr><tr><td><span class="term"><a name="CAIRO-FORMAT-RGB16-565:CAPS"></a><code class="literal">CAIRO_FORMAT_RGB16_565</code></span></td><td> each pixel is a 16-bit quantity, with red in the upper 5 bits, then green in the next 6, then blue in the lowest 5 bits. (Since 1.2)</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2583709"></a><h3><a name="cairo-image-surface-create"></a>cairo_image_surface_create ()</h3><a class="indexterm" name="id2583720"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create (<a href="cairo-Image-Surfaces.html#cairo-format-t">cairo_format_t</a> format, int width, int height);</pre></div><hr><div class="refsect2" lang="en"><a name="id2583759"></a><h3><a name="cairo-image-surface-create-for-data"></a>cairo_image_surface_create_for_data ()</h3><a class="indexterm" name="id2583772"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_for_data (unsigned char *data, <a href="cairo-Image-Surfaces.html#cairo-format-t">cairo_format_t</a> format, int width, int height, int stride);</pre></div><hr><div class="refsect2" lang="en"><a name="id2583825"></a><h3><a name="cairo-image-surface-get-data"></a>cairo_image_surface_get_data ()</h3><a class="indexterm" name="id2583840"></a><pre class="programlisting">unsigned char* cairo_image_surface_get_data (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre><p>Since 1.2</p></div><hr><div class="refsect2" lang="en"><a name="id2583871"></a><h3><a name="cairo-image-surface-get-format"></a>cairo_image_surface_get_format ()</h3><a class="indexterm" name="id2583886"></a><pre class="programlisting"><a href="cairo-Image-Surfaces.html#cairo-format-t">cairo_format_t</a> cairo_image_surface_get_format (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre><p>Since 1.2</p></div><hr><div class="refsect2" lang="en"><a name="id2570721"></a><h3><a name="cairo-image-surface-get-width"></a>cairo_image_surface_get_width ()</h3><a class="indexterm" name="id2570734"></a><pre class="programlisting">int cairo_image_surface_get_width (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre></div><hr><div class="refsect2" lang="en"><a name="id2570759"></a><h3><a name="cairo-image-surface-get-height"></a>cairo_image_surface_get_height ()</h3><a class="indexterm" name="id2570772"></a><pre class="programlisting">int cairo_image_surface_get_height (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre></div><hr><div class="refsect2" lang="en"><a name="id2570796"></a><h3><a name="cairo-image-surface-get-stride"></a>cairo_image_surface_get_stride ()</h3><a class="indexterm" name="id2570812"></a><pre class="programlisting">int cairo_image_surface_get_stride (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre><p>Since 1.2</p></div></div></div></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -