openMSX
OSDRectangle.hh
Go to the documentation of this file.
1#ifndef OSDRECTANGLE_HH
2#define OSDRECTANGLE_HH
3
5#include "stl.hh"
6#include <array>
7#include <cstdint>
8#include <memory>
9
10namespace openmsx {
11
12class GLImage;
13
15{
16protected:
17 static constexpr auto rectangleProperties = [] {
18 using namespace std::literals;
19 return concatArray(
21 std::array{
22 "-w"sv, "-h"sv, "-relw"sv, "-relh"sv,
23 "-scale"sv, "-image"sv,
24 "-bordersize"sv, "-relbordersize"sv,
25 "-borderrgba"sv,
26 });
27 }();
28
29public:
30 OSDRectangle(Display& display, const TclObject& name);
31
32 [[nodiscard]] std::span<const std::string_view> getProperties() const override {
34 }
35 void setProperty(Interpreter& interp,
36 std::string_view name, const TclObject& value) override;
37 void getProperty(std::string_view name, TclObject& result) const override;
38 [[nodiscard]] std::string_view getType() const override;
39
40private:
41 [[nodiscard]] bool takeImageDimensions() const;
42
43 [[nodiscard]] gl::vec2 getSize(const OutputSurface& output) const override;
44 [[nodiscard]] uint8_t getFadedAlpha() const override;
45 [[nodiscard]] std::unique_ptr<GLImage> create(OutputSurface& output) override;
46
47private:
48 std::string imageName;
49 gl::vec2 size, relSize;
50 float scale = 1.0f;
51 float borderSize = 0.0f;
52 float relBorderSize = 0.0f;
53 uint32_t borderRGBA = 0x000000ff;
54};
55
56} // namespace openmsx
57
58#endif
Represents the output window/screen of openMSX.
Definition Display.hh:32
static constexpr auto imageBasedProperties
void getProperty(std::string_view name, TclObject &result) const override
std::span< const std::string_view > getProperties() const override
static constexpr auto rectangleProperties
void setProperty(Interpreter &interp, std::string_view name, const TclObject &value) override
std::string_view getType() const override
A frame buffer where pixels can be written to.
This file implemented 3 utility functions:
Definition Autofire.cc:9
constexpr auto concatArray(const std::array< T, X > &x, const std::array< T, Y > &y)
Definition stl.hh:390