status bar
git clone https://git.lucas.co/cce-status-interface.git
chore: remove one-off debug/inspection bins from src/bin
These undeclared bins (pixel inspectors, ascii dumpers, dbus/pam probes, etc.)
were auto-compiled by every `cargo build`, slowed builds, and carried hardcoded
paths. Recoverable from history if needed.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
src/bin/check_metrics.rs | 18 -----
src/bin/check_stride.rs | 10 ---
src/bin/dbus_test.rs | 168 ---------------------------------------
src/bin/detect_text.rs | 37 ---------
src/bin/draw_ascii.rs | 37 ---------
src/bin/draw_ascii_grim.rs | 32 --------
src/bin/find_text_box.rs | 51 ------------
src/bin/inspect_image_corners.rs | 24 ------
src/bin/inspect_pixels.rs | 27 -------
src/bin/list_unique_colors.rs | 36 ---------
src/bin/test_read_volume.rs | 50 ------------
src/bin/verify_bg.rs | 33 --------
src/bin/verify_pixels.rs | 54 -------------
13 files changed, 577 deletions(-)
diff --git a/src/bin/check_metrics.rs b/src/bin/check_metrics.rs
deleted file mode 100644
index 582c885..0000000
--- a/src/bin/check_metrics.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-use glyphon::{FontSystem, Buffer, Metrics, Attrs, Shaping};
-
-fn main() {
- let mut font_system = FontSystem::new();
- let font_size = 28.0;
- let metrics = Metrics::new(font_size, font_size * 1.4);
- let mut buffer = Buffer::new(&mut font_system, metrics);
- let attrs = Attrs::new().family(glyphon::Family::Name("Berkeley Mono"));
- buffer.set_text(&mut font_system, "Hello World", attrs, Shaping::Advanced);
- buffer.shape_until_scroll(&mut font_system, true);
-
- for run in buffer.layout_runs() {
- println!("line_y: {}, line_w: {}", run.line_y, run.line_w);
- for glyph in run.glyphs {
- println!(" glyph at x: {}, w: {}", glyph.x, glyph.w);
- }
- }
-}
diff --git a/src/bin/check_stride.rs b/src/bin/check_stride.rs
deleted file mode 100644
index 9f15a42..0000000
--- a/src/bin/check_stride.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-use std::fs::File;
-
-fn main() {
- let file = File::open("/home/lsgalante/.gemini/antigravity/brain/2aeef5fd-2989-49f9-a513-b732668c813b/current_screen_unified_2.png").unwrap();
- let decoder = png::Decoder::new(file);
- let reader = decoder.read_info().unwrap();
- let info = reader.info();
- println!("PNG Info: width={}, height={}, color_type={:?}, bit_depth={:?}, raw_bytes={}",
- info.width, info.height, info.color_type, info.bit_depth, info.raw_bytes());
-}
diff --git a/src/bin/dbus_test.rs b/src/bin/dbus_test.rs
deleted file mode 100644
index dd29326..0000000
--- a/src/bin/dbus_test.rs
+++ /dev/null
@@ -1,168 +0,0 @@
-use zbus::{proxy, Connection};
-use std::collections::HashMap;
-use zbus::zvariant::{OwnedValue, Value};
-use std::process::{Command, Stdio};
-use std::io::Write;
-
-#[proxy(
- interface = "org.kde.StatusNotifierItem",
- default_path = "/StatusNotifierItem"
-)]
-trait StatusNotifierItem {
- #[zbus(property)]
- fn item_is_menu(&self) -> zbus::Result<bool>;
-
- #[zbus(property)]
- fn menu(&self) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
-}
-
-#[proxy(
- interface = "com.canonical.dbusmenu",
- default_path = "/StatusNotifierItem/menu"
-)]
-trait DBusMenu {
- fn get_layout(
- &self,
- parent_id: i32,
- recursion_depth: i32,
- property_names: Vec<String>,
- ) -> zbus::Result<(u32, (i32, HashMap<String, OwnedValue>, Vec<OwnedValue>))>;
-
- fn event(
- &self,
- id: i32,
- event_id: &str,
- data: &zbus::zvariant::Value<'_>,
- timestamp: u32,
- ) -> zbus::Result<()>;
-
- fn about_to_show(&self, id: i32) -> zbus::Result<bool>;
-}
-
-fn flatten_menu(
- id: i32,
- mut properties: HashMap<String, OwnedValue>,
- children: Vec<OwnedValue>,
- prefix: &str,
- out: &mut Vec<(i32, String)>
-) {
- let label: String = properties.remove("label")
- .and_then(|v| {
- let s: Result<String, _> = v.try_into();
- s.ok()
- })
- .unwrap_or_default();
- let type_: String = properties.remove("type")
- .and_then(|v| {
- let s: Result<String, _> = v.try_into();
- s.ok()
- })
- .unwrap_or_default();
- let enabled: bool = properties.remove("enabled")
- .and_then(|v| {
- let b: Result<bool, _> = v.try_into();
- b.ok()
- })
- .unwrap_or(true);
-
- if type_ == "separator" || !enabled {
- // Skip separator or disabled items
- } else {
- let current_path = if prefix.is_empty() {
- label.clone()
- } else if !label.is_empty() {
- format!("{} > {}", prefix, label)
- } else {
- prefix.to_string()
- };
-
- if !current_path.is_empty() && children.is_empty() {
- out.push((id, current_path.clone()));
- }
-
- for child_val in children {
- let child_val_inner = zbus::zvariant::Value::from(child_val);
- if let Ok(child) = <(i32, HashMap<String, OwnedValue>, Vec<OwnedValue>)>::try_from(child_val_inner) {
- flatten_menu(child.0, child.1, child.2, ¤t_path, out);
- }
- }
- }
-}
-
-#[tokio::main]
-async fn main() -> Result<(), Box<dyn std::error::Error>> {
- let conn = Connection::session().await?;
-
- let destination = "org.kde.StatusNotifierItem-997-1";
- let path = "/StatusNotifierItem";
-
- println!("Connecting to StatusNotifierItem at destination='{}', path='{}'...", destination, path);
- let sni_proxy = StatusNotifierItemProxy::builder(&conn)
- .destination(destination)?
- .path(path)?
- .build()
- .await?;
-
- let is_menu = sni_proxy.item_is_menu().await.unwrap_or(false);
- let menu_path = sni_proxy.menu().await?;
-
- println!("is_menu: {}, menu_path: {}", is_menu, menu_path.as_str());
-
- let menu_proxy = DBusMenuProxy::builder(&conn)
- .destination(destination)?
- .path(menu_path.as_str())?
- .build()
- .await?;
-
- // Call about_to_show
- let _ = menu_proxy.about_to_show(0).await;
-
- let (revision, layout) = menu_proxy.get_layout(0, 3, vec![]).await?;
- println!("Menu revision: {}", revision);
-
- let mut items = Vec::new();
- flatten_menu(layout.0, layout.1, layout.2, "", &mut items);
-
- println!("Flattened items count: {}", items.len());
-
- // Format input for fuzzel
- let mut fuzzel_input = String::new();
- for (_, label) in &items {
- fuzzel_input.push_str(label);
- fuzzel_input.push('\n');
- }
-
- // Spawn fuzzel
- println!("Spawning fuzzel...");
- let mut child = Command::new("fuzzel")
- .args(["-dmenu", "-p", "Tray Menu:"])
- .stdin(Stdio::piped())
- .stdout(Stdio::piped())
- .spawn()?;
-
- if let Some(mut stdin) = child.stdin.take() {
- stdin.write_all(fuzzel_input.as_bytes())?;
- }
-
- let output = child.wait_with_output()?;
- if output.status.success() {
- let selected = String::from_utf8_lossy(&output.stdout).trim().to_string();
- println!("Selected: '{}'", selected);
- if let Some((id, _)) = items.iter().find(|(_, label)| label == &selected) {
- println!("Triggering event on item ID: {}", id);
- let timestamp = std::time::SystemTime::now()
- .duration_since(std::time::UNIX_EPOCH)
- .unwrap_or_default()
- .as_secs() as u32;
- let val = Value::from("");
- menu_proxy.event(*id, "clicked", &val, timestamp).await?;
- println!("Event sent successfully!");
- } else {
- println!("Selection match not found in items list!");
- }
- } else {
- println!("Fuzzel was cancelled or failed");
- }
-
- Ok(())
-}
diff --git a/src/bin/detect_text.rs b/src/bin/detect_text.rs
deleted file mode 100644
index 3198920..0000000
--- a/src/bin/detect_text.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-use std::fs::File;
-
-fn main() {
- let file = File::open("/home/lsgalante/.gemini/antigravity/brain/2aeef5fd-2989-49f9-a513-b732668c813b/current_screen_unified_2.png").unwrap();
- let decoder = png::Decoder::new(file);
- let mut reader = decoder.read_info().unwrap();
- let mut buf = vec![0; reader.output_buffer_size()];
- let info = reader.next_frame(&mut buf).unwrap();
- let width = info.width as usize;
- let height = info.height as usize;
- println!("Image size: {}x{}", width, height);
-
- // Let's print ASCII representation of the region x = 3200..3840, y = 10..46 using horizontal difference
- for y in 10..46 {
- let mut row_chars = String::new();
- for x in (3200..3840).step_by(2) {
- let idx = (y * width + x) * 4;
- let idx_prev = (y * width + (x - 2)) * 4;
-
- let r = buf[idx] as i32;
- let g = buf[idx + 1] as i32;
- let b = buf[idx + 2] as i32;
-
- let r_p = buf[idx_prev] as i32;
- let g_p = buf[idx_prev + 1] as i32;
- let b_p = buf[idx_prev + 2] as i32;
-
- let diff = (r - r_p).abs() + (g - g_p).abs() + (b - b_p).abs();
- if diff > 15 {
- row_chars.push('#');
- } else {
- row_chars.push('.');
- }
- }
- println!("{:2}: {}", y, row_chars);
- }
-}
diff --git a/src/bin/draw_ascii.rs b/src/bin/draw_ascii.rs
deleted file mode 100644
index fd24b60..0000000
--- a/src/bin/draw_ascii.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-use std::fs::File;
-
-fn main() {
- let file = File::open("/home/lsgalante/.gemini/antigravity/brain/2aeef5fd-2989-49f9-a513-b732668c813b/current_screen_unified.png").unwrap();
- let decoder = png::Decoder::new(file);
- let mut reader = decoder.read_info().unwrap();
- let mut buf = vec![0; reader.output_buffer_size()];
- let info = reader.next_frame(&mut buf).unwrap();
- let width = info.width as usize;
- let height = info.height as usize;
- println!("Image size: {}x{}", width, height);
-
- // Sample background pixel
- let bg_idx = (20 * width + 100) * 4;
- let bg_r = buf[bg_idx] as i32;
- let bg_g = buf[bg_idx + 1] as i32;
- let bg_b = buf[bg_idx + 2] as i32;
- println!("Background color sampled at (100, 20): R={}, G={}, B={}", bg_r, bg_g, bg_b);
-
- for y in (10..46).step_by(2) {
- let mut row_chars = String::new();
- for x in (2800..3840).step_by(2) {
- let idx = (y * width + x) * 4;
- let r = buf[idx] as i32;
- let g = buf[idx + 1] as i32;
- let b = buf[idx + 2] as i32;
-
- let diff = (r - bg_r).abs() + (g - bg_g).abs() + (b - bg_b).abs();
- if diff > 20 {
- row_chars.push('#');
- } else {
- row_chars.push('.');
- }
- }
- println!("{:2}: {}", y, row_chars);
- }
-}
diff --git a/src/bin/draw_ascii_grim.rs b/src/bin/draw_ascii_grim.rs
deleted file mode 100644
index cc831ba..0000000
--- a/src/bin/draw_ascii_grim.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-use std::fs::File;
-
-fn main() {
- let file = File::open("/tmp/current_screen.png").unwrap();
- let decoder = png::Decoder::new(file);
- let mut reader = decoder.read_info().unwrap();
- let mut buf = vec![0; reader.output_buffer_size()];
- let info = reader.next_frame(&mut buf).unwrap();
- let width = info.width as usize;
- let height = info.height as usize;
- let color_type = info.color_type;
- println!("Image size: {}x{}, color_type: {:?}", width, height, color_type);
-
- let bytes_per_pixel = match color_type {
- png::ColorType::Rgb => 3,
- png::ColorType::Rgba => 4,
- png::ColorType::Grayscale => 1,
- png::ColorType::GrayscaleAlpha => 2,
- _ => panic!("Unsupported color type"),
- };
-
- // The actual status bar background color is R=69, G=69, B=89
- let _bg_r = 69;
- let _bg_g = 69;
- let _bg_b = 89;
-
- println!("Strikethrough line pixels at y=30, x=3266..3344 (step by 8):");
- for x in (3266..3344).step_by(8) {
- let idx = (30 * width + x) * bytes_per_pixel;
- println!(" x={}: R={}, G={}, B={}", x, buf[idx], buf[idx+1], buf[idx+2]);
- }
-}
diff --git a/src/bin/find_text_box.rs b/src/bin/find_text_box.rs
deleted file mode 100644
index 5dc6617..0000000
--- a/src/bin/find_text_box.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use std::fs::File;
-
-fn main() {
- let file = File::open("/home/lsgalante/.gemini/antigravity/brain/2aeef5fd-2989-49f9-a513-b732668c813b/current_screen_unified_2.png").unwrap();
- let decoder = png::Decoder::new(file);
- let mut reader = decoder.read_info().unwrap();
- let mut buf = vec![0; reader.output_buffer_size()];
- let info = reader.next_frame(&mut buf).unwrap();
- let width = info.width as usize;
- let bg_idx = (20 * width + 100) * 3;
- let bg_r = buf[bg_idx] as i32;
- let bg_g = buf[bg_idx + 1] as i32;
- let bg_b = buf[bg_idx + 2] as i32;
- println!("Background color sampled at (100, 20): R={}, G={}, B={}", bg_r, bg_g, bg_b);
-
- // Status bar is in y = 0..80
- // Let's count non-background pixels in each column for y = 10..48
- let mut col_intensity = vec![0; width];
- for x in 0..width {
- for y in 10..48 {
- let idx = (y * width + x) * 3;
- let r = buf[idx] as i32;
- let g = buf[idx + 1] as i32;
- let b = buf[idx + 2] as i32;
-
- let diff = (r - bg_r).abs() + (g - bg_g).abs() + (b - bg_b).abs();
- if diff > 15 {
- col_intensity[x] += 1;
- }
- }
- }
-
- // Group columns into contiguous active segments
- let mut in_segment = false;
- let mut start_x = 0;
- println!("Active segments in status bar (x from left to right):");
- for x in 0..width {
- let active = col_intensity[x] > 2; // threshold of 2 pixels
- if active && !in_segment {
- start_x = x;
- in_segment = true;
- } else if !active && in_segment {
- let end_x = x - 1;
- println!(" Segment at x = {}..{} (width = {})", start_x, end_x, end_x - start_x + 1);
- in_segment = false;
- }
- }
- if in_segment {
- println!(" Segment at x = {}..{} (width = {})", start_x, width - 1, width - start_x);
- }
-}
diff --git a/src/bin/inspect_image_corners.rs b/src/bin/inspect_image_corners.rs
deleted file mode 100644
index fc0b3f0..0000000
--- a/src/bin/inspect_image_corners.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use std::fs::File;
-
-fn main() {
- let file = File::open("/home/lsgalante/.gemini/antigravity/brain/2aeef5fd-2989-49f9-a513-b732668c813b/current_screen_unified.png").unwrap();
- let decoder = png::Decoder::new(file);
- let mut reader = decoder.read_info().unwrap();
- let mut buf = vec![0; reader.output_buffer_size()];
- let info = reader.next_frame(&mut buf).unwrap();
- let width = info.width as usize;
- let height = info.height as usize;
- println!("Width: {}, Height: {}", width, height);
-
- println!("Top row y=4 colors (x = 0, 100, 500, 1000, 2000, 3000, 3800):");
- for x in &[0, 100, 500, 1000, 2000, 3000, 3800] {
- let idx = (4 * width + x) * 4;
- println!("x={}: R={}, G={}, B={}, A={}", x, buf[idx], buf[idx+1], buf[idx+2], buf[idx+3]);
- }
-
- println!("Row y=20 colors (x = 0, 100, 500, 1000, 2000, 3000, 3800):");
- for x in &[0, 100, 500, 1000, 2000, 3000, 3800] {
- let idx = (20 * width + x) * 4;
- println!("x={}: R={}, G={}, B={}, A={}", x, buf[idx], buf[idx+1], buf[idx+2], buf[idx+3]);
- }
-}
diff --git a/src/bin/inspect_pixels.rs b/src/bin/inspect_pixels.rs
deleted file mode 100644
index 043e37c..0000000
--- a/src/bin/inspect_pixels.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-use std::fs::File;
-
-fn main() {
- let file = File::open("/home/lsgalante/.gemini/antigravity/brain/2aeef5fd-2989-49f9-a513-b732668c813b/current_screen_3.png").unwrap();
- let decoder = png::Decoder::new(file);
- let mut reader = decoder.read_info().unwrap();
- let mut buf = vec![0; reader.output_buffer_size()];
- let info = reader.next_frame(&mut buf).unwrap();
-
- println!("Truly bright pixels for x = 3310..3390, y = 10..50:");
- let mut found = 0;
- for y in 10..50 {
- for x in 3310..3390 {
- let idx = (y * info.width as usize + x) * 4;
- let r = buf[idx];
- let g = buf[idx + 1];
- let b = buf[idx + 2];
- let a = buf[idx + 3];
-
- if r > 100 && g > 100 && b > 100 {
- found += 1;
- println!("y={}, x={}: R={}, G={}, B={}, A={}", y, x, r, g, b, a);
- }
- }
- }
- println!("Total truly bright pixels: {}", found);
-}
diff --git a/src/bin/list_unique_colors.rs b/src/bin/list_unique_colors.rs
deleted file mode 100644
index 884660e..0000000
--- a/src/bin/list_unique_colors.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-use std::fs::File;
-use std::collections::HashMap;
-
-fn main() {
- let file = File::open("/tmp/current_screen.png").unwrap();
- let decoder = png::Decoder::new(file);
- let mut reader = decoder.read_info().unwrap();
- let mut buf = vec![0; reader.output_buffer_size()];
- let info = reader.next_frame(&mut buf).unwrap();
- let width = info.width as usize;
- let bytes_per_pixel = match info.color_type {
- png::ColorType::Rgb => 3,
- png::ColorType::Rgba => 4,
- _ => panic!("Unsupported color type"),
- };
-
- let mut color_counts = HashMap::new();
- // Scan the window area: x from 12 to 1800 (physical), y from 68 to 2300 (physical)
- for y in (68..2300).step_by(2) {
- for x in (12..1800).step_by(2) {
- let idx = (y * width + x) * bytes_per_pixel;
- let r = buf[idx];
- let g = buf[idx + 1];
- let b = buf[idx + 2];
- *color_counts.entry((r, g, b)).or_insert(0) += 1;
- }
- }
-
- let mut sorted_colors: Vec<_> = color_counts.into_iter().collect();
- sorted_colors.sort_by(|a, b| b.1.cmp(&a.1));
-
- println!("Top 30 most common colors in the system interface window area:");
- for (i, ((r, g, b), count)) in sorted_colors.iter().take(30).enumerate() {
- println!(" #{}: R={}, G={}, B={} (count={})", i + 1, r, g, b, count);
- }
-}
diff --git a/src/bin/test_read_volume.rs b/src/bin/test_read_volume.rs
deleted file mode 100644
index 2d3ecb6..0000000
--- a/src/bin/test_read_volume.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-#[tokio::main]
-async fn main() {
- println!("Starting read_volume diagnostics...");
-
- let vol_res = tokio::process::Command::new("pactl")
- .args(["get-sink-volume", "@DEFAULT_SINK@"])
- .output()
- .await;
-
- match &vol_res {
- Ok(output) => {
- println!("pactl get-sink-volume succeeded.");
- println!("stdout: {:?}", String::from_utf8_lossy(&output.stdout));
- println!("stderr: {:?}", String::from_utf8_lossy(&output.stderr));
- }
- Err(e) => {
- println!("pactl get-sink-volume failed: {:?}", e);
- }
- }
-
- let mute_res = tokio::process::Command::new("pactl")
- .args(["get-sink-mute", "@DEFAULT_SINK@"])
- .output()
- .await;
-
- match &mute_res {
- Ok(output) => {
- println!("pactl get-sink-mute succeeded.");
- println!("stdout: {:?}", String::from_utf8_lossy(&output.stdout));
- println!("stderr: {:?}", String::from_utf8_lossy(&output.stderr));
- }
- Err(e) => {
- println!("pactl get-sink-mute failed: {:?}", e);
- }
- }
-
- // Try parsing
- if let Ok(vol_output) = vol_res {
- let vol_str = String::from_utf8_lossy(&vol_output.stdout);
- let mut pct = None;
- if let Some(pos) = vol_str.find('%') {
- let start = vol_str[..pos].rfind(|c: char| !c.is_ascii_digit()).map(|i| i + 1).unwrap_or(0);
- println!("pos: {}, start: {}, substring: {:?}", pos, start, &vol_str[start..pos]);
- if let Ok(num) = vol_str[start..pos].parse::<u32>() {
- pct = Some(num);
- }
- }
- println!("Parsed pct: {:?}", pct);
- }
-}
diff --git a/src/bin/verify_bg.rs b/src/bin/verify_bg.rs
deleted file mode 100644
index 38114e7..0000000
--- a/src/bin/verify_bg.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-use std::fs::File;
-
-fn main() {
- let file = File::open("/tmp/current_screen.png").expect("Failed to open screenshot");
- let decoder = png::Decoder::new(file);
- let mut reader = decoder.read_info().expect("Failed to read PNG info");
- let mut buf = vec![0; reader.output_buffer_size()];
- let info = reader.next_frame(&mut buf).expect("Failed to decode PNG frame");
- let width = info.width as usize;
- let height = info.height as usize;
- let bytes_per_pixel = match info.color_type {
- png::ColorType::Rgb => 3,
- png::ColorType::Rgba => 4,
- _ => panic!("Unsupported color type"),
- };
-
- let mut found = 0;
- for y in 0..height {
- for x in 0..width {
- let idx = (y * width + x) * bytes_per_pixel;
- let r = buf[idx];
- let g = buf[idx + 1];
- let b = buf[idx + 2];
- if r < 30 && g < 30 && b > 50 {
- found += 1;
- if found <= 20 {
- println!("Pixel at ({}, {}): R={}, G={}, B={}", x, y, r, g, b);
- }
- }
- }
- }
- println!("Total pixels matching: {}", found);
-}
diff --git a/src/bin/verify_pixels.rs b/src/bin/verify_pixels.rs
deleted file mode 100644
index 24bcf43..0000000
--- a/src/bin/verify_pixels.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use std::fs::File;
-
-fn main() {
- let file = File::open("/home/lsgalante/.gemini/antigravity/brain/2aeef5fd-2989-49f9-a513-b732668c813b/current_screen_unified_2.png").unwrap();
- let decoder = png::Decoder::new(file);
- let mut reader = decoder.read_info().unwrap();
- let mut buf = vec![0; reader.output_buffer_size()];
- let info = reader.next_frame(&mut buf).unwrap();
- let width = info.width as usize;
-
- // Sample background at (100, 20)
- let bg_idx = (20 * width + 100) * 3;
- let bg_r = buf[bg_idx] as i32;
- let bg_g = buf[bg_idx + 1] as i32;
- let bg_b = buf[bg_idx + 2] as i32;
- println!("Background color sampled at (100, 20): R={}, G={}, B={}", bg_r, bg_g, bg_b);
-
- println!("Background color sampled at (3200, 20): R={}, G={}, B={}", buf[(20 * width + 3200) * 3], buf[(20 * width + 3200) * 3 + 1], buf[(20 * width + 3200) * 3 + 2]);
- println!("Background color sampled at (1500, 20): R={}, G={}, B={}", buf[(20 * width + 1500) * 3], buf[(20 * width + 1500) * 3 + 1], buf[(20 * width + 1500) * 3 + 2]);
-
- println!("Checking volume text region (x = 3264..3345, y = 12..44):");
- let mut text_pixels = 0;
- for y in 12..44 {
- for x in 3264..3345 {
- let idx = (y * width + x) * 3;
- let r = buf[idx] as i32;
- let g = buf[idx + 1] as i32;
- let b = buf[idx + 2] as i32;
-
- let diff = (r - bg_r).abs() + (g - bg_g).abs() + (b - bg_b).abs();
- if diff > 15 {
- text_pixels += 1;
- }
- }
- }
- println!("Found {} active pixels in volume region.", text_pixels);
-
- // Let's also check a region that should be empty (e.g. x = 3200..3250, y = 12..44)
- let mut empty_pixels = 0;
- for y in 12..44 {
- for x in 3200..3250 {
- let idx = (y * width + x) * 3;
- let r = buf[idx] as i32;
- let g = buf[idx + 1] as i32;
- let b = buf[idx + 2] as i32;
-
- let diff = (r - bg_r).abs() + (g - bg_g).abs() + (b - bg_b).abs();
- if diff > 15 {
- empty_pixels += 1;
- }
- }
- }
- println!("Found {} active pixels in empty region.", empty_pixels);
-}