diff options
| author | MenTaLguY <mental@rydia.net> | 2006-01-16 02:36:01 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2006-01-16 02:36:01 +0000 |
| commit | 179fa413b047bede6e32109e2ce82437c5fb8d34 (patch) | |
| tree | a5a6ac2c1708bd02288fbd8edb2ff500ff2e0916 /src/libnr/nr-scale.h | |
| download | inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.tar.gz inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.zip | |
moving trunk for module inkscape
(bzr r1)
Diffstat (limited to 'src/libnr/nr-scale.h')
| -rw-r--r-- | src/libnr/nr-scale.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/libnr/nr-scale.h b/src/libnr/nr-scale.h new file mode 100644 index 000000000..c9de871de --- /dev/null +++ b/src/libnr/nr-scale.h @@ -0,0 +1,50 @@ +#ifndef SEEN_NR_SCALE_H +#define SEEN_NR_SCALE_H +#include <libnr/nr-point.h> +#include <libnr/nr-point-ops.h> + +namespace NR { + +class scale { +private: + Point _p; + +private: + scale(); + +public: + explicit scale(Point const &p) : _p(p) {} + scale(double const x, double const y) : _p(x, y) {} + explicit scale(double const s) : _p(s, s) {} + inline Coord operator[](Dim2 const d) const { return _p[d]; } + inline Coord operator[](unsigned const d) const { return _p[d]; } + inline Coord &operator[](Dim2 const d) { return _p[d]; } + inline Coord &operator[](unsigned const d) { return _p[d]; } + + bool operator==(scale const &o) const { + return _p == o._p; + } + + bool operator!=(scale const &o) const { + return _p != o._p; + } + scale inverse() const { + return scale(1/_p[0], 1/_p[1]); + } +}; + +} /* namespace NR */ + + +#endif /* !SEEN_NR_SCALE_H */ + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : |
