1
#ifndef SEEN_LIBNR_N_ART_BPATH_H
2
#define SEEN_LIBNR_N_ART_BPATH_H
5
* NArtBpath: old-style path segment.
10
#include "libnr/nr-point.h"
11
#include "libnr/nr-path-code.h"
15
* Old-style path segment.
17
* Arrays of paths segment start with a MOVETO or MOVETO_OPEN segment
18
* where the former indicates the beginning of a closed subpath.
19
* \see subpath_from_bpath()
23
NRPathcode code; ///< Type of segment
24
double x1, y1; ///< Position of control point in case of NR_CURVETO
25
double x2, y2; ///< Position of control point in case of NR_CURVETO
26
double x3, y3; ///< Position of next point
28
/// Convert i-th position data pair to Point object
30
NR::Point c(unsigned const i) const {
32
case 1: return NR::Point(x1, y1);
33
case 2: return NR::Point(x2, y2);
34
case 3: return NR::Point(x3, y3);
35
default: std::abort();
39
/// Set i-th position data pair from Point
41
void setC(unsigned const i, NR::Point const &p) {
42
using NR::X; using NR::Y;
44
case 1: x1 = p[X]; y1 = p[Y]; break;
45
case 2: x2 = p[X]; y2 = p[Y]; break;
46
case 3: x3 = p[X]; y3 = p[Y]; break;
47
default: std::abort();
53
#endif /* !SEEN_LIBNR_N_ART_BPATH_H */
58
c-file-style:"stroustrup"
59
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
64
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :