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:
parent
238b70e2db
commit
2969dffbe3
4 changed files with 6 additions and 8 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue