AUI Framework
master
Cross-platform module-based framework for developing C++20 desktop applications
ABrush.h
1
/*
2
* AUI Framework - Declarative UI toolkit for modern C++20
3
* Copyright (C) 2020-2024 Alex2772 and Contributors
4
*
5
* SPDX-License-Identifier: MPL-2.0
6
*
7
* This Source Code Form is subject to the terms of the Mozilla Public
8
* License, v. 2.0. If a copy of the MPL was not distributed with this
9
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
*/
11
12
//
13
// Created by Alex2772 on 11/18/2021.
14
//
15
16
#pragma once
17
18
19
#include <span>
20
#include <variant>
21
#include <AUI/Common/AColor.h>
22
#include <AUI/Common/ASmallVector.h>
23
#include <AUI/Enum/Repeat.h>
24
#include "AUI/Enum/ImageRendering.h"
25
#include "AUI/Util/AAngleRadians.h"
26
#include "AUI/Traits/values.h"
27
28
32
struct
ASolidBrush
{
33
AColor
solidColor = AColor::WHITE;
34
};
35
36
40
struct
ACustomShaderBrush
{
41
42
};
43
44
48
struct
ALinearGradientBrush
{
49
struct
ColorEntry
{
50
aui::float_within_0_1
position;
51
AColor
color;
52
};
53
AVector<ColorEntry>
colors;
54
62
AAngleRadians
rotation
= 180_deg;
63
};
64
65
class
ITexture
;
66
70
struct
ATexturedBrush
{
71
_<ITexture>
texture;
72
80
AOptional<glm::vec2>
uv1
;
81
89
AOptional<glm::vec2>
uv2
;
90
98
ImageRendering
imageRendering
= ImageRendering::PIXELATED;
99
103
Repeat
repeat
= Repeat::NONE;
104
};
105
106
110
using
ABrush = std::variant<
ASolidBrush
,
111
ALinearGradientBrush
,
112
ATexturedBrush
,
113
ACustomShaderBrush
>;
AAngleRadians
Strong type used to store angle in radians.
Definition:
AAngleRadians.h:42
AColor
Represents a 4-component floating point color.
Definition:
AColor.h:27
AOptional
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition:
AOptional.h:32
AVector
A std::vector with AUI extensions.
Definition:
AVector.h:38
ITexture
Renderer-friendly image representation.
Definition:
ITexture.h:20
_
An std::weak_ptr with AUI extensions.
Definition:
SharedPtrTypes.h:177
ImageRendering
ImageRendering
Controls the image rendering type.
Definition:
ImageRendering.h:26
ACustomShaderBrush
Definition:
ABrush.h:40
ALinearGradientBrush::ColorEntry
Definition:
ABrush.h:49
ALinearGradientBrush
Definition:
ABrush.h:48
ALinearGradientBrush::rotation
AAngleRadians rotation
Clockwise gradient angle.
Definition:
ABrush.h:62
ASolidBrush
Definition:
ABrush.h:32
ATexturedBrush
Definition:
ABrush.h:70
ATexturedBrush::uv2
AOptional< glm::vec2 > uv2
Definition:
ABrush.h:89
ATexturedBrush::uv1
AOptional< glm::vec2 > uv1
Definition:
ABrush.h:80
ATexturedBrush::repeat
Repeat repeat
Definition:
ABrush.h:103
ATexturedBrush::imageRendering
ImageRendering imageRendering
Definition:
ABrush.h:98
aui::ranged_number
Clamps the possible values for a number to the specified range: [min;max].
Definition:
values.h:452