Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SVG.hpp « libslic3r « src « xs - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aa08c0e203a30fb6cb6a0bb869bf97a0b5fc44b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef slic3r_SVG_hpp_
#define slic3r_SVG_hpp_

#include "libslic3r.h"
#include "ExPolygon.hpp"
#include "Line.hpp"
#include "TriangleMesh.hpp"

namespace Slic3r {

class SVG
{
    public:
    bool arrows;
    std::string fill, stroke;
    Point origin;

    SVG(const char* filename);
    SVG(const char* filename, const BoundingBox &bbox);
    ~SVG() { if (f != NULL) Close(); }

    void draw(const Line &line, std::string stroke = "black", coord_t stroke_width = 0);
    void draw(const ThickLine &line, const std::string &fill, const std::string &stroke, coord_t stroke_width = 0);
    void draw(const Lines &lines, std::string stroke = "black");
    void draw(const IntersectionLines &lines, std::string stroke = "black");
    void draw(const ExPolygon &expolygon, std::string fill = "grey");
    void draw(const ExPolygons &expolygons, std::string fill = "grey");
    void draw(const Polygon &polygon, std::string fill = "grey");
    void draw(const Polygons &polygons, std::string fill = "grey");
    void draw(const Polyline &polyline, std::string stroke = "black", coord_t stroke_width = 0);
    void draw(const Polylines &polylines, std::string stroke = "black", coord_t stroke_width = 0);
    void draw(const ThickLines &thicklines, const std::string &fill = "lime", const std::string &stroke = "black", coord_t stroke_width = 0);
    void draw(const ThickPolylines &polylines, const std::string &stroke = "black", coord_t stroke_width = 0);
    void draw(const ThickPolylines &thickpolylines, const std::string &fill, const std::string &stroke, coord_t stroke_width);
    void draw(const Point &point, std::string fill = "black", coord_t radius = 0);
    void draw(const Points &points, std::string fill = "black", coord_t radius = 0);
    void Close();
    
    private:
    std::string filename;
    FILE* f;
    
    void path(const std::string &d, bool fill, coord_t stroke_width = 0);
    std::string get_path_d(const MultiPoint &mp, bool closed = false) const;
};

}

#endif