diff options
author | jaseg <git@jaseg.de> | 2021-04-25 00:09:57 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-04-25 00:20:51 +0200 |
commit | 1180ebdc1f18044a74f22f17b4d500ce7d6543fa (patch) | |
tree | d2de84bc7b73feaae3d2a3b191e97531a1a9dd32 /svg-flatten/src/vec_core.h | |
parent | 776e0bd2069af0cfff7ce794cf3b345b613e1c02 (diff) | |
download | gerbolyze-1180ebdc1f18044a74f22f17b4d500ce7d6543fa.tar.gz gerbolyze-1180ebdc1f18044a74f22f17b4d500ce7d6543fa.tar.bz2 gerbolyze-1180ebdc1f18044a74f22f17b4d500ce7d6543fa.zip |
Remove cairo dependencywip-nocairo
We initially used Cairo for its bezier flattening algorithm. That
algorithm turned out to be a bit too imprecise at the scales we're
working at here (#17), so I ended up porting over some code from
Antigrain Graphics. The only other thing we used Cairo for was debug
output and coordinate transforms, so I just wrote the relevant vector
math in a small header file, deleted all debug output code and thus
eliminated the cairo dependency. This is a step towards Windows builds.
Diffstat (limited to 'svg-flatten/src/vec_core.h')
-rw-r--r-- | svg-flatten/src/vec_core.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/svg-flatten/src/vec_core.h b/svg-flatten/src/vec_core.h index 8267fd1..0d4da12 100644 --- a/svg-flatten/src/vec_core.h +++ b/svg-flatten/src/vec_core.h @@ -18,7 +18,6 @@ #pragma once -#include <cairo.h> #include <pugixml.hpp> #include <clipper.hpp> #include <gerbolyze.hpp> @@ -30,7 +29,7 @@ namespace gerbolyze { public: VoronoiVectorizer(grid_type grid, bool relax=true) : m_relax(relax), m_grid_type(grid) {} - virtual void vectorize_image(cairo_t *cr, const pugi::xml_node &node, ClipperLib::Paths &clip_path, cairo_matrix_t &viewport_matrix, PolygonSink &sink, double min_feature_size_px); + virtual void vectorize_image(xform2d &mat, const pugi::xml_node &node, ClipperLib::Paths &clip_path, PolygonSink &sink, double min_feature_size_px); private: double m_relax; grid_type m_grid_type; @@ -40,19 +39,19 @@ namespace gerbolyze { public: OpenCVContoursVectorizer() {} - virtual void vectorize_image(cairo_t *cr, const pugi::xml_node &node, ClipperLib::Paths &clip_path, cairo_matrix_t &viewport_matrix, PolygonSink &sink, double min_feature_size_px); + virtual void vectorize_image(xform2d &mat, const pugi::xml_node &node, ClipperLib::Paths &clip_path, PolygonSink &sink, double min_feature_size_px); }; class DevNullVectorizer : public ImageVectorizer { public: DevNullVectorizer() {} - virtual void vectorize_image(cairo_t *, const pugi::xml_node &, ClipperLib::Paths &, cairo_matrix_t &, PolygonSink &, double) {} + virtual void vectorize_image(xform2d &, const pugi::xml_node &, ClipperLib::Paths &, PolygonSink &, double) {} }; void parse_img_meta(const pugi::xml_node &node, double &x, double &y, double &width, double &height); std::string read_img_data(const pugi::xml_node &node); - void draw_bg_rect(cairo_t *cr, double width, double height, ClipperLib::Paths &clip_path, PolygonSink &sink, cairo_matrix_t &viewport_matrix); + void draw_bg_rect(xform2d &mat, double width, double height, ClipperLib::Paths &clip_path, PolygonSink &sink); void handle_aspect_ratio(std::string spec, double &scale_x, double &scale_y, double &off_x, double &off_y, double cols, double rows); } |