HikoGUI
Select Version:
main (latest dev)
0.8.1 (latest)
0.8.0
0.7.0
0.6.0
0.5.1
0.5.0
0.4.0
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0
theme-value
theme-tag
text
ranged-int
phrase-mask-chars
new-window-widget
msvs-bug-20230517
msvs-bug-20230503
msvs-bug-20230428
msvc-c1001-20231106
msvc-bug-20230706
msvc-bug-20221214
modules-part1
label-delegate
bug-msvs-20220928
attribute-parser
⚠️ This documents the
main
development branch of HikoGUI. It might differ from release versions.
A low latency retained GUI
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Variables
c
d
g
i
l
o
p
r
s
t
x
Typedefs
Enumerations
a
b
c
d
f
g
h
k
l
p
s
t
u
v
w
Concepts
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Related Symbols
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
Files
File List
Globals
All
Functions
Macros
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
src
hikogui
image
srgb_abgr8_pack.hpp
Go to the documentation of this file.
1
// Copyright Take Vos 2020-2022.
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 "
sfloat_rgba16.hpp
"
12
#include "
../color/color.hpp
"
13
#include "../macros.hpp"
14
#include <algorithm>
15
#include <array>
16
#include <bit>
17
#include <cstdint>
18
19
hi_export_module(hikogui.image.srgb_abgr8_pack);
20
21
hi_export
namespace
hi::inline
v1
{
22
27
class
srgb_abgr8_pack
{
28
uint32_t v = {};
29
30
public
:
31
constexpr
srgb_abgr8_pack
() =
default
;
32
constexpr
srgb_abgr8_pack
(
srgb_abgr8_pack
const
&rhs)
noexcept
=
default
;
33
constexpr
srgb_abgr8_pack
(
srgb_abgr8_pack
&&rhs)
noexcept
=
default
;
34
constexpr
srgb_abgr8_pack
&operator=(
srgb_abgr8_pack
const
&rhs)
noexcept
=
default
;
35
constexpr
srgb_abgr8_pack
&operator=(
srgb_abgr8_pack
&&rhs)
noexcept
=
default
;
36
37
constexpr
srgb_abgr8_pack
(uint32_t
const
&rhs) noexcept : v(rhs) {}
38
constexpr
srgb_abgr8_pack
&operator=(uint32_t
const
&rhs)
noexcept
39
{
40
v = rhs;
41
return
*
this
;
42
}
43
constexpr
operator
uint32_t()
noexcept
44
{
45
return
v;
46
}
47
48
//constexpr srgb_abgr8_pack(sfloat_rgba16 const &rhs) noexcept
49
//{
50
// auto const &rhs_v = rhs.get();
51
//
52
// auto const r = sRGB_linear16_to_gamma8(rhs_v[0].get());
53
// auto const g = sRGB_linear16_to_gamma8(rhs_v[1].get());
54
// auto const b = sRGB_linear16_to_gamma8(rhs_v[2].get());
55
// auto const a = static_cast<uint8_t>(std::clamp(rhs_v[3] * 255.0f, 0.0f, 255.0f));
56
// v = (static_cast<uint32_t>(a) << 24) | (static_cast<uint32_t>(b) << 16) | (static_cast<uint32_t>(g) << 8) |
57
// static_cast<uint32_t>(r);
58
//}
59
60
//constexpr srgb_abgr8_pack &operator=(sfloat_rgba16 const &rhs) noexcept
61
//{
62
// auto const &rhs_v = rhs.get();
63
//
64
// auto const r = sRGB_linear16_to_gamma8(rhs_v[0]);
65
// auto const g = sRGB_linear16_to_gamma8(rhs_v[1]);
66
// auto const b = sRGB_linear16_to_gamma8(rhs_v[2]);
67
// auto const a = static_cast<uint8_t>(std::clamp(rhs_v[3] * 255.0f, 0.0f, 255.0f));
68
// v = (static_cast<uint32_t>(a) << 24) | (static_cast<uint32_t>(b) << 16) | (static_cast<uint32_t>(g) << 8) |
69
// static_cast<uint32_t>(r);
70
// return *this;
71
//}
72
73
[[nodiscard]]
constexpr
friend
bool
operator==(
srgb_abgr8_pack
const
&lhs,
srgb_abgr8_pack
const
&rhs)
noexcept
=
default
;
74
75
[[nodiscard]]
constexpr
friend
srgb_abgr8_pack
makeTransparent(
srgb_abgr8_pack
const
&rhs)
noexcept
76
{
77
return
{rhs.v & 0x00ffffff};
78
}
79
};
27
class
srgb_abgr8_pack
{
…
};
80
81
//inline void fill(pixmap<srgb_abgr8_pack> &dst, pixmap<sfloat_rgba16> const &src) noexcept
82
//{
83
// hi_assert(dst.width >= src.width);
84
// hi_assert(dst.height >= src.height);
85
//
86
// for (auto rowNr = 0; rowNr < src.height; rowNr++) {
87
// auto const srcRow = src.at(rowNr);
88
// auto dstRow = dst.at(rowNr);
89
// for (auto columnNr = 0; columnNr < src.width; columnNr++) {
90
// dstRow[columnNr] = srcRow[columnNr];
91
// }
92
// }
93
//}
94
95
}
// namespace hi::inline v1
sfloat_rgba16.hpp
Defines the sfloat_rgba16.
color.hpp
Defined the color type.
v1
DOXYGEN BUG.
Definition
algorithm_misc.hpp:20
v1::srgb_abgr8_pack
4 x uint8_t pixel packed format with sRGB transfer function.
Definition
srgb_abgr8_pack.hpp:27
Generated on Mon Apr 22 2024 12:51:37 for HikoGUI by
1.10.0