Renderer.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <etk/math/Vector2D.hpp>
10 #include <etk/Color.hpp>
11 #include <esvg/render/Weight.hpp>
13 
14 namespace esvg {
15  class Document;
16  class Renderer {
17  #ifdef DEBUG
18  private:
19  bool m_visualDebug;
20  int32_t m_factor;
21  #endif
22  public:
23  Renderer(const ivec2& _size, esvg::Document* _document, bool _visualDebug=false);
24  ~Renderer();
25  protected:
26  ivec2 m_size;
27  public:
28  void setSize(const ivec2& _size);
29  const ivec2& getSize() const;
30  protected:
31  std::vector<etk::Color<float,4>> m_buffer;
32  public:
33  std::vector<etk::Color<float,4>> getData();
34  protected:
35  int32_t m_interpolationRecurtionMax;
36  public:
37  void setInterpolationRecurtionMax(int32_t _value);
38  int32_t getInterpolationRecurtionMax() const;
39  protected:
40  float m_interpolationThreshold;
41  public:
42  void setInterpolationThreshold(float _value);
43  float getInterpolationThreshold() const;
44  protected:
45  int32_t m_nbSubScanLine;
46  public:
47  void setNumberSubScanLine(int32_t _value);
48  int32_t getNumberSubScanLine() const;
49  public:
50  void writePPM(const std::string& _fileName);
51  void writeBMP(const std::string& _fileName);
52  protected:
53  etk::Color<float,4> mergeColor(etk::Color<float,4> _base, etk::Color<float,4> _integration);
54  public:
55  void print(const esvg::render::Weight& _weightFill,
57  const esvg::render::Weight& _weightStroke,
59  float _opacity);
60  #ifdef DEBUG
61  void addDebugSegment(const esvg::render::SegmentList& _listSegment);
62  void addDebug(const std::vector<std::pair<vec2,vec2>>& _info);
63  #endif
64  protected:
65  esvg::Document* m_document;
66  public:
67  esvg::Document* getMainDocument() {
68  return m_document;
69  }
70  };
71 }
72 
Main esvg namespace.
Definition: Base.hpp:24
Definition: Renderer.hpp:16
Definition: Weight.hpp:15
Definition: SegmentList.hpp:17
Definition: esvg.hpp:19