summaryrefslogtreecommitdiffstats
path: root/src/2geom/pathvector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/2geom/pathvector.h')
-rw-r--r--src/2geom/pathvector.h44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/2geom/pathvector.h b/src/2geom/pathvector.h
index 17f6b6212..14d1efdfa 100644
--- a/src/2geom/pathvector.h
+++ b/src/2geom/pathvector.h
@@ -38,13 +38,55 @@
#include <2geom/forward.h>
#include <2geom/path.h>
#include <2geom/rect.h>
+#include <2geom/transforms.h>
namespace Geom {
typedef std::vector<Geom::Path> PathVector;
+/* general path transformation: */
+inline
+void operator*= (PathVector & path_in, Matrix const &m) {
+ for(PathVector::iterator it = path_in.begin(); it != path_in.end(); ++it) {
+ (*it) *= m;
+ }
+}
+inline
+PathVector operator*(PathVector const & path_in, Matrix const &m) {
+ PathVector ret(path_in);
+ ret *= m;
+ return ret;
+}
+
+/* specific path transformations: Translation:
+ * This makes it possible to make optimized implementations for Translate transforms */
+inline
+void operator*= (PathVector & path_in, Translate const &m) {
+ for(PathVector::iterator it = path_in.begin(); it != path_in.end(); ++it) {
+ (*it) *= m;
+ }
+}
+inline
+PathVector operator*(PathVector const & path_in, Translate const &m) {
+ PathVector ret(path_in);
+ ret *= m;
+ return ret;
+}
+
+/* user friendly approach to Translate transforms: just add an offset Point to the whole path */
+inline
+void operator+=(PathVector &path_in, Point const &p) {
+ for(PathVector::iterator it = path_in.begin(); it != path_in.end(); ++it) {
+ (*it) *= Translate(p);
+ }
+}
+inline
+PathVector operator+(PathVector const &path_in, Point const &p) {
+ PathVector ret(path_in);
+ ret *= Translate(p);
+ return ret;
+}
-PathVector operator* (PathVector const & path_in, Matrix const &m);
PathVector reverse_paths_and_order (PathVector const & path_in);