diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/color.cpp | 3 | ||||
-rw-r--r-- | core/image.cpp | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/core/color.cpp b/core/color.cpp index fcfcf20355..0d8cad1a5e 100644 --- a/core/color.cpp +++ b/core/color.cpp @@ -506,8 +506,11 @@ Color Color::from_hsv(float p_h, float p_s, float p_v, float p_a) { return Color(m + r, m + g, m + b, p_a); } +// FIXME: Remove once Godot 3.1 has been released float Color::gray() const { + ERR_EXPLAIN("Color.gray() is deprecated and will be removed in a future version. Use Color.get_v() for a better grayscale approximation."); + WARN_DEPRECATED return (r + g + b) / 3.0; } diff --git a/core/image.cpp b/core/image.cpp index c94f2c3534..2fd7ea5c14 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -2230,10 +2230,10 @@ void Image::set_pixel(int p_x, int p_y, const Color &p_color) { switch (format) { case FORMAT_L8: { - ptr[ofs] = uint8_t(CLAMP(p_color.gray() * 255.0, 0, 255)); + ptr[ofs] = uint8_t(CLAMP(p_color.get_v() * 255.0, 0, 255)); } break; case FORMAT_LA8: { - ptr[ofs * 2 + 0] = uint8_t(CLAMP(p_color.gray() * 255.0, 0, 255)); + ptr[ofs * 2 + 0] = uint8_t(CLAMP(p_color.get_v() * 255.0, 0, 255)); ptr[ofs * 2 + 1] = uint8_t(CLAMP(p_color.a * 255.0, 0, 255)); } break; case FORMAT_R8: { |