From 94fe82f38e3ed558d52c9b400a0d47010bda10a3 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 28 Nov 2023 10:43:15 -0700 Subject: [PATCH] Fix text_box red and blue channels being swapped --- src/text_box.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/text_box.rs b/src/text_box.rs index c9c189c..4a3d867 100644 --- a/src/text_box.rs +++ b/src/text_box.rs @@ -344,7 +344,13 @@ where &mut SWASH_CACHE.lock().unwrap(), text_color, |x, y, w, h, color| { - draw_rect(buffer, image_w, image_h, x, y, w as i32, h as i32, color.0); + // Grab alpha channel and green channel + let mut image_color = color.0 & 0xFF00FF00; + // Shift red channel + image_color |= (color.0 & 0x00FF0000) >> 16; + // Shift blue channel + image_color |= (color.0 & 0x000000FF) << 16; + draw_rect(buffer, image_w, image_h, x, y, w as i32, h as i32, image_color); }, );