HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
hikogui
image
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 "../geometry/geometry.hpp"
12
#include "../macros.hpp"
13
#include <hikocpu/hikocpu.hpp>
14
#include <algorithm>
15
#include <array>
16
#include <bit>
17
#include <cstdint>
18
19
hi_export_module(hikogui.image.sfloat_rg32);
20
21
hi_export
namespace
hi::inline
v1
{
22
27
class
sfloat_rg32
{
28
alignas
(
sizeof
(float) * 2)
29
// Red, Green in binary32 (native endian).
30
std::array<float, 2>
v;
31
32
public
:
33
sfloat_rg32
() =
default
;
34
sfloat_rg32
(
sfloat_rg32
const
&rhs)
noexcept
=
default
;
35
sfloat_rg32
(
sfloat_rg32
&&rhs)
noexcept
=
default
;
36
sfloat_rg32
&operator=(
sfloat_rg32
const
&rhs)
noexcept
=
default
;
37
sfloat_rg32
&operator=(
sfloat_rg32
&&rhs)
noexcept
=
default
;
38
39
constexpr
sfloat_rg32
(
float
x,
float
y) noexcept : v{x, y} {}
40
41
explicit
sfloat_rg32
(f32x4
const
&rhs) noexcept : v{rhs.r(), rhs.g()} {}
42
43
sfloat_rg32
&operator=(f32x4
const
&rhs)
noexcept
44
{
45
v = {rhs.r(), rhs.g()};
46
return
*
this
;
47
}
48
49
explicit
operator
f32x4()
const
noexcept
50
{
51
return
f32x4{std::get<0>(v), std::get<1>(v), 0.0f, 0.0f};
52
}
53
54
sfloat_rg32
(extent2
const
&rhs) noexcept :
sfloat_rg32
{
static_cast<
f32x4
>
(rhs)} {}
55
sfloat_rg32
(scale2
const
&rhs) noexcept :
sfloat_rg32
{
static_cast<
f32x4
>
(rhs)} {}
56
sfloat_rg32
(vector2
const
&rhs) noexcept :
sfloat_rg32
{
static_cast<
f32x4
>
(rhs)} {}
57
sfloat_rg32
(
point2
const
&rhs) noexcept :
sfloat_rg32
{
static_cast<
f32x4
>
(rhs)} {}
58
59
[[nodiscard]]
friend
bool
operator==(
sfloat_rg32
const
&lhs,
sfloat_rg32
const
&rhs)
noexcept
=
default
;
60
};
61
62
}
// namespace hi::inline v1
v1
DOXYGEN BUG.
Definition
algorithm_misc.hpp:20
v1::point2
A high-level geometric point Part of the high-level vec, point, mat and color types.
Definition
point2.hpp:28
v1::sfloat_rg32
2 x float32 pixel format.
Definition
sfloat_rg32.hpp:27
std::array
Generated on Mon Apr 22 2024 12:51:37 for HikoGUI by
1.10.0