xtd 1.0.0
Loading...
Searching...
No Matches
color_translator.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "color.hpp"
7#include <xtd/static>
8#include <xtd/string>
9
11namespace xtd {
13 namespace drawing {
26 public:
28
34 [[nodiscard]] static auto from_cmyk(const xtd::string& text) -> xtd::drawing::color;
35
40 [[nodiscard]] static auto from_cmyka(const xtd::string& text) -> xtd::drawing::color;
41
46 [[nodiscard]] static auto from_hex(const xtd::string& text) -> xtd::drawing::color;
47
52 [[nodiscard]] static auto from_hsl(const xtd::string& text) -> xtd::drawing::color;
53
58 [[nodiscard]] static auto from_hsla(const xtd::string& text) -> xtd::drawing::color;
59
64 [[nodiscard]] static auto from_hsv(const xtd::string& text) -> xtd::drawing::color;
65
70 [[nodiscard]] static auto from_hsva(const xtd::string& text) -> xtd::drawing::color;
71
77 [[nodiscard]] static auto from_html(const xtd::string& text) -> xtd::drawing::color;
78
83 [[nodiscard]] static auto from_rgb(const xtd::string& text) -> xtd::drawing::color;
84
89 [[nodiscard]] static auto from_rgba(const xtd::string& text) -> xtd::drawing::color;
90
95 [[nodiscard]] static auto from_win32(const xtd::string& text) -> xtd::drawing::color;
100 [[nodiscard]] static auto from_win32(int32 value) -> xtd::drawing::color;
101
106 [[nodiscard]] static auto to_cmyk(const xtd::drawing::color& value) noexcept -> xtd::string;
112 [[nodiscard]] static auto to_cmyk(const xtd::drawing::color& value, bool auto_cmyk) noexcept -> xtd::string;
113
118 [[nodiscard]] static auto to_cmyka(const xtd::drawing::color& value) noexcept -> xtd::string;
119
124 [[nodiscard]] static auto to_hex(const xtd::drawing::color& value) noexcept -> xtd::string;
129 [[nodiscard]] static auto to_hex(const xtd::drawing::color& value, bool auto_hexa) noexcept -> xtd::string;
130
135 [[nodiscard]] static auto to_hsl(const xtd::drawing::color& value) noexcept -> xtd::string;
141 [[nodiscard]] static auto to_hsl(const xtd::drawing::color& value, bool auto_hsla) noexcept -> xtd::string;
142
147 [[nodiscard]] static auto to_hsla(const xtd::drawing::color& value) noexcept -> xtd::string;
148
153 [[nodiscard]] static auto to_hsv(const xtd::drawing::color& value) noexcept -> xtd::string;
159 [[nodiscard]] static auto to_hsv(const xtd::drawing::color& value, bool auto_hsva) noexcept -> xtd::string;
160
165 [[nodiscard]] static auto to_hsva(const xtd::drawing::color& value) noexcept -> xtd::string;
166
171 [[nodiscard]] static auto to_html(const xtd::drawing::color& value) noexcept -> xtd::string;
172
177 [[nodiscard]] static auto to_rgb(const xtd::drawing::color& value) noexcept -> xtd::string;
183 [[nodiscard]] static auto to_rgb(const xtd::drawing::color& value, bool auto_rgba) noexcept -> xtd::string;
184
189 [[nodiscard]] static auto to_rgba(const xtd::drawing::color& value) noexcept -> xtd::string;
190
194 [[nodiscard]] static auto to_win32(const xtd::drawing::color& value) noexcept -> xtd::int32;
195
196 private:
197 inline static constexpr int32 win32_red_shift = 0;
198 inline static constexpr int32 win32_green_shift = 8;
199 inline static constexpr int32 win32_blue_shift = 16;
200 [[nodiscard]] static auto from_name(const xtd::drawing::color& value) -> xtd::string;
201 [[nodiscard]] static auto try_parse_cmyk_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
202 [[nodiscard]] static auto try_parse_cmyka_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
203 [[nodiscard]] static auto try_parse_hex_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
204 [[nodiscard]] static auto try_parse_hsl_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
205 [[nodiscard]] static auto try_parse_hsla_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
206 [[nodiscard]] static auto try_parse_hsv_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
207 [[nodiscard]] static auto try_parse_hsva_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
208 [[nodiscard]] static auto try_parse_html_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
209 [[nodiscard]] static auto try_parse_named_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
210 [[nodiscard]] static auto try_parse_rgb_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
211 [[nodiscard]] static auto try_parse_rgba_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
212 [[nodiscard]] static auto try_parse_win32_color(const xtd::string& text, xtd::drawing::color& result) noexcept -> bool;
214 };
215 }
216}
Translates colors to and from GDI+ xtd::drawing::color structures. This class cannot be inherited.
Definition color_translator.hpp:25
static auto to_hsv(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HSV string color representation.
static auto to_hsl(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HSL string color representation.
static auto to_rgb(const xtd::drawing::color &value, bool auto_rgba) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an RGB string color representation.
static auto from_hsva(const xtd::string &text) -> xtd::drawing::color
Translates an HSVVA color representation to a GDI+ xtd::drawing::color structure.
static auto to_cmyka(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HSLA string color representation.
static auto from_rgba(const xtd::string &text) -> xtd::drawing::color
Translates an RGBA color representation to a GDI+ xtd::drawing::color structure.
static auto from_rgb(const xtd::string &text) -> xtd::drawing::color
Translates an RGB color representation to a GDI+ xtd::drawing::color structure.
static auto from_hsv(const xtd::string &text) -> xtd::drawing::color
Translates an HSV color representation to a GDI+ xtd::drawing::color structure.
static auto from_cmyka(const xtd::string &text) -> xtd::drawing::color
Translates an CMYKA color representation to a GDI+ xtd::drawing::color structure.
static auto to_hsv(const xtd::drawing::color &value, bool auto_hsva) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HSV string color representation.
static auto to_hsl(const xtd::drawing::color &value, bool auto_hsla) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HSL string color representation.
static auto to_hex(const xtd::drawing::color &value, bool auto_hexa) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HEX string color representation.
static auto to_rgb(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an RGB string color representation.
static auto to_hex(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HEX string color representation.
static auto to_html(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HTML string color representation.
static auto from_win32(const xtd::string &text) -> xtd::drawing::color
Translates a Win32 color representation to a GDI+ xtd::drawing::color structure.
static auto from_win32(int32 value) -> xtd::drawing::color
Translates a Win32 color representation to a GDI+ xtd::drawing::color structure.
static auto to_cmyk(const xtd::drawing::color &value, bool auto_cmyk) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an CMYK string color representation.
static auto to_rgba(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an RGBA string color representation.
static auto from_hsl(const xtd::string &text) -> xtd::drawing::color
Translates an HSL color representation to a GDI+ xtd::drawing::color structure.
static auto to_hsva(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HSVA string color representation.
static auto from_hsla(const xtd::string &text) -> xtd::drawing::color
Translates an HSLA color representation to a GDI+ xtd::drawing::color structure.
static auto from_hex(const xtd::string &text) -> xtd::drawing::color
Translates an HEX color representation to a GDI+ xtd::drawing::color structure.
static auto to_win32(const xtd::drawing::color &value) noexcept -> xtd::int32
Translates the specified xtd::drawing::color structure to a Windows color.
static auto from_html(const xtd::string &text) -> xtd::drawing::color
Translates an HTML color representation to a GDI+ xtd::drawing::color structure.
static auto to_hsla(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an HSLA string color representation.
static auto from_cmyk(const xtd::string &text) -> xtd::drawing::color
Translates an CMYK color representation to a GDI+ xtd::drawing::color structure.
static auto to_cmyk(const xtd::drawing::color &value) noexcept -> xtd::string
Translates the specified xtd::drawing::color structure to an CMYK string color representation.
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:52
Contains xtd::drawing::color class.
Contains drawing_export_ keyword.
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:38
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
The xtd::drawing::text namespace provides advanced GDI+ typography functionality.
Definition font_collection.hpp:14
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8