1b09c8c6e5e6f4d5146d1e0ec8ea5d796e22de0f
1 #ifndef SEEN_DISPLAY_CURVE_H
2 #define SEEN_DISPLAY_CURVE_H
4 /** \file
5 * Wrapper around a Geom::PathVector 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 <boost/optional.hpp>
25 class SPCurve {
26 public:
27 /* Constructors */
28 explicit SPCurve();
29 explicit SPCurve(Geom::PathVector const& pathv);
30 static SPCurve * new_from_rect(Geom::Rect const &rect);
32 virtual ~SPCurve();
34 void set_pathvector(Geom::PathVector const & new_pathv);
35 Geom::PathVector const & get_pathvector() const;
37 SPCurve * ref();
38 SPCurve * unref();
40 SPCurve * copy() const;
42 guint get_segment_count() const;
43 guint nodes_in_path() const;
45 bool is_empty() const;
46 bool is_closed() const;
47 Geom::Curve const * last_segment() const;
48 Geom::Path const * last_path() const;
49 Geom::Curve const * first_segment() const;
50 Geom::Path const * first_path() const;
51 boost::optional<Geom::Point> first_point() const;
52 boost::optional<Geom::Point> last_point() const;
53 boost::optional<Geom::Point> second_point() const;
54 boost::optional<Geom::Point> penultimate_point() const;
56 void reset();
58 void moveto(Geom::Point const &p);
59 void moveto(gdouble x, gdouble y);
60 void lineto(Geom::Point const &p);
61 void lineto(gdouble x, gdouble y);
62 void curveto(Geom::Point const &p0, Geom::Point const &p1, Geom::Point const &p2);
63 void curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2);
64 void closepath();
65 void closepath_current();
66 void backspace();
68 void transform(Geom::Matrix const &m);
69 void stretch_endpoints(Geom::Point const &, Geom::Point const &);
70 void move_endpoints(Geom::Point const &, Geom::Point const &);
71 void last_point_additive_move(Geom::Point const & p);
73 void append(SPCurve const *curve2, bool use_lineto);
74 SPCurve * append_continuous(SPCurve const *c1, gdouble tolerance);
75 SPCurve * create_reverse() const;
77 GSList * split() const;
78 static SPCurve * concat(GSList const *list);
80 protected:
81 gint _refcount;
83 Geom::PathVector _pathv;
85 private:
86 // Don't implement these:
87 SPCurve(const SPCurve&);
88 SPCurve& operator=(const SPCurve&);
89 };
91 #endif /* !SEEN_DISPLAY_CURVE_H */
93 /*
94 Local Variables:
95 mode:c++
96 c-file-style:"stroustrup"
97 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
98 indent-tabs-mode:nil
99 fill-column:99
100 End:
101 */
102 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :