xtd 0.2.0
Loading...
Searching...
No Matches
color_translator.h
Go to the documentation of this file.
1
4#pragma once
5#include "../drawing_export.h"
6#include "color.h"
7#include <xtd/static>
8#include <xtd/ustring>
9
11namespace xtd {
13 namespace drawing {
26 public:
28
35
41
47
53
59
66
72
78
84
89 static xtd::ustring to_hex(const xtd::drawing::color& value) noexcept;
94 static xtd::ustring to_hex(const xtd::drawing::color& value, bool auto_hexa) noexcept;
95
101 static xtd::ustring to_hsl(const xtd::drawing::color& value) noexcept;
107 static xtd::ustring to_hsl(const xtd::drawing::color& value, bool auto_alpha) noexcept;
108
113 static xtd::ustring to_hsla(const xtd::drawing::color& value) noexcept;
114
119 static xtd::ustring to_hsv(const xtd::drawing::color& value) noexcept;
125 static xtd::ustring to_hsv(const xtd::drawing::color& value, bool auto_hsva) noexcept;
126
131 static xtd::ustring to_hsva(const xtd::drawing::color& value) noexcept;
132
137 static xtd::ustring to_html(const xtd::drawing::color& value) noexcept;
138
143 static xtd::ustring to_rgb(const xtd::drawing::color& value) noexcept;
149 static xtd::ustring to_rgb(const xtd::drawing::color& value, bool auto_rgba) noexcept;
150
155 static xtd::ustring 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::ustring from_name(const xtd::drawing::color& value);
167 static bool try_parse_hex_color(const xtd::ustring& text, xtd::drawing::color& result) noexcept;
168 static bool try_parse_hsl_color(const xtd::ustring& text, xtd::drawing::color& result) noexcept;
169 static bool try_parse_hsla_color(const xtd::ustring& text, xtd::drawing::color& result) noexcept;
170 static bool try_parse_hsv_color(const xtd::ustring& text, xtd::drawing::color& result) noexcept;
171 static bool try_parse_hsva_color(const xtd::ustring& text, xtd::drawing::color& result) noexcept;
172 static bool try_parse_html_color(const xtd::ustring& text, xtd::drawing::color& result) noexcept;
173 static bool try_parse_named_color(const xtd::ustring& text, xtd::drawing::color& result) noexcept;
174 static bool try_parse_rgb_color(const xtd::ustring& text, xtd::drawing::color& result) noexcept;
175 static bool try_parse_rgba_color(const xtd::ustring& text, xtd::drawing::color& result) noexcept;
177 };
178 }
179}
Translates colors to and from GDI+ xtd::drawing::color structures. This class cannot be inherited.
Definition color_translator.h:25
static xtd::drawing::color from_rgba(const xtd::ustring &text)
Translates an RGBA color representation to a GDI+ xtd::drawing::color structure.
static xtd::drawing::color from_rgb(const xtd::ustring &text)
Translates an RGB color representation to a GDI+ xtd::drawing::color structure.
static xtd::ustring 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_hsv(const xtd::ustring &text)
Translates an HSV color representation to a GDI+ xtd::drawing::color structure.
static xtd::drawing::color from_hex(const xtd::ustring &text)
Translates an HEX color representation to a GDI+ xtd::drawing::color structure.
static xtd::drawing::color from_win32(int32 value)
Translates a Win32 color representation to a GDI+ xtd::drawing::color structure.
static xtd::ustring 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_hsva(const xtd::ustring &text)
Translates an HSVVA color representation to a GDI+ xtd::drawing::color structure.
static xtd::ustring to_hsl(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HSL string color representation.
static xtd::ustring 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::ustring 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::drawing::color from_hsl(const xtd::ustring &text)
Translates an HSL color representation to a GDI+ xtd::drawing::color structure.
static int32 to_win32(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to a Windows color.
static xtd::ustring to_hsla(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HSLA string color representation.
static xtd::ustring to_rgb(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an RGB string color representation.
static xtd::ustring to_hsva(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HSVA string color representation.
static xtd::ustring to_hsv(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HSV string color representation.
static xtd::ustring to_hex(const xtd::drawing::color &value) noexcept
Translates the specified xtd::drawing::color structure to an HEX string color representation.
static xtd::drawing::color from_hsla(const xtd::ustring &text)
Translates an HSLA color representation to a GDI+ xtd::drawing::color structure.
static xtd::drawing::color from_html(const xtd::ustring &text)
Translates an HTML color representation to a GDI+ xtd::drawing::color structure.
static xtd::ustring 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::ustring to_rgb(const xtd::drawing::color &value, bool auto_rgba) noexcept
Translates the specified xtd::drawing::color structure to an RGB string color representation.
Represents an ARGB (alpha, red, green, blue) color.
Definition color.h:49
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Contains xtd::drawing::color class.
#define drawing_export_
Define shared library export.
Definition drawing_export.h:13
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:37
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10