Horizon
canvas_pdf.hpp
1 #pragma once
2 #include "canvas/canvas.hpp"
3 #include <podofo/podofo.h>
4 
5 namespace horizon {
6 
7 template <typename T> static T to_um(T x)
8 {
9  return x / 1000;
10 }
11 
12 template <typename T> static T to_pt(T x)
13 {
14  return x * .000002834645669291339;
15 }
16 
17 class CanvasPDF : public Canvas {
18 public:
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 
30 private:
31  PoDoFo::PdfPainterMM *painter;
32  PoDoFo::PdfFont *font;
33  const PDFExportSettings &settings;
34  const PoDoFo::PdfFontMetrics *metrics;
35  void img_line(const Coordi &p0, const Coordi &p1, const uint64_t width, int layer, bool tr) override;
36  void img_polygon(const class Polygon &poly, bool tr) override;
37  void img_draw_text(const Coordf &p, float size, const std::string &rtext, int angle, bool flip, TextOrigin origin,
38  int layer = 10000, uint64_t width = 0, TextData::Font font = TextData::Font::SIMPLEX,
39  bool center = false, bool mirror = false) override;
40  bool pdf_layer_visible(int l) const;
41  Color get_pdf_layer_color(int layer) const;
42 };
43 } // namespace horizon
horizon::Polygon
Polygon used in Padstack, Package and Board for specifying filled Regions.
Definition: polygon.hpp:27
horizon::CanvasPDF
Definition: canvas_pdf.hpp:17
horizon::Color
Definition: common.hpp:220
horizon::Canvas
Definition: canvas.hpp:22
horizon::Coord< int64_t >
horizon::PDFExportSettings
Definition: pdf_export_settings.hpp:9
libzip::uint64_t
zip_uint64_t uint64_t
zip_uint64_t_t typedef.
Definition: zip.hpp:108