Vivoe Lite 0.5.0
Lightweight GVA like HMI for military displays.
Loading...
Searching...
No Matches
canvas.h
Go to the documentation of this file.
1//
2// Copyright (c) 2023, DefenceX PTY LTD
3//
4// This file is part of the VivoeX project developed by DefenceX.
5//
6// Licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
7// License. See the LICENSE file in the project root for full license details.
8//
12
13#ifndef HMICORE_WIDGETS_CANVAS_CANVAS_H_
14#define HMICORE_WIDGETS_CANVAS_CANVAS_H_
15
16#include <cstdint>
17#include <string>
18#include <vector>
19
22
23namespace gva {
24
26class WidgetCanvas : public WidgetX {
27 public:
33 explicit WidgetCanvas(const RendererGva& renderer);
34
39 ~WidgetCanvas() override = default;
40
46 std::string GetWidgetName() const final { return "WidgetCanvas"; };
47
52 void Draw() override;
53
58 void DrawCanvas();
59
65 void SetMode(const SurfaceType mode);
66
72 SurfaceType GetMode() const;
73
78 void SetBlackout();
79
86 bool GetBlackout() const;
87
93 void SetFilename(const std::string_view filename);
94
100 void SetSurface(cairo_surface_t* surface);
101
106 void SetSurfaceDefault();
107
112 void Reset();
113
114 private:
115 SurfaceType mode_ = SurfaceType::kSurfaceNone;
116 std::string filename_ = "";
117 std::string message_ = "";
118 cairo_surface_t* surface_ = nullptr;
119 unsigned char* buffer_ = nullptr;
120};
121
122} // namespace gva
123
124#endif // HMICORE_WIDGETS_CANVAS_CANVAS_H_
Class definition of the GVA renderer.
Definition renderer_gva.h:29
Class defining the mode widget.
Definition canvas.h:26
void Reset()
Set to default background.
SurfaceType GetMode() const
Get the Mode object.
Definition canvas.cc:60
void SetSurfaceDefault()
Set the Surface to the default background.
Definition canvas.cc:72
void SetMode(const SurfaceType mode)
Set the Mode object.
Definition canvas.cc:54
void SetBlackout()
Set Blackout mode.
Definition canvas.cc:56
void SetFilename(const std::string_view filename)
Set the Filename attribute, canvas will show the image. Image will be rescaled to fit current resolut...
Definition canvas.cc:62
void SetSurface(cairo_surface_t *surface)
Set the canvas to surface.
Definition canvas.cc:67
void Draw() override
Draw the current widget, not final as used by video sources.
Definition canvas.cc:23
void DrawCanvas()
Draw the canvas.
Definition canvas.cc:29
bool GetBlackout() const
Get the Blackout attribute.
Definition canvas.cc:58
std::string GetWidgetName() const final
Get the Widget Name attribute.
Definition canvas.h:46
~WidgetCanvas() override=default
Destroy the Widget mode object.
Class defining the base widget.
Definition widget.h:27
SurfaceType
Enum for the surface types.
Definition gva.h:208