summaryrefslogtreecommitdiff
path: root/src/label_formats/large_label_format.rs
diff options
context:
space:
mode:
authorcc <cc@localhost>2025-08-20 22:23:34 -0700
committercc <cc@localhost>2025-08-20 22:23:49 -0700
commit00e05ac35b85fdf0e7eb5f5db9db4b0a563fa14d (patch)
treeb3b203070d29821e855be4acfe9cfc95c657d002 /src/label_formats/large_label_format.rs
parentcf4b76823629e10d79a6a848a6ffaa72d494811d (diff)
Externalize Label Structure
Diffstat (limited to 'src/label_formats/large_label_format.rs')
-rw-r--r--src/label_formats/large_label_format.rs45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/label_formats/large_label_format.rs b/src/label_formats/large_label_format.rs
deleted file mode 100644
index a6128c0..0000000
--- a/src/label_formats/large_label_format.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-use super::{LabelFormat,flood};
-
-pub struct LargeLabelFormat {
- pub buffer: Vec<u32>,
- pub width: usize,
- pub height: usize,
-}
-
-impl std::fmt::Debug for LargeLabelFormat {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- f.debug_struct("LargeLabelFormat")
- .field("width", &self.width)
- .field("height", &self.height)
- .finish()
- }
-}
-
-impl LargeLabelFormat {
- pub fn compress(&self) -> LabelFormat {
- let mut label: u16 = 1;
- let mut output_buffer: Vec<u16> = vec![0u16; self.buffer.len()];
- for y in 0..self.height {
- for x in 0..self.width {
- let index = x + y*self.width;
- if self.buffer[index] == 0 {
- continue;
- }
- if output_buffer[index] == 0 {
- let color = self.buffer[index];
- flood(&self, &mut output_buffer, x, y, color, label);
- label += 1;
- }
- }
- }
- return LabelFormat {
- buffer: output_buffer,
- width: self.width,
- height: self.height,
- };
- }
-
- pub fn dump(&self, filename: &str) -> Result<(), std::io::Error> {
- crate::binfile::dump_u32_vec(filename, self.buffer.clone())
- }
-}