Target.h
Go to the documentation of this file.
1 /****
2  * Drawing.h
3  *
4  * Copyright 2021 mikee47 <mike@sillyhouse.net>
5  *
6  * This file is part of the Sming-Graphics Library
7  *
8  * This library is free software: you can redistribute it and/or modify it under the terms of the
9  * GNU General Public License as published by the Free Software Foundation, version 3 or later.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with this library.
16  * If not, see <https://www.gnu.org/licenses/>.
17  *
18  * @author: May 2021 - mikee47 <mike@sillyhouse.net>
19  *
20  ****/
21 
22 #pragma once
23 
24 #include "../Object.h"
25 #include "Writer.h"
26 
27 namespace Graphics
28 {
29 namespace Drawing
30 {
31 class Target
32 {
33 public:
34  Target(DrawingObject& drawing) : writer(drawing.getStream())
35  {
36  }
37 
38  Target(Stream& stream) : writer(stream)
39  {
40  }
41 
42  bool render(const Object& object, const Rect& location);
43 
44  void flush()
45  {
46  writer.flush();
47  }
48 
49 private:
50  Writer writer;
51 };
52 
53 } // namespace Drawing
54 
56 
57 } // namespace Graphics
A collection of line and curve drawing operations.
Definition: Libraries/Graphics/src/include/Graphics/Object.h:1179
Definition: Target.h:32
Target(DrawingObject &drawing)
Definition: Target.h:34
void flush()
Definition: Target.h:44
bool render(const Object &object, const Rect &location)
Target(Stream &stream)
Definition: Target.h:38
Definition: Writer.h:34
void flush()
Definition: Writer.h:172
A drawable object inherits from this virtual base class.
Definition: Libraries/Graphics/src/include/Graphics/Object.h:97
Base Stream class.
Definition: Wiring/Stream.h:33
Definition: Virtual.h:31
Location and size of rectangular area (x, y, w, h)
Definition: Libraries/Graphics/src/include/Graphics/Types.h:287