extern crate image;
extern crate imageproc;
use std::env;
use std::path::Path;
use image::{Rgb, RgbImage};
use imageproc::rect::Rect;
use imageproc::drawing::{
draw_cross_mut,
draw_line_segment_mut,
draw_hollow_rect_mut,
draw_filled_rect_mut,
draw_hollow_circle_mut,
draw_filled_circle_mut
};
fn main() {
let arg = if env::args().count() == 2 {
env::args().nth(1).unwrap()
} else {
panic!("Please enter a target file path")
};
let path = Path::new(&arg);
let red = Rgb([255u8, 0u8, 0u8]);
let green = Rgb([0u8, 255u8, 0u8]);
let blue = Rgb([0u8, 0u8, 255u8]);
let white = Rgb([255u8, 255u8, 255u8]);
let mut image = RgbImage::new(200, 200);
draw_cross_mut(&mut image, white, 5, 5);
draw_cross_mut(&mut image, red, 9, 9);
draw_cross_mut(&mut image, blue, 9, 5);
draw_cross_mut(&mut image, green, 5, 9);
draw_cross_mut(&mut image, white, 250, 0);
draw_cross_mut(&mut image, white, 2, 0);
draw_line_segment_mut(&mut image, (20f32, 12f32), (40f32, 60f32), white);
draw_line_segment_mut(&mut image, (0f32, -30f32), (40f32, -20f32), white);
draw_line_segment_mut(&mut image, (20f32, 180f32), (20f32, 220f32), white);
draw_hollow_rect_mut(&mut image, Rect::at(60, 10).of_size(20, 20), white);
draw_hollow_rect_mut(&mut image, Rect::at(300, 10).of_size(20, 20), white);
draw_hollow_rect_mut(&mut image, Rect::at(90, -10).of_size(30, 20), white);
draw_filled_rect_mut(&mut image, Rect::at(130, 10).of_size(20, 20), white);
draw_filled_rect_mut(&mut image, Rect::at(300, 10).of_size(20, 20), white);
draw_filled_rect_mut(&mut image, Rect::at(180, -10).of_size(30, 20), white);
draw_hollow_circle_mut(&mut image, (100, 100), 15, white);
draw_hollow_circle_mut(&mut image, (400, 400), 20, white);
draw_hollow_circle_mut(&mut image, (100, 190), 20, white);
draw_filled_circle_mut(&mut image, (150, 100), 15, white);
draw_filled_circle_mut(&mut image, (450, 400), 20, white);
draw_filled_circle_mut(&mut image, (150, 190), 20, white);
let _ = image.save(path).unwrap();
}