first commit

main
serr 2025-06-24 19:48:48 +03:00
commit 90e1c4356f
6 changed files with 1306 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

1267
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

8
Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "L-systems"
version = "0.1.0"
edition = "2024"
[dependencies]
image = "0.25.6"
imageproc = "0.25.0"

BIN
output.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

27
src/main.rs Normal file
View File

@ -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();
}

3
src/stuff.rs Normal file
View File

@ -0,0 +1,3 @@
use image::{ImageBuffer, Rgb};
pub type ImgBufU8 = ImageBuffer<Rgb<u8>, Vec<u8>>;