28 lines
591 B
Rust
28 lines
591 B
Rust
mod stuff;
|
|
|
|
use stuff::ImgBufU8;
|
|
use image::{ImageBuffer, Rgb};
|
|
use imageproc::drawing;
|
|
|
|
fn main() {
|
|
let output_path = "output.png";
|
|
let image_width = 800;
|
|
let image_height = 600;
|
|
let background_color = Rgb([255u8, 255u8, 255u8]);
|
|
let color = Rgb([0u8, 0u8, 0u8]);
|
|
|
|
let mut img: ImgBufU8 = ImageBuffer::new(image_width, image_height);
|
|
|
|
for pixel in img.pixels_mut() {
|
|
*pixel = background_color;
|
|
}
|
|
|
|
drawing::draw_line_segment_mut(
|
|
&mut img,
|
|
(10.0, 10.0),
|
|
(90.0, 90.0),
|
|
color);
|
|
|
|
img.save(output_path).unwrap();
|
|
}
|