mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Test bmp display
This commit is contained in:
@@ -1,34 +1,39 @@
|
||||
use rog_aura::{AniMeDbusWriter, AniMeMatrix, AniMePacketType};
|
||||
use rog_aura::{AniMeDbusWriter, AniMeMatrix, AniMePacketType, HEIGHT, WIDTH};
|
||||
use tinybmp::{Bmp, Pixel};
|
||||
|
||||
fn main() {
|
||||
let mut writer = AniMeDbusWriter::new().unwrap();
|
||||
|
||||
// loop {
|
||||
// for brightness in 0xFE..0xFF {
|
||||
// let mut matrix = AniMeMatrix::new();
|
||||
// matrix.fill_with(brightness);
|
||||
|
||||
// let mut matrix: AniMePacketType = AniMePacketType::from(matrix);
|
||||
// // println!("{:?}", matrix[0].to_vec());
|
||||
// // println!("{:?}", matrix[1].to_vec());
|
||||
|
||||
// writer.write_image(&mut matrix).unwrap();
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
let bmp = Bmp::from_slice(include_bytes!("test.bmp")).expect("Failed to parse BMP image");
|
||||
let pixels: Vec<Pixel> = bmp.into_iter().collect();
|
||||
//assert_eq!(pixels.len(), 56 * 56);
|
||||
|
||||
// Try an outline, top and right
|
||||
let mut matrix = AniMeMatrix::new();
|
||||
{
|
||||
let tmp = matrix.get_mut();
|
||||
for row in tmp.iter_mut() {
|
||||
row[row.len() - 1] = 0xff;
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
// Throw an alignment border up
|
||||
// {
|
||||
// let tmp = matrix.get_mut();
|
||||
// for x in tmp[0].iter_mut() {
|
||||
// *x = 0xff;
|
||||
// }
|
||||
// for row in tmp.iter_mut() {
|
||||
// row[row.len() - 1] = 0xff;
|
||||
// }
|
||||
// }
|
||||
|
||||
matrix.debug_print();
|
||||
|
||||
let mut matrix: AniMePacketType = AniMePacketType::from(matrix);
|
||||
println!("{:?}", matrix[0].to_vec());
|
||||
println!("{:?}", matrix[1].to_vec());
|
||||
// println!("{:?}", matrix[0].to_vec());
|
||||
// println!("{:?}", matrix[1].to_vec());
|
||||
|
||||
writer.write_image(&mut matrix).unwrap();
|
||||
}
|
||||
|
||||
BIN
aura/examples/rust.bmp
Normal file
BIN
aura/examples/rust.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
BIN
aura/examples/test-skinny-45deg.bmp
Normal file
BIN
aura/examples/test-skinny-45deg.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
aura/examples/test.bmp
Normal file
BIN
aura/examples/test.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Reference in New Issue
Block a user