Merge pull request #43283 from Calinou/color-remove-contrasted

Remove `Color.contrasted()` as its behavior is barely useful
This commit is contained in:
Rémi Verschelde 2020-11-06 10:17:12 +01:00 committed by GitHub
commit 52c1b5fc41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 1 additions and 66 deletions

View file

@ -148,13 +148,6 @@ godot_color GDAPI godot_color_inverted(const godot_color *p_self) {
return dest;
}
godot_color GDAPI godot_color_contrasted(const godot_color *p_self) {
godot_color dest;
const Color *self = (const Color *)p_self;
*((Color *)&dest) = self->contrasted();
return dest;
}
godot_color GDAPI godot_color_lerp(const godot_color *p_self, const godot_color *p_b, const godot_real p_t) {
godot_color dest;
const Color *self = (const Color *)p_self;

View file

@ -1254,13 +1254,6 @@
["const godot_color *", "p_self"]
]
},
{
"name": "godot_color_contrasted",
"return_type": "godot_color",
"arguments": [
["const godot_color *", "p_self"]
]
},
{
"name": "godot_color_lerp",
"return_type": "godot_color",

View file

@ -93,8 +93,6 @@ godot_int GDAPI godot_color_to_argb32(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);
godot_color GDAPI godot_color_lerp(const godot_color *p_self, const godot_color *p_b, const godot_real p_t);
godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over);

View file

@ -256,20 +256,6 @@ namespace Godot
return res;
}
/// <summary>
/// Returns the most contrasting color.
/// </summary>
/// <returns>The most contrasting color</returns>
public Color Contrasted()
{
return new Color(
(r + 0.5f) % 1.0f,
(g + 0.5f) % 1.0f,
(b + 0.5f) % 1.0f,
a
);
}
/// <summary>
/// Returns a new color resulting from making this color darker
/// by the specified ratio (on the range of 0 to 1).