HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
sfloat_rg32.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2020-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 <algorithm>
14
15namespace hi::inline v1 {
16
22 alignas(sizeof(float) * 2)
23 // Red, Green in binary32 (native endian).
25
26public:
27 sfloat_rg32() = default;
28 sfloat_rg32(sfloat_rg32 const &rhs) noexcept = default;
29 sfloat_rg32(sfloat_rg32 &&rhs) noexcept = default;
30 sfloat_rg32 &operator=(sfloat_rg32 const &rhs) noexcept = default;
31 sfloat_rg32 &operator=(sfloat_rg32 &&rhs) noexcept = default;
32
33 explicit sfloat_rg32(f32x4 const &rhs) noexcept : v{rhs.r(), rhs.g()} {}
34
35 sfloat_rg32 &operator=(f32x4 const &rhs) noexcept
36 {
37 v = {rhs.r(), rhs.g()};
38 return *this;
39 }
40
41 explicit operator f32x4() const noexcept
42 {
43 return f32x4{std::get<0>(v), std::get<1>(v), 0.0f, 0.0f};
44 }
45
46 sfloat_rg32(extent2 const &rhs) noexcept : sfloat_rg32{static_cast<f32x4>(rhs)} {}
47 sfloat_rg32(scale2 const &rhs) noexcept : sfloat_rg32{static_cast<f32x4>(rhs)} {}
48 sfloat_rg32(vector2 const &rhs) noexcept : sfloat_rg32{static_cast<f32x4>(rhs)} {}
49 sfloat_rg32(point2 const &rhs) noexcept : sfloat_rg32{static_cast<f32x4>(rhs)} {}
50
51 [[nodiscard]] friend bool operator==(sfloat_rg32 const &lhs, sfloat_rg32 const &rhs) noexcept = default;
52};
53
54} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:13
2 x float32 pixel format.
Definition sfloat_rg32.hpp:21