extern crate agg;
use agg::PixelData;
use agg::Pixel;
fn draw_black_frame(pix: &mut agg::Pixfmt<agg::Rgb8>) {
let w = pix.width();
let h = pix.height();
for i in 0 .. h {
pix.set((0,i),agg::Rgb8::black()); pix.set((w-1,i),agg::Rgb8::black()); }
for i in 0 .. w {
pix.set((i,0), agg::Rgb8::black()); pix.set((i,h-1), agg::Rgb8::black()); }
}
#[test]
fn t01_rendering_buffer() {
let mut pix = agg::Pixfmt::<agg::Rgb8>::new(320, 220);
for i in 0 .. pix.width() {
for j in 0 .. pix.height() {
pix.set((i,j), agg::Rgb8::white());
}
}
draw_black_frame(&mut pix);
for i in 0 .. pix.height()/2 {
pix.set((i,i), agg::Rgb8::new(127,200,98));
}
agg::ppm::write_ppm(&pix.pixeldata(), pix.width(), pix.height(), "agg_test_01.ppm").unwrap();
agg::ppm::compare_ppm("agg_test_01.ppm", "tests/agg_test_01.ppm");
}