mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-04 16:38:12 +08:00
Grayscale Node respects the alpha chanel (#1380)
This commit is contained in:
@@ -301,6 +301,7 @@ fn grayscale_color_node(color: Color, tint: Color, reds: f32, yellows: f32, gree
|
|||||||
let red_part = color.r() - gray_base;
|
let red_part = color.r() - gray_base;
|
||||||
let green_part = color.g() - gray_base;
|
let green_part = color.g() - gray_base;
|
||||||
let blue_part = color.b() - gray_base;
|
let blue_part = color.b() - gray_base;
|
||||||
|
let alpha_part = color.a();
|
||||||
|
|
||||||
let additional = if red_part == 0. {
|
let additional = if red_part == 0. {
|
||||||
let cyan_part = green_part.min(blue_part);
|
let cyan_part = green_part.min(blue_part);
|
||||||
@@ -318,6 +319,8 @@ fn grayscale_color_node(color: Color, tint: Color, reds: f32, yellows: f32, gree
|
|||||||
// TODO: Fix "Color" blend mode implementation so it matches the expected behavior perfectly (it's currently close)
|
// TODO: Fix "Color" blend mode implementation so it matches the expected behavior perfectly (it's currently close)
|
||||||
let color = tint.with_luminance(luminance);
|
let color = tint.with_luminance(luminance);
|
||||||
|
|
||||||
|
let color = Color::from_rgbaf32(color.r(), color.g(), color.b(), alpha_part).unwrap();
|
||||||
|
|
||||||
color.to_linear_srgb()
|
color.to_linear_srgb()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user