xtd 0.2.0
Loading...
Searching...
No Matches
color_translator.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../drawing_export.hpp"
6#include "color.hpp"
7#include <xtd/static>
8#include <xtd/string>
9
11namespace xtd {
13 namespace drawing {
26 public:
28
35
41
47
53
59
66
72
78
84
89 static xtd::string to_hex(const xtd::drawing::color& value) noexcept;
94 static xtd::string to_hex(const xtd::drawing::color& value, bool auto_hexa) noexcept;
95
101 static xtd::string to_hsl(const xtd::drawing::color& value) noexcept;
107 static xtd::string to_hsl(const xtd::drawing::color& value, bool auto_alpha) noexcept;
108
113 static xtd::string to_hsla(const xtd::drawing::color& value) noexcept;
114
119 static xtd::string to_hsv(const xtd::drawing::color& value) noexcept;
125 static xtd::string to_hsv(const xtd::drawing::color& value, bool auto_hsva) noexcept;
126
131 static xtd::string to_hsva(const xtd::drawing::color& value) noexcept;
132
137 static xtd::string to_html(const xtd::drawing::color& value) noexcept;
138
143 static xtd::string to_rgb(const xtd::drawing::color& value) noexcept;
149 static xtd::string to_rgb(const xtd::drawing::color& value, bool auto_rgba) noexcept;
150
155 static xtd::string to_rgba(const xtd::drawing::color& value) noexcept;
156
160 static int32 to_win32(const xtd::drawing::color& value) noexcept;
161
162 private:
163 inline static constexpr int32 win32_red_shift = 0;
164 inline static constexpr int32 win32_green_shift = 8;
165 inline static constexpr int32 win32_blue_shift = 16;
166 static xtd::string from_name(const xtd::drawing::color& value);
167 static bool try_parse_hex_color(const xtd::string& text, xtd::drawing::color& result) noexcept;
168 static bool try_parse_hsl_color(const xtd::string& text, xtd::drawing::color& result) noexcept;
169 static bool try_parse_hsla_color(const xtd::string& text, xtd::drawing::color& result) noexcept;
170 static bool try_parse_hsv_color(const xtd::string& text, xtd::drawing::color& result) noexcept;
171 static bool try_parse_hsva_color(const xtd::string& text, xtd::drawing::color& result) noexcept;
172 static bool try_parse_html_color(const xtd::string& text, xtd::drawing::color& result) noexcept;
173 static bool try_parse_named_color(const xtd::string& text, xtd::drawing::color& result) noexcept;
174 static bool try_parse_rgb_color(const xtd::string& text, xtd::drawing::color& result) noexcept;
175 static bool try_parse_rgba_color(const xtd::string& text, xtd::drawing::color& result) noexcept;
177 };
178 }
179}
Represents text as a sequence of character units.
Definition basic_string.hpp:79
Translates colors to and from GDI+ xtd::drawing::color structures. This class cannot be inherited.
Definition color_translator.hpp:25
static xtd::drawing::color from_hsv(const xtd::string &text)
Translates an HSV color representation to a GDI+ xtd::drawing::color structure.
static xtd::string to_hex(const xtd::drawing::color &value, bool auto_hexa) noexcept
Translates the specified xtd::drawing::color structure to an HEX string color representation.
static xtd::string to_hsl(const xtd::drawing::color &value, bool auto_alpha) noexcept
Translates the specified xtd::drawing::color structure to an HSL string color representation.
static xtd::string to_hex(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HEX string color representation.
static xtd::string to_rgb(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an RGB string color representation.
static xtd::string to_hsla(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HSLA string color representation.
static xtd::drawing::color from_win32(int32 value)
Translates a Win32 color representation to a GDI+ xtd::drawing::color structure.
static xtd::drawing::color from_html(const xtd::string &text)
Translates an HTML color representation to a GDI+ xtd::drawing::color structure.
static xtd::string to_rgb(const xtd::drawing::color &value, bool auto_rgba) noexcept
Translates the specified xtd::drawing::color structure to an RGB string color representation.
static xtd::string to_rgba(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an RGBA string color representation.
static xtd::drawing::color from_hex(const xtd::string &text)
Translates an HEX color representation to a GDI+ xtd::drawing::color structure.
static xtd::string to_hsl(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HSL string color representation.
static xtd::drawing::color from_hsva(const xtd::string &text)
Translates an HSVVA color representation to a GDI+ xtd::drawing::color structure.
static xtd::string to_hsva(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HSVA string color representation.
static int32 to_win32(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to a Windows color.
static xtd::string to_hsv(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HSV string color representation.
static xtd::drawing::color from_hsla(const xtd::string &text)
Translates an HSLA color representation to a GDI+ xtd::drawing::color structure.
static xtd::string to_hsv(const xtd::drawing::color &value, bool auto_hsva) noexcept
Translates the specified xtd::drawing::color structure to an HSV string color representation.
static xtd::string to_html(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HTML string color representation.
static xtd::drawing::color from_rgb(const xtd::string &text)
Translates an RGB color representation to a GDI+ xtd::drawing::color structure.
static xtd::drawing::color from_rgba(const xtd::string &text)
Translates an RGBA color representation to a GDI+ xtd::drawing::color structure.
static xtd::drawing::color from_hsl(const xtd::string &text)
Translates an HSL color representation to a GDI+ xtd::drawing::color structure.
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:49
Contains xtd::drawing::color class.
#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:37
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10