1 #ifndef SEEN_DISPLAY_CURVE_H
2 #define SEEN_DISPLAY_CURVE_H
4 /** \file
5 * Wrapper around an array of NArtBpath objects.
6 *
7 * Author:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 *
10 * Copyright (C) 2000 Lauris Kaplinski
11 * Copyright (C) 2000-2001 Ximian, Inc.
12 * Copyright (C) 2002 Lauris Kaplinski
13 * Copyright (C) 2008 Johan Engelen
14 *
15 * Released under GNU GPL
16 */
18 #include <glib/gtypes.h>
19 #include <glib/gslist.h>
21 #include <2geom/forward.h>
23 #include "libnr/nr-forward.h"
25 #define SP_CURVE_LENSTEP 32
27 struct SPObject;
29 /// Wrapper around Geom::PathVector.
30 class SPCurve {
31 public:
32 /* Constructors */
33 explicit SPCurve(guint length = SP_CURVE_LENSTEP);
34 explicit SPCurve(Geom::PathVector const& pathv);
35 static SPCurve * new_from_rect(Geom::Rect const &rect);
37 virtual ~SPCurve();
39 void set_pathvector(Geom::PathVector const & new_pathv);
40 NArtBpath const * get_bpath() const;
41 Geom::PathVector const & get_pathvector() const;
43 guint get_segment_count() const;
44 guint nodes_in_path() const;
46 SPCurve * ref();
47 SPCurve * unref();
49 SPCurve * copy() const;
51 GSList * split() const;
52 void transform(NR::Matrix const &m);
53 void transform(Geom::Matrix const &m);
54 void stretch_endpoints(NR::Point const &, NR::Point const &);
55 void move_endpoints(NR::Point const &, NR::Point const &);
56 void last_point_additive_move(Geom::Point const & p);
58 void reset();
60 void moveto(Geom::Point const &p);
61 void moveto(NR::Point const &p);
62 void moveto(gdouble x, gdouble y);
63 void lineto(Geom::Point const &p);
64 void lineto(NR::Point const &p);
65 void lineto(gdouble x, gdouble y);
66 void curveto(Geom::Point const &p0, Geom::Point const &p1, Geom::Point const &p2);
67 void curveto(NR::Point const &p0, NR::Point const &p1, NR::Point const &p2);
68 void curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2);
69 void closepath();
70 void closepath_current();
72 SPCurve * append_continuous(SPCurve const *c1, gdouble tolerance);
74 bool is_empty() const;
75 bool is_closed() const;
76 Geom::Curve const * last_segment() const;
77 Geom::Path const * last_path() const;
78 Geom::Curve const * first_segment() const;
79 Geom::Path const * first_path() const;
80 NR::Point first_point() const;
81 NR::Point last_point() const;
82 NR::Point second_point() const;
83 NR::Point penultimate_point() const;
85 void append(SPCurve const *curve2, bool use_lineto);
86 SPCurve * create_reverse() const;
87 void backspace();
89 static SPCurve * concat(GSList const *list);
91 protected:
92 gint _refcount;
94 Geom::PathVector _pathv;
96 private:
97 // Don't implement these:
98 SPCurve(const SPCurve&);
99 SPCurve& operator=(const SPCurve&);
100 };
102 #endif /* !SEEN_DISPLAY_CURVE_H */
104 /*
105 Local Variables:
106 mode:c++
107 c-file-style:"stroustrup"
108 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
109 indent-tabs-mode:nil
110 fill-column:99
111 End:
112 */
113 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :