#[macro_use] extern crate arrayref; use std::error::Error; use std::thread; use std::time::Duration; use std::f32::consts::PI; use image::{ Rgb, RgbImage }; use imageproc::rect::Rect; use imageproc::drawing::draw_filled_rect_mut; mod ilidisplay; mod forms; fn main() -> Result<(), Box> { let mut screen = forms::Screen::new(200, 200); let mut loader = forms::Loader::new("/root/helms-display".to_string()); let c = loader.load_form("compass-rose.svg").unwrap(); let b = loader.load_form("boat.svg").unwrap(); let cog = loader.load_form("cog.svg").unwrap(); let wind = loader.load_form("wind.svg").unwrap(); let font = loader.load_font("font.ttf").unwrap(); /* let mut img = RgbImage::new(480, 320); let thickness = 10; draw_filled_rect_mut(&mut img, Rect::at(0,0).of_size(240, 160), Rgb([255,0,0])); draw_filled_rect_mut(&mut img, Rect::at(0,160).of_size(240, 160), Rgb([0, 255, 0])); draw_filled_rect_mut(&mut img, Rect::at(240,0).of_size(240, 160), Rgb([0, 0, 255])); */ let mut e = ilidisplay::IliDisplay::init()?; e.init_chip(); e.turn_on(); for i in 0..10 { let rad = (i as f32) * 2.0*PI / 100.0; screen.clear(); screen.render(&cog, -rad*2.0, 500, 500); screen.render(&wind, rad*2.0, 500, 500); screen.render(&c, rad, 500, 500); screen.render(&b, 0.0, 500, 500); e.put_image(&(screen.image), ((240-100), (160-100))); } screen.save(); // draw_filled_rect_mut(&mut img, Rect::at(0,0).of_size(480, 320), Rgb([0, 0, 0])); println!("You should see image now, sleeping for 5s"); thread::sleep(Duration::from_millis(5000)); e.turn_off(); Ok(()) }