Horizon
canvas_pdf.hpp
1#pragma once
2#include "canvas/canvas.hpp"
3#include <podofo/podofo.h>
4
5namespace horizon {
6
7template <typename T> static T to_um(T x)
8{
9 return x / 1000;
10}
11
12template <typename T> static T to_pt(T x)
13{
14 return x * .000002834645669291339;
15}
16
17class CanvasPDF : public Canvas {
18public:
19 CanvasPDF(PoDoFo::PdfPainterMM &painter, PoDoFo::PdfFont &font, const class PDFExportSettings &settings);
20 void push() override
21 {
22 }
23
24 void request_push() override;
25 bool layer_filter = false;
26 int current_layer = 0;
27 bool fill = true;
28 bool use_layer_colors = false;
29 const auto &get_selectables() const
30 {
31 return selectables;
32 }
33
34private:
35 PoDoFo::PdfPainterMM &painter;
36 PoDoFo::PdfFont &font;
37 const PDFExportSettings &settings;
38 const PoDoFo::PdfFontMetrics *metrics;
39 void img_line(const Coordi &p0, const Coordi &p1, const uint64_t width, int layer, bool tr) override;
40 void img_polygon(const class Polygon &poly, bool tr) override;
41 void img_draw_text(const Coordf &p, float size, const std::string &rtext, int angle, bool flip, TextOrigin origin,
42 int layer = 10000, uint64_t width = 0, TextData::Font font = TextData::Font::SIMPLEX,
43 bool center = false, bool mirror = false) override;
44 void img_hole(const Hole &hole) override;
45 bool pdf_layer_visible(int l) const;
46 void draw_polygon(const Polygon &ipoly, bool tr);
47 Color get_pdf_layer_color(int layer) const;
48};
49} // namespace horizon
Definition: canvas_pdf.hpp:17
Definition: canvas.hpp:24
Definition: common.hpp:270
A hole with diameter and position, that's it.
Definition: hole.hpp:15
Definition: pdf_export_settings.hpp:9
Polygon used in Padstack, Package and Board for specifying filled Regions.
Definition: polygon.hpp:25