Add support CSS color text for class nana::color

This commit is contained in:
cnjinhao
2015-02-06 01:45:17 +08:00
parent fd5ff571a7
commit 81a50fd84f
6 changed files with 267 additions and 19 deletions

View File

@@ -306,8 +306,16 @@ namespace nana
color(unsigned red, unsigned green, unsigned blue);
color(unsigned red, unsigned green, unsigned blue, double alpha);
/// Initializes the color with a CSS-like rgb string.
color(std::string css_rgb);
color& alpha(double); ///< Sets alpha channel
color& from_rgb(unsigned red, unsigned green, unsigned blue); ///< immutable alpha channel
/// Sets color with a HSL value.
/// @param hue in range of [0, 360]
/// @param saturation in range of [0, 1]
/// @param lightness in range of [0, 1]
color& from_hsl(double hue, double saturation, double lightness); ///< immutable alpha channel
color blend(const color& bgcolor, bool ignore_bgcolor_alpha) const;

View File

@@ -42,6 +42,14 @@ namespace nana
std::size_t strlen(const char_t* str);
double strtod(const char_t* str, char_t** endptr);
char_t* strcpy(char_t* dest, const char_t* source);
//Workaround for no implemenation of std::stoi in MinGW.
int stoi(const std::string&, std::size_t * pos = nullptr, int base = 10);
int stoi(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
//Workaround for no implemenation of std::stod in MinGW.
double stod(const std::string&, std::size_t * pos = nullptr);
double stod(const std::wstring&, std::size_t* pos = nullptr);
}
#if defined(NANA_WINDOWS)