Horizon
canvas_cairo2.hpp
1 #pragma once
2 #include "canvas/canvas.hpp"
3 #include <cairomm/cairomm.h>
4 
5 namespace horizon {
6 class CanvasCairo2 : public Canvas {
7 public:
8  CanvasCairo2();
9  void push() override
10  {
11  }
12  void request_push() override
13  {
14  }
15  Cairo::RefPtr<Cairo::Surface> get_surface()
16  {
17  return surface;
18  }
19  void load(const class Symbol &sym, const Placement &placement = Placement());
20  void load(const class Package &pkg);
21  void load(const class Decal &dec);
22  Cairo::RefPtr<Cairo::Surface> get_image_surface(double scale = 1, double grid = -1);
23 
24 private:
25  void img_polygon(const Polygon &poly, bool tr) override;
26  void img_line(const Coordi &p0, const Coordi &p1, const uint64_t width, int layer, bool tr = true) override;
27  void img_hole(const Hole &hole) override;
28  void render_pad_names(const Package &pkg);
29  void draw_text_box(const Placement &q, float width, float height, const std::string &s, ColorP color, int layer,
30  uint64_t text_width, TextBoxMode mode);
31 
32  bool layer_filter = false;
33  int current_layer = 0;
34  bool cairo_layer_visible(int l) const;
35  bool fill = false;
36  double min_line_width = 0.1_mm;
37 
38  cairo_surface_t *recording_surface;
39  Cairo::RefPtr<Cairo::Surface> surface;
40  Cairo::RefPtr<Cairo::Context> cr;
41 };
42 } // namespace horizon
Definition: canvas_cairo2.hpp:6
Definition: canvas.hpp:24
Definition: decal.hpp:16
A hole with diameter and position, that's it.
Definition: hole.hpp:18
Definition: package.hpp:30
Definition: placement.hpp:8
Polygon used in Padstack, Package and Board for specifying filled Regions.
Definition: polygon.hpp:27
Definition: symbol.hpp:72
zip_uint64_t uint64_t
zip_uint64_t_t typedef.
Definition: zip.hpp:108