Trial of skipping ever n pixel in width

This commit is contained in:
Luke
2020-06-04 21:10:54 +12:00
parent 8d19db9f0e
commit 9ddd7da1c2
5 changed files with 7 additions and 4 deletions

View File

@@ -4,7 +4,8 @@ use tinybmp::{Bmp, Pixel};
fn main() {
let mut writer = AniMeDbusWriter::new().unwrap();
let bmp = Bmp::from_slice(include_bytes!("test.bmp")).expect("Failed to parse BMP image");
let bmp =
Bmp::from_slice(include_bytes!("non-skewed_r.bmp")).expect("Failed to parse BMP image");
let pixels: Vec<Pixel> = bmp.into_iter().collect();
//assert_eq!(pixels.len(), 56 * 56);
@@ -13,8 +14,10 @@ fn main() {
// Aligned left
for px in pixels {
if (px.x as usize) < WIDTH {
matrix.get_mut()[px.y as usize][px.x as usize] = px.color as u8;
if (px.x as usize / 2) < WIDTH && (px.y as usize) < HEIGHT {
if px.x % 2 == 0 {
matrix.get_mut()[px.y as usize][px.x as usize / 2] = px.color as u8;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
aura/examples/test2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -69,7 +69,7 @@ impl AniMeMatrix {
let index = row.len() - prog_row_len;
if count % 2 == 0 {
print!(" ");
print!(" ");
}
for (i, x) in row.iter().enumerate() {
if i >= index {