mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 15:21:56 -05:00
Deprecate incorrect Color::gray()
This average is not a proper approximation of a grayscale value, get_v() is better suited for that. If we want a real to_grayscale() conversion, it's somewhat more involved: https://en.wikipedia.org/wiki/Grayscale Remove the deprecated Gray() from C# bindings as it conflicts with new named color constants.
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user