xtd
1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
xtd.drawing
include
xtd
drawing
argb.hpp
Go to the documentation of this file.
1
4
#pragma once
5
#include <xtd/byte>
6
#include <xtd/string>
7
#include <xtd/uint32>
8
10
namespace
xtd
{
12
namespace
drawing
{
22
struct
argb
{
24
28
xtd::byte
a
= 255;
31
xtd::byte
r
= 0;
34
xtd::byte
g
= 0;
37
xtd::byte
b
= 0;
39
41
45
[[nodiscard]]
auto
to_uint32
() const noexcept ->
xtd
::
uint32
{
46
return
(
static_cast<
xtd::uint32
>
(
a
) << 24) + (
static_cast<
xtd::uint32
>
(
r
) << 16) + (
static_cast<
xtd::uint32
>
(
g
) << 8) +
static_cast<
xtd::uint32
>
(
b
);
47
}
48
49
51
55
[[nodiscard]]
operator
xtd::uint32
() const noexcept {
56
return
to_uint32
();
57
}
58
59
61
69
[[nodiscard]]
static
auto
from_argb
(
xtd::byte
a
,
xtd::byte
r
,
xtd::byte
g
,
xtd::byte
b
)
noexcept
->
xtd::drawing::argb
{
70
return
argb
{.a =
a
, .r =
r
, .g =
g
, .b =
b
};
71
}
72
75
[[nodiscard]]
static
auto
from_argb
(
const
argb
& value)
noexcept
->
xtd::drawing::argb
{
76
return
value;
77
}
78
82
[[nodiscard]]
static
auto
from_uint32
(
uint32
value)
noexcept
->
xtd::drawing::argb
{
83
return
argb
{.a =
static_cast<
xtd::byte
>
((value & 0xFF000000) >> 24), .
r
=
static_cast<
xtd::byte
>
((value & 0x00FF0000) >> 16), .g =
static_cast<
xtd::byte
>
((value & 0x0000FF00) >> 8), .
b
=
static_cast<
xtd::byte
>
(value & 0x000000FF)};
84
}
85
86
88
friend
auto
operator <<(std::ostream& os,
const
argb
& value) -> std::ostream& {
89
return
os <<
xtd::string::format
(
"argb [a = {}, r = {}, g = {}, b = {}]"
, value.a, value.r, value.g, value.b);
90
};
92
};
93
}
94
}
xtd::basic_string< char >::format
static auto format(const basic_string< char > &fmt, args_t &&... args) -> basic_string
xtd::uint32
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition
uint32.hpp:23
xtd::byte
std::uint8_t byte
Represents a 8-bit unsigned integer.
Definition
byte.hpp:23
xtd::drawing
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition
actions_system_images.hpp:10
xtd
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition
abstract_object.hpp:8
xtd::drawing::argb
The argb struct.
Definition
argb.hpp:22
xtd::drawing::argb::from_argb
static auto from_argb(const argb &value) noexcept -> xtd::drawing::argb
Creates a xtd::argb struct from the specified axtd::drawing::argb value.
Definition
argb.hpp:75
xtd::drawing::argb::from_argb
static auto from_argb(xtd::byte a, xtd::byte r, xtd::byte g, xtd::byte b) noexcept -> xtd::drawing::argb
Creates a xtd::argb struct from the specified a, r, g, and b byte values.
Definition
argb.hpp:69
xtd::drawing::argb::to_uint32
auto to_uint32() const noexcept -> xtd::uint32
Gets the 32-bit ARGB value of this xtd::drawing::argb struct.
Definition
argb.hpp:45
xtd::drawing::argb::from_uint32
static auto from_uint32(uint32 value) noexcept -> xtd::drawing::argb
Creates a xtd::argb struct from the specified unsigned integer value.
Definition
argb.hpp:82
xtd::drawing::argb::a
xtd::byte a
Gets or sets the alpha component value of this xtd::drawing::argb struct.
Definition
argb.hpp:28
xtd::drawing::argb::uint32
operator xtd::uint32() const noexcept
Gets the 32-bit ARGB value of this xtd::drawing::argb struct.
Definition
argb.hpp:55
xtd::drawing::argb::g
xtd::byte g
Gets or sets the green component value of this xtd::drawing::argb struct.
Definition
argb.hpp:34
xtd::drawing::argb::r
xtd::byte r
Gets or sets the red component value of this xtd::drawing::argb struct.
Definition
argb.hpp:31
xtd::drawing::argb::b
xtd::byte b
Gets or sets the blue component value of this xtd::drawing::argb struct.
Definition
argb.hpp:37
Generated on
for xtd by
Gammasoft
. All rights reserved.