HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
ImageWidget.hpp
1// Copyright 2019 Pokitec
2// All rights reserved.
3
4#pragma once
5
6#include "TTauri/Widgets/Widget.hpp"
7#include "TTauri/Foundation/Path.hpp"
8#include <memory>
9#include <string>
10#include <array>
11
12namespace tt {
13struct Path;
14}
15
16namespace tt {
17
18class ImageWidget : public Widget {
19public:
20
22
23 ImageWidget(Window &window, Widget *parent, PixelMap<R16G16B16A16SFloat> image) noexcept;
24 ~ImageWidget() {}
25
26 ImageWidget(const ImageWidget &) = delete;
27 ImageWidget &operator=(const ImageWidget &) = delete;
28 ImageWidget(ImageWidget &&) = delete;
29 ImageWidget &operator=(ImageWidget &&) = delete;
30
31 void layout(hires_utc_clock::time_point displayTimePoint) noexcept override;
32 void draw(DrawContext const &drawContext, hires_utc_clock::time_point displayTimePoint) noexcept override;
33
34 void handleMouseEvent(MouseEvent const &event) noexcept override;
35 [[nodiscard]] HitBox hitBoxTest(vec position) const noexcept override;
36
37private:
38 std::tuple<aarect, aarect, aarect, aarect> getButtonRectangles() const noexcept;
39
40 PixelMap<R16G16B16A16SFloat> drawApplicationIconImage(PipelineImage::Image &image) noexcept;
41 PixelMap<R16G16B16A16SFloat> drawTrafficLightsImage(PipelineImage::Image &image) noexcept;
42
43 static void drawCross(Path &path, vec position, float radius) noexcept;
44 static void drawTrianglesOutward(Path &path, vec position, float radius) noexcept;
45 static void drawTrianglesInward(Path &path, vec position, float radius) noexcept;
46
47 PipelineImage::Backing::ImagePixelMap drawImage(std::shared_ptr<PipelineImage::Image> image) noexcept;
48
49 PipelineImage::Backing backingImage;
50};
51
52}
STL namespace.
An image, in different formats.
Definition Image.hpp:18
A 2D canvas of pixels.
Definition PixelMap.hpp:83
Definition Path.hpp:29
Definition R16G16B16A16SFloat.hpp:15
A 4D vector.
Definition vec.hpp:37
Draw context for drawing using the TTauri shaders.
Definition DrawContext.hpp:30
Definition HitBox.hpp:12
Definition MouseEvent.hpp:12
Definition Window_vulkan_win32.hpp:15
Definition ImageWidget.hpp:18
void handleMouseEvent(MouseEvent const &event) noexcept override
HitBox hitBoxTest(vec position) const noexcept override
Find the widget that is under the mouse cursor.
void layout(hires_utc_clock::time_point displayTimePoint) noexcept override
Layout the widget.
void draw(DrawContext const &drawContext, hires_utc_clock::time_point displayTimePoint) noexcept override
Draw widget.
Definition Widget.hpp:64