first commit
commit
90e1c4356f
|
@ -0,0 +1 @@
|
||||||
|
/target
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "L-systems"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
image = "0.25.6"
|
||||||
|
imageproc = "0.25.0"
|
Binary file not shown.
After Width: | Height: | Size: 8.9 KiB |
|
@ -0,0 +1,27 @@
|
||||||
|
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();
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
use image::{ImageBuffer, Rgb};
|
||||||
|
|
||||||
|
pub type ImgBufU8 = ImageBuffer<Rgb<u8>, Vec<u8>>;
|
Loading…
Reference in New Issue