39 :
MProperty(), data_{this, {r, g, b, a}} {}
95 return ((
size_t(data_[0] * 255) << 16) | (
size_t(data_[1] * 255) << 8) |
96 size_t(data_[2] * 255));
104 return "#" + std::string(std::to_string(to_hex()));
113 static Color from_hex(uint32_t hex);
121 static Color from_name(
const std::string &name);
129 static Color from_hex(
const std::string &hex);
149 operator const data_t &()
const {
return data_; }
const float_t & r() const
获取红色分量(只读)
Color & operator=(const Color &)=delete
Color(const Color &)=delete
Color(float_t r, float_t g, float_t b, float_t a=1.0)
构造函数
const float_t & a() const
获取透明度分量(只读)
const data_t & value() const
float_t & a()
获取透明度分量(可修改)
Color & operator=(const data_t &other)
size_t to_hex()
将颜色转换为十六进制数值
Color & operator=(Color &&)=delete
std::string to_hex_string()
将颜色转换为十六进制字符串
const float_t & g() const
获取绿色分量(只读)
const float_t & b() const
获取蓝色分量(只读)
#define XCAL_PROPERTY_TYPE(type)