diff options
author | jaseg <git@jaseg.de> | 2021-01-24 18:44:56 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-01-24 18:44:56 +0100 |
commit | f7b4cc602b9a646fbc66f3f17d6bb9c20efc3ead (patch) | |
tree | d7b110b65e93b87fc65472559ac74e7eb961bc7c /upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.hpp | |
download | gerbolyze-f7b4cc602b9a646fbc66f3f17d6bb9c20efc3ead.tar.gz gerbolyze-f7b4cc602b9a646fbc66f3f17d6bb9c20efc3ead.tar.bz2 gerbolyze-f7b4cc602b9a646fbc66f3f17d6bb9c20efc3ead.zip |
Initial commit
Diffstat (limited to 'upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.hpp')
-rw-r--r-- | upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.hpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.hpp b/upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.hpp new file mode 100644 index 0000000..7c52dfd --- /dev/null +++ b/upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.hpp @@ -0,0 +1,59 @@ +/*******************************************************************************
+* *
+* Author : Angus Johnson *
+* Version : 1.1 *
+* Date : 4 April 2011 *
+* Copyright : Angus Johnson 2010-2011 *
+* *
+* License: *
+* Use, modification & distribution is subject to Boost Software License Ver 1. *
+* http://www.boost.org/LICENSE_1_0.txt *
+* *
+* Modified by Mike Owens to support coordinate transformation *
+*******************************************************************************/
+
+#ifndef CLIPPER_CAIRO_CLIPPER_HPP
+#define CLIPPER_CAIRO_CLIPPER_HPP
+
+#include "clipper.hpp"
+
+typedef struct _cairo cairo_t;
+
+namespace ClipperLib {
+ namespace cairo {
+
+ enum Transform {
+ tNone,
+ tUserToDevice,
+ tDeviceToUser
+ };
+
+//nb: Since Clipper only accepts integer coordinates, fractional values have to
+//be scaled up and down when being passed to and from Clipper. This is easily
+//accomplished by setting the scaling factor (10^x) in the following functions.
+//When scaling, remember that on most platforms, integer is only a 32bit value.
+ void cairo_to_clipper(cairo_t* cr,
+ ClipperLib::Paths &pg,
+ int scaling_factor = 0,
+ Transform transform = tNone);
+
+ void clipper_to_cairo(const ClipperLib::Paths &pg,
+ cairo_t* cr,
+ int scaling_factor = 0,
+ Transform transform = tNone);
+ }
+
+ class clipperCairoException : public std::exception
+ {
+ public:
+ clipperCairoException(const char* description)
+ throw(): std::exception(), m_description (description) {}
+ virtual ~clipperCairoException() throw() {}
+ virtual const char* what() const throw() {return m_description.c_str();}
+ private:
+ std::string m_description;
+ };
+}
+
+#endif
+
|