📄 cairo-paths.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>Paths</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="Drawing.html" title="Drawing"><link rel="prev" href="cairo-cairo-t.html" title="cairo_t"><link rel="next" href="cairo-Patterns.html" title="Patterns"><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-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="Drawing.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-Patterns.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-Paths"></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>Paths</span></h2><p>Paths — Creating paths and manipulating path data</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><a name="synopsis"></a><h2>Synopsis</h2><pre class="synopsis"> <a href="cairo-Paths.html#cairo-path-t">cairo_path_t</a>;union <a href="cairo-Paths.html#cairo-path-data-t">cairo_path_data_t</a>;enum <a href="cairo-Paths.html#cairo-path-data-type-t">cairo_path_data_type_t</a>;<a href="cairo-Paths.html#cairo-path-t">cairo_path_t</a>* <a href="cairo-Paths.html#cairo-copy-path">cairo_copy_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);<a href="cairo-Paths.html#cairo-path-t">cairo_path_t</a>* <a href="cairo-Paths.html#cairo-copy-path-flat">cairo_copy_path_flat</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);void <a href="cairo-Paths.html#cairo-path-destroy">cairo_path_destroy</a> (<a href="cairo-Paths.html#cairo-path-t">cairo_path_t</a> *path);void <a href="cairo-Paths.html#cairo-append-path">cairo_append_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-Paths.html#cairo-path-t">cairo_path_t</a> *path);void <a href="cairo-Paths.html#cairo-get-current-point">cairo_get_current_point</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *x, double *y);void <a href="cairo-Paths.html#cairo-new-path">cairo_new_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);void <a href="cairo-Paths.html#cairo-new-sub-path">cairo_new_sub_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);void <a href="cairo-Paths.html#cairo-close-path">cairo_close_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);void <a href="cairo-Paths.html#cairo-arc">cairo_arc</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double xc, double yc, double radius, double angle1, double angle2);void <a href="cairo-Paths.html#cairo-arc-negative">cairo_arc_negative</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double xc, double yc, double radius, double angle1, double angle2);void <a href="cairo-Paths.html#cairo-curve-to">cairo_curve_to</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x1, double y1, double x2, double y2, double x3, double y3);void <a href="cairo-Paths.html#cairo-line-to">cairo_line_to</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x, double y);void <a href="cairo-Paths.html#cairo-move-to">cairo_move_to</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x, double y);void <a href="cairo-Paths.html#cairo-rectangle">cairo_rectangle</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x, double y, double width, double height);void <a href="cairo-Paths.html#cairo-glyph-path">cairo_glyph_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-Text.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs, int num_glyphs);void <a href="cairo-Paths.html#cairo-text-path">cairo_text_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, const char *utf8);void <a href="cairo-Paths.html#cairo-rel-curve-to">cairo_rel_curve_to</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);void <a href="cairo-Paths.html#cairo-rel-line-to">cairo_rel_line_to</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double dx, double dy);void <a href="cairo-Paths.html#cairo-rel-move-to">cairo_rel_move_to</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double dx, double dy);</pre></div><div class="refsect1" lang="en"><a name="desc"></a><h2>Description</h2><p></p></div><div class="refsect1" lang="en"><a name="details"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2560382"></a><h3><a name="cairo-path-t"></a>cairo_path_t</h3><a class="indexterm" name="id2560394"></a><pre class="programlisting">typedef struct { cairo_status_t status; cairo_path_data_t *data; int num_data;} cairo_path_t;</pre><p>A data structure for holding a path. This data structure serves asthe return value for <code class="function">cairo_copy_path_data()</code> and<code class="function">cairo_copy_path_data_flat()</code> as well the input value for<a href="cairo-Paths.html#cairo-append-path"><code class="function">cairo_append_path()</code></a>.</p><p>See <a href="cairo-Paths.html#cairo-path-data-t"><span class="type">cairo_path_data_t</span></a> for hints on how to iterate over theactual data within the path.</p><p>The num_data member gives the number of elements in the dataarray. This number is larger than the number of independent pathportions (defined in <a href="cairo-Paths.html#cairo-path-data-type-t"><span class="type">cairo_path_data_type_t</span></a>), since the dataincludes both headers and coordinates for each portion.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><a href="cairo-Error-handling.html#cairo-status-t">cairo_status_t</a> <em class="structfield"><code>status</code></em>;</span></td><td> the current error status</td></tr><tr><td><span class="term"><a href="cairo-Paths.html#cairo-path-data-t">cairo_path_data_t</a> *<em class="structfield"><code>data</code></em>;</span></td><td> the elements in the path</td></tr><tr><td><span class="term">int <em class="structfield"><code>num_data</code></em>;</span></td><td> the number of elements in the data array</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2560534"></a><h3><a name="cairo-path-data-t"></a>union cairo_path_data_t</h3><a class="indexterm" name="id2560547"></a><pre class="programlisting">union cairo_path_data_t { struct { cairo_path_data_type_t type; int length; } header; struct { double x, y; } point;};</pre><p><a href="cairo-Paths.html#cairo-path-data-t"><span class="type">cairo_path_data_t</span></a> is used to represent the path data inside a<a href="cairo-Paths.html#cairo-path-t"><span class="type">cairo_path_t</span></a>.</p><p>The data structure is designed to try to balance the demands ofefficiency and ease-of-use. A path is represented as an array of<a href="cairo-Paths.html#cairo-path-data-t"><span class="type">cairo_path_data_t</span></a>, which is a union of headers and points.</p><p>Each portion of the path is represented by one or more elements inthe array, (one header followed by 0 or more points). The lengthvalue of the header is the number of array elements for the currentportion including the header, (ie. length == 1 + # of points), andwhere the number of points for each element type must be asfollows:</p><p></p><pre class="programlisting"> <code class="literal">CAIRO_PATH_MOVE_TO</code>: 1 point <code class="literal">CAIRO_PATH_LINE_TO</code>: 1 point <code class="literal">CAIRO_PATH_CURVE_TO</code>: 3 points <code class="literal">CAIRO_PATH_CLOSE_PATH</code>: 0 points</pre><p></p><p>The semantics and ordering of the coordinate values are consistentwith <a href="cairo-Paths.html#cairo-move-to"><code class="function">cairo_move_to()</code></a>, <a href="cairo-Paths.html#cairo-line-to"><code class="function">cairo_line_to()</code></a>, <a href="cairo-Paths.html#cairo-curve-to"><code class="function">cairo_curve_to()</code></a>, and
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -