Model centered when exporting to png. Added some comments to the rasterization.

This commit is contained in:
tamasmeszaros 2018-05-21 13:46:41 +02:00
parent 0f552832da
commit 6b5c0073a7
4 changed files with 122 additions and 81 deletions

View file

@ -1,4 +1,6 @@
#include "Rasterizer.hpp"
#include <ExPolygon.hpp>
#include <cstdint>
// For rasterizing
@ -14,7 +16,7 @@
#include <agg/agg_rasterizer_scanline_aa.h>
#include <agg/agg_path_storage.h>
// For compression
// For png compression
#ifdef WIN32
inline char *strerror_r(int errnum, char *buf, size_t buflen) {
strerror_s(buf, buflen, errnum);
@ -70,9 +72,12 @@ public:
agg::rasterizer_scanline_aa<> ras;
agg::scanline_p8 scanlines;
ras.add_path(to_path(poly.contour));
auto&& path = to_path(poly.contour);
ras.add_path(path);
for(auto h : poly.holes) {
ras.add_path(to_path(h));
auto&& holepath = to_path(h);
ras.add_path(holepath);
}
agg::render_scanlines(ras, scanlines, renderer_);