HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
sfloat_rgba32.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2021.
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
9#pragma once
10
11#include "../SIMD/module.hpp"
12#include "../geometry/module.hpp"
13#include "../color/module.hpp"
14#include "../macros.hpp"
15#include <algorithm>
16
17namespace hi::inline v1 {
18
24 // Red, Green, Blue, Alpha in binary32 (native endian).
26
27public:
28 sfloat_rgba32() = default;
29 sfloat_rgba32(sfloat_rgba32 const &rhs) noexcept = default;
30 sfloat_rgba32(sfloat_rgba32 &&rhs) noexcept = default;
31 sfloat_rgba32 &operator=(sfloat_rgba32 const &rhs) noexcept = default;
32 sfloat_rgba32 &operator=(sfloat_rgba32 &&rhs) noexcept = default;
33
34 sfloat_rgba32(f32x4 const &rhs) noexcept : v(static_cast<std::array<float, 4>>(rhs)) {}
35
36 sfloat_rgba32 &operator=(f32x4 const &rhs) noexcept
37 {
38 v = static_cast<std::array<float, 4>>(rhs);
39 return *this;
40 }
41
42 operator f32x4() const noexcept
43 {
44 return f32x4{v};
45 }
46
47 sfloat_rgba32(point3 const &rhs) noexcept : sfloat_rgba32(f32x4{rhs}) {}
48
49 sfloat_rgba32(aarectangle const &rhs) noexcept : sfloat_rgba32(f32x4{rhs}) {}
50
51 sfloat_rgba32(corner_radii const &rhs) noexcept : sfloat_rgba32(f32x4{rhs}) {}
52
53 operator aarectangle() const noexcept
54 {
55 return aarectangle{f32x4{v}};
56 }
57
58 [[nodiscard]] friend bool operator==(sfloat_rgba32 const &lhs, sfloat_rgba32 const &rhs) noexcept = default;
59};
60
61} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:16
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
A high-level geometric point Part of the high-level vec, point, mat and color types.
Definition point3.hpp:27
4 x float32 pixel format.
Definition sfloat_rgba32.hpp:23