HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
hikogui
rapid
sfloat_rgba32.hpp
1
// Copyright Take Vos 2020.
2
// Distributed under the Boost Software License, Version 1.0.
3
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5
#pragma once
6
7
#include "numeric_array.hpp"
8
#include "../geometry/corner_radii.hpp"
9
#include "../geometry/axis_aligned_rectangle.hpp"
10
#include "../color/color.hpp"
11
#include <algorithm>
12
13
namespace
hi::inline v1 {
14
15
class
sfloat_rgba32
{
16
// Red, Green, Blue, Alpha in binary32 (native endian).
17
std::array<float, 4>
v;
18
19
public
:
20
sfloat_rgba32
() =
default
;
21
sfloat_rgba32
(
sfloat_rgba32
const
&rhs)
noexcept
=
default
;
22
sfloat_rgba32
(
sfloat_rgba32
&&rhs)
noexcept
=
default
;
23
sfloat_rgba32
&operator=(
sfloat_rgba32
const
&rhs)
noexcept
=
default
;
24
sfloat_rgba32
&operator=(
sfloat_rgba32
&&rhs)
noexcept
=
default
;
25
26
sfloat_rgba32
(
f32x4
const
&rhs) noexcept : v(
static_cast<
std::array<float, 4>
>
(rhs)) {}
27
28
sfloat_rgba32
&operator=(
f32x4
const
&rhs)
noexcept
29
{
30
v =
static_cast<
std::array<float, 4>
>
(rhs);
31
return
*
this
;
32
}
33
34
operator
f32x4
()
const
noexcept
35
{
36
return
f32x4
{v};
37
}
38
39
sfloat_rgba32
(
point3
const
&rhs) noexcept :
sfloat_rgba32
(
f32x4
{rhs}) {}
40
41
sfloat_rgba32
(
aarectangle
const
&rhs) noexcept :
sfloat_rgba32
(
f32x4
{rhs}) {}
42
43
sfloat_rgba32
(
corner_radii
const
&rhs) noexcept :
sfloat_rgba32
(
f32x4
{rhs}) {}
44
45
operator
aarectangle
()
const
noexcept
46
{
47
return
aarectangle
{
f32x4
{v}};
48
}
49
50
[[nodiscard]]
friend
bool
operator==(
sfloat_rgba32
const
&lhs,
sfloat_rgba32
const
&rhs)
noexcept
=
default
;
51
};
52
53
}
// namespace hi::inline v1
v1::axis_aligned_rectangle
Class which represents an axis-aligned rectangle.
Definition
axis_aligned_rectangle.hpp:20
v1::corner_radii
Definition
corner_radii.hpp:9
v1::geo::point< 3 >
v1::numeric_array< float, 4 >
v1::sfloat_rgba32
Definition
sfloat_rgba32.hpp:15
std::array
Generated on Mon Apr 22 2024 12:52:40 for HikoGUI by
1.10.0