* Color type, RGBA (32bit) */
| 12 | * Color type, RGBA (32bit) |
| 13 | */ |
| 14 | class Color : public ::Color { |
| 15 | public: |
| 16 | constexpr Color(const ::Color& color) : ::Color{color.r, color.g, color.b, color.a} {} |
| 17 | |
| 18 | constexpr Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255) |
| 19 | : ::Color{red, green, blue, alpha} {}; |
| 20 | |
| 21 | /** |
| 22 | * Black. |
| 23 | */ |
| 24 | constexpr Color() : ::Color{0, 0, 0, 255} {}; |
| 25 | |
| 26 | /** |
| 27 | * Returns a Color from HSV values |
| 28 | */ |
| 29 | Color(::Vector3 hsv) { set(::ColorFromHSV(hsv.x, hsv.y, hsv.z)); } |
| 30 | |
| 31 | /** |
| 32 | * Returns a Color from HSV values |
| 33 | */ |
| 34 | static ::Color FromHSV(float hue, float saturation, float value) { return ::ColorFromHSV(hue, saturation, value); } |
| 35 | |
| 36 | /** |
| 37 | * Get Color structure from hexadecimal value |
| 38 | */ |
| 39 | explicit Color(unsigned int hexValue) : ::Color(::GetColor(hexValue)) { } |
| 40 | |
| 41 | Color(void* srcPtr, int format) : ::Color(::GetPixelColor(srcPtr, format)) { } |
| 42 | |
| 43 | /** |
| 44 | * Returns hexadecimal value for a Color |
| 45 | */ |
| 46 | RLCPP_NODISCARD int ToInt() const { return ::ColorToInt(*this); } |
| 47 | |
| 48 | /** |
| 49 | * Returns hexadecimal value for a Color |
| 50 | */ |
| 51 | explicit operator int() const { return ::ColorToInt(*this); } |
| 52 | |
| 53 | RLCPP_NODISCARD std::string ToString() const { return TextFormat("Color(%d, %d, %d, %d)", r, g, b, a); } |
| 54 | |
| 55 | explicit operator std::string() const { return ToString(); } |
| 56 | |
| 57 | /** |
| 58 | * Returns color with alpha applied, alpha goes from 0.0f to 1.0f |
nothing calls this directly
no outgoing calls
no test coverage detected