[docs] Added empty cpml.types
[adg.git] / cpml / cpml-close.c
blob73ed8c4be624bf7aa9316e7cddfbcc92f0ae1851
1 /* CPML - Cairo Path Manipulation Library
2 * Copyright (C) 2008, 2009 Nicola Fontana <ntd at entidi.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 /**
21 * SECTION:close
22 * @title: Closing path lines
23 * @short_description: APIs to manage closing path virtual primitives
25 * The following functions manipulate %CAIRO_PATH_CLOSE_PATH
26 * #CpmlPrimitive. No check is made on the primitive struct, so be
27 * sure the <structname>CpmlPrimitive</structname> is effectively
28 * a close operation before calling these APIs.
30 * This primitive management is almost identical to straight lines,
31 * but taking properly start and end points.
32 **/
34 #include "cpml-close.h"
35 #include "cpml-pair.h"
36 #include "cpml-line.h"
38 /**
39 * cpml_close_type_get_npoints:
41 * Returns the number of points needed to properly specify a close primitive.
42 * This is a bit tricky: the close path primitive can be specified with
43 * a single point but it has an implicit second point, the start point
44 * of the source segment. This means retrieving a second point from a
45 * cairo path is a valid operation and must return the start point of
46 * the source segment.
48 * Return value: 2
49 **/
50 int
51 cpml_close_type_get_npoints(void)
53 return 2;
56 /**
57 * cpml_close_pair_at:
58 * @close: the #CpmlPrimitive close data
59 * @pair: the destination pair
60 * @pos: the position value
62 * Given the @close path virtual primitive, finds the coordinates
63 * at position @pos (where 0 is the start and 1 is the end) and
64 * stores the result in @pair.
66 * @pos can be less than 0 or greater than 1, in which case the
67 * coordinates are interpolated.
68 **/
69 void
70 cpml_close_pair_at(const CpmlPrimitive *close, CpmlPair *pair, double pos)
72 cpml_line_pair_at(close, pair, pos);
75 /**
76 * cpml_close_vector_at:
77 * @close: the #CpmlPrimitive close data
78 * @vector: the destination vector
79 * @pos: the position value
81 * Gets the slope on @close at the position @pos. Being the
82 * close a straight line, the vector is always the same, so
83 * @pos is not used.
84 **/
85 void
86 cpml_close_vector_at(const CpmlPrimitive *close,
87 CpmlVector *vector, double pos)
89 cpml_line_vector_at(close, vector, pos);
92 /**
93 * cpml_close_offset:
94 * @close: the #CpmlPrimitive close data
95 * @offset: distance for the computed parallel close
97 * Given a close segment specified by the @close primitive data,
98 * computes the parallel close distant @offset from the original one
99 * and returns the result by changing @close.
101 void
102 cpml_close_offset(CpmlPrimitive *close, double offset)
104 cpml_line_offset(close, offset);