Can rasterize polygons with holes using AGG. Export is raw ppm for now.

This commit is contained in:
tamasmeszaros 2018-05-17 18:17:15 +02:00
parent cee965f5ac
commit c3a944ef97
131 changed files with 45962 additions and 102 deletions

View file

@ -1,6 +1,7 @@
#ifndef RASTERIZER_HPP
#define RASTERIZER_HPP
#include <ostream>
#include <Polygon.hpp>
namespace Slic3r {
@ -10,10 +11,18 @@ class Raster {
std::unique_ptr<Impl> impl_;
public:
enum class Compression {
RAW,
PNG
};
struct Resolution {
unsigned width_px;
unsigned height_px;
inline Resolution(unsigned w, unsigned h): width_px(w), height_px(h) {}
inline unsigned pixels() const /*noexcept*/ {
return width_px * height_px;
}
};
struct PixelDim {
@ -23,7 +32,7 @@ public:
w_mm(px_width_mm), h_mm(px_height_mm) {}
};
inline explicit Raster(const Resolution& r, const PixelDim& pd );
explicit Raster(const Resolution& r, const PixelDim& pd );
~Raster();
Raster(const Raster& cpy);
Raster(Raster&& m);
@ -32,11 +41,7 @@ public:
void draw(const Polygon& poly);
void finish();
private:
Resolution resolution_;
PixelDim pxdim_;
void save(std::ostream& stream, Compression comp = Compression::RAW);
};
}