From b74e03910bdff7394c29f0857826be18a6a5eb9d Mon Sep 17 00:00:00 2001 From: Esther Alter Date: Fri, 26 Jul 2024 17:13:15 -0400 Subject: [PATCH] Added softbuffer-rgb to the newsletter --- content/news/053/index.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/content/news/053/index.md b/content/news/053/index.md index 4eaf5537f..ba31ddea9 100644 --- a/content/news/053/index.md +++ b/content/news/053/index.md @@ -149,6 +149,25 @@ There you can also find a [progress overview](https://godot.rapier.rs/docs/progr [godot_rapier_reddit]: https://www.reddit.com/r/godot/comments/1dtoufn/rewriting_godots_physics_server_in_rust/ [godot]: https://godotengine.org/ +### softbuffer-rgb + +[softbuffer-rgb](https://crates.io/crates/softbuffer-rgb) is a wrapper around [softbuffer](https://docs.rs/softbuffer/latest/softbuffer/) that makes it easier to modify a raw pixel buffer. + +Instead of doing this: + +``` +buffer.buffer_mut()[y * width + x] = u32::from_le_bytes([0, 200, 70, 10]); +``` + +...you can now do this: + +``` +buffer.pixels[y][x] = [0, 200, 70, 10]; +``` + +To put it another way: It rearranges the raw pixel buffer from `[u32; width * height]` into `[[[u8; 4]; width]; height]` + + ## Popular Workgroup Issues in GitHub