2023-09-04 21:55:20 -05:00
|
|
|
use fimg::*;
|
|
|
|
|
2023-09-06 22:02:44 -05:00
|
|
|
fn overlay_3on3at() {
|
2023-10-03 22:19:52 -05:00
|
|
|
let mut a = fimg::make!(3 channels 128 x 128);
|
2023-09-06 22:02:44 -05:00
|
|
|
let b: Image<&[u8], 3> = Image::build(8, 8).buf(include_bytes!("3_8x8.imgbuf"));
|
|
|
|
for x in 0..16 {
|
|
|
|
for y in 0..16 {
|
|
|
|
unsafe { a.as_mut().overlay_at(&b, x * 8, y * 8) };
|
2023-09-04 21:55:20 -05:00
|
|
|
}
|
2023-09-06 22:02:44 -05:00
|
|
|
}
|
2023-09-04 21:55:20 -05:00
|
|
|
}
|
|
|
|
|
2023-09-06 22:02:44 -05:00
|
|
|
fn overlay_4on3at() {
|
2023-10-03 22:19:52 -05:00
|
|
|
let mut a = fimg::make!(3 channels 128 x 128);
|
2023-09-06 22:02:44 -05:00
|
|
|
let b: Image<&[u8], 4> = Image::build(8, 8).buf(include_bytes!("4_8x8.imgbuf"));
|
|
|
|
for x in 0..16 {
|
|
|
|
for y in 0..16 {
|
|
|
|
unsafe { a.as_mut().overlay_at(&b, x * 8, y * 8) };
|
2023-09-04 21:55:20 -05:00
|
|
|
}
|
2023-09-06 22:02:44 -05:00
|
|
|
}
|
2023-09-04 21:55:20 -05:00
|
|
|
}
|
|
|
|
|
2023-09-06 22:02:44 -05:00
|
|
|
fn overlay_4on4at() {
|
2023-10-03 22:19:52 -05:00
|
|
|
let mut a = fimg::make!(4 channels 128 x 128);
|
2023-09-06 22:02:44 -05:00
|
|
|
let b: Image<&[u8], 4> = Image::build(8, 8).buf(include_bytes!("4_8x8.imgbuf"));
|
|
|
|
for x in 0..16 {
|
|
|
|
for y in 0..16 {
|
|
|
|
unsafe { a.as_mut().overlay_at(&b, x * 8, y * 8) };
|
2023-09-04 21:55:20 -05:00
|
|
|
}
|
2023-09-06 22:02:44 -05:00
|
|
|
}
|
2023-09-04 21:55:20 -05:00
|
|
|
}
|
2023-09-06 22:02:44 -05:00
|
|
|
iai::main!(overlay_3on3at, overlay_4on3at, overlay_4on4at);
|