Code

fe072019522aff84a053137832ba6d381d10603f
[inkscape.git] / src / display / curve.h
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, bool all_four_sides = false);
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 quadto(Geom::Point const &p1, Geom::Point const &p2);
63     void quadto(gdouble x1, gdouble y1, gdouble x2, gdouble y2);
64     void curveto(Geom::Point const &p0, Geom::Point const &p1, Geom::Point const &p2);
65     void curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2);
66     void closepath();
67     void closepath_current();
68     void backspace();
70     void transform(Geom::Matrix const &m);
71     void stretch_endpoints(Geom::Point const &, Geom::Point const &);
72     void move_endpoints(Geom::Point const &, Geom::Point const &);
73     void last_point_additive_move(Geom::Point const & p);
75     void append(SPCurve const *curve2, bool use_lineto);
76     SPCurve * append_continuous(SPCurve const *c1, gdouble tolerance);
77     SPCurve * create_reverse() const;
79     GSList * split() const;
80     static SPCurve * concat(GSList const *list);
82 protected:
83     gint _refcount;
85     Geom::PathVector _pathv;
87 private:
88     // Don't implement these:
89     SPCurve(const SPCurve&);
90     SPCurve& operator=(const SPCurve&);
91 };
93 #endif /* !SEEN_DISPLAY_CURVE_H */
95 /*
96   Local Variables:
97   mode:c++
98   c-file-style:"stroustrup"
99   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
100   indent-tabs-mode:nil
101   fill-column:99
102   End:
103 */
104 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :