1use graphics::{Image, Transformed};
2use graphics_buffer::*;
3
4fn main() {
5 let matt = RenderBuffer::decode_from_bytes(include_bytes!("matt.jpg")).unwrap();
7
8 let mut buffer = RenderBuffer::new(matt.width() * 2, matt.height() * 2);
10 buffer.clear([0.0, 0.0, 0.0, 1.0]);
11
12 for (color, (x, y)) in &[
14 ([1.0, 0.2, 0.2, 1.0], (0.0, 0.0)), ([1.0, 1.0, 0.0, 1.0], (matt.width() as f64, 0.0)), ([0.0, 1.0, 0.0, 1.0], (0.0, matt.height() as f64)), (
18 [0.2, 0.2, 1.0, 1.0], (matt.width() as f64, matt.height() as f64), ),
21 ] {
22 Image::new_color(*color).draw(
23 &matt,
24 &Default::default(),
25 IDENTITY.trans(*x, *y),
26 &mut buffer,
27 );
28 }
29
30 buffer.save("tiled.png").unwrap();
32}