mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-07-27 03:44:53 +03:00
Can rasterize polygons with holes using AGG. Export is raw ppm for now.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user