glbarcode++
 
Loading...
Searching...
No Matches
Renderer.hpp
Go to the documentation of this file.
1// Renderer.hpp
2//
3// Copyright (C) 2013-2026 Jaye Evins <evins@snaught.com>
4//
5// This file is part of glbarcode++.
6//
7// glbarcode++ is free software: you can redistribute it and/or modify
8// it under the terms of the GNU Lesser General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// glbarcode++ is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU Lesser General Public License for more details.
16//
17// You should have received a copy of the GNU Lesser General Public License
18// along with glbarcode++. If not, see <http://www.gnu.org/licenses/>.
19//
20
21#ifndef glbarcode_Renderer_hpp
22#define glbarcode_Renderer_hpp
23
24
25#include <list>
26
27#include "DrawingPrimitives.hpp"
28
29
33extern "C" struct gbcRenderer {};
34
35
36namespace glbarcode
37{
38
39 class DrawingPrimitive; /* Forward reference to private drawing primitive class. */
40
41
47 class Renderer : public gbcRenderer
48 {
49 protected:
53 Renderer() = default;
54
55 public:
59 virtual ~Renderer() = default;
60
61 /*
62 * Non-copyable
63 */
64 Renderer( const Renderer & ) = delete;
65 void operator=( const Renderer & ) = delete;
66
74 void render( double w, double h, const std::list<DrawingPrimitive*>& primitives );
75
76
77 protected:
87 virtual void drawBegin( double w, double h ) = 0;
88
89
96 virtual void drawEnd() = 0;
97
98
111 virtual void drawLine( double x, double y, double w, double h ) = 0;
112
113
126 virtual void drawBox( double x, double y, double w, double h ) = 0;
127
128
141 virtual void drawText( double x, double y, double size, const std::string& text, HAlign halign = H_ALIGN_CENTER ) = 0;
142
143
156 virtual void drawRing( double x, double y, double r, double w ) = 0;
157
158
170 virtual void drawHexagon( double x, double y, double h ) = 0;
171
172 };
173
174}
175
176#endif // glbarcode_Renderer_hpp
Definition Renderer.hpp:48
virtual void drawBox(double x, double y, double w, double h)=0
void render(double w, double h, const std::list< DrawingPrimitive * > &primitives)
virtual void drawHexagon(double x, double y, double h)=0
void operator=(const Renderer &)=delete
Renderer(const Renderer &)=delete
virtual void drawText(double x, double y, double size, const std::string &text, HAlign halign=H_ALIGN_CENTER)=0
virtual ~Renderer()=default
virtual void drawBegin(double w, double h)=0
virtual void drawLine(double x, double y, double w, double h)=0
virtual void drawRing(double x, double y, double r, double w)=0
virtual void drawEnd()=0
Definition Barcode.hpp:38
HAlign
Definition Enums.hpp:29
@ H_ALIGN_CENTER
Definition Enums.hpp:30
Definition Renderer.hpp:33