From 7bc1dc828f1636cdc9dc253d28a279f18c9c72c8 Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Mon, 23 Sep 2019 20:01:26 -0400 Subject: [PATCH] Remove deprecated Color::gray MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was marked to be removed in Godot 3.1. Co-authored-by: RĂ©mi Verschelde --- core/color.cpp | 7 ------- core/color.h | 1 - core/image.cpp | 2 +- core/variant_call.cpp | 2 -- doc/classes/Color.xml | 12 ------------ modules/gdnative/gdnative/color.cpp | 5 ----- modules/gdnative/gdnative_api.json | 7 ------- modules/gdnative/include/gdnative/color.h | 2 -- 8 files changed, 1 insertion(+), 37 deletions(-) diff --git a/core/color.cpp b/core/color.cpp index cb3068c4874b..03aeb2085ba1 100644 --- a/core/color.cpp +++ b/core/color.cpp @@ -508,13 +508,6 @@ Color Color::from_hsv(float p_h, float p_s, float p_v, float p_a) const { return Color(m + r, m + g, m + b, p_a); } -// FIXME: Remove once Godot 3.1 has been released -float Color::gray() const { - - WARN_DEPRECATED_MSG("'Color.gray()' is deprecated and will be removed in a future version. Use 'Color.v' for a better grayscale approximation."); - return (r + g + b) / 3.0; -} - Color::operator String() const { return rtos(r) + ", " + rtos(g) + ", " + rtos(b) + ", " + rtos(a); diff --git a/core/color.h b/core/color.h index 75a2b07d71b4..a7ab94ab08c9 100644 --- a/core/color.h +++ b/core/color.h @@ -56,7 +56,6 @@ struct Color { uint64_t to_rgba64() const; uint64_t to_argb64() const; uint64_t to_abgr64() const; - float gray() const; float get_h() const; float get_s() const; float get_v() const; diff --git a/core/image.cpp b/core/image.cpp index b126437fa9ce..d9f84621a358 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1715,7 +1715,7 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con roughness = c.b; } break; case ROUGHNESS_CHANNEL_L: { - roughness = c.gray(); + roughness = c.get_v(); } break; case ROUGHNESS_CHANNEL_A: { roughness = c.a; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 6b5b94718582..f088705cdd4f 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -488,7 +488,6 @@ struct _VariantCall { VCALL_LOCALMEM0R(Color, to_argb64); VCALL_LOCALMEM0R(Color, to_abgr64); VCALL_LOCALMEM0R(Color, to_rgba64); - VCALL_LOCALMEM0R(Color, gray); VCALL_LOCALMEM0R(Color, inverted); VCALL_LOCALMEM0R(Color, contrasted); VCALL_LOCALMEM2R(Color, linear_interpolate); @@ -1737,7 +1736,6 @@ void register_variant_methods() { ADDFUNC0R(COLOR, INT, Color, to_argb64, varray()); ADDFUNC0R(COLOR, INT, Color, to_abgr64, varray()); ADDFUNC0R(COLOR, INT, Color, to_rgba64, varray()); - ADDFUNC0R(COLOR, REAL, Color, gray, varray()); ADDFUNC0R(COLOR, COLOR, Color, inverted, varray()); ADDFUNC0R(COLOR, COLOR, Color, contrasted, varray()); ADDFUNC2R(COLOR, COLOR, Color, linear_interpolate, COLOR, "b", REAL, "t", varray()); diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index 0d3f51309bc7..5529251b5abc 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -128,18 +128,6 @@ [/codeblock] - - - - - Returns the color's grayscale representation. - The gray value is calculated as [code](r + g + b) / 3[/code]. - [codeblock] - var c = Color(0.2, 0.45, 0.82) - var gray = c.gray() # A value of 0.466667 - [/codeblock] - - diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp index 24587ce4a148..914d5b03f481 100644 --- a/modules/gdnative/gdnative/color.cpp +++ b/modules/gdnative/gdnative/color.cpp @@ -141,11 +141,6 @@ godot_int GDAPI godot_color_to_argb32(const godot_color *p_self) { return self->to_argb32(); } -godot_real GDAPI godot_color_gray(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->gray(); -} - godot_color GDAPI godot_color_inverted(const godot_color *p_self) { godot_color dest; const Color *self = (const Color *)p_self; diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 8ccb8d2286c0..c2cbe1e82461 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -578,13 +578,6 @@ ["const godot_color *", "p_self"] ] }, - { - "name": "godot_color_gray", - "return_type": "godot_real", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, { "name": "godot_color_inverted", "return_type": "godot_color", diff --git a/modules/gdnative/include/gdnative/color.h b/modules/gdnative/include/gdnative/color.h index 3f046b7f08a7..47c01dbb2097 100644 --- a/modules/gdnative/include/gdnative/color.h +++ b/modules/gdnative/include/gdnative/color.h @@ -91,8 +91,6 @@ godot_int GDAPI godot_color_to_rgba64(const godot_color *p_self); godot_int GDAPI godot_color_to_argb32(const godot_color *p_self); -godot_real GDAPI godot_color_gray(const godot_color *p_self); - godot_color GDAPI godot_color_inverted(const godot_color *p_self); godot_color GDAPI godot_color_contrasted(const godot_color *p_self);