feat: graph-ir (continueing #6) #10

Merged
schrottkatze merged 37 commits from schrottkatze/iowo:graph-ir into main 2024-01-23 12:55:01 +00:00
4 changed files with 1 additions and 10 deletions
Showing only changes of commit d79383a7df - Show all commits

View file

@ -2,7 +2,7 @@ pub mod read {
use image::{io::Reader as ImageReader, DynamicImage}; use image::{io::Reader as ImageReader, DynamicImage};
use ir::instruction::read::{Read, SourceType}; use ir::instruction::read::{Read, SourceType};
pub fn read(Read { source, .. }: Read) -> DynamicImage { pub fn read(Read { source }: Read) -> DynamicImage {
// TODO: actual error handling // TODO: actual error handling
let img = ImageReader::open(match source { let img = ImageReader::open(match source {
SourceType::File(path) => path, SourceType::File(path) => path,

View file

@ -4,16 +4,9 @@ use std::path::PathBuf;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct Read { pub struct Read {
pub source: SourceType, pub source: SourceType,
pub format: SourceFormat,
} }
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum SourceType { pub enum SourceType {
File(PathBuf), File(PathBuf),
} }
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum SourceFormat {
Jpeg,
Png,
}

View file

@ -2,7 +2,6 @@
instructions: { instructions: {
0: Read(( 0: Read((
source: File("testfiles/rails.png"), source: File("testfiles/rails.png"),
format: Png,
)), )),
1: Write(( 1: Write((
target: File("testfiles/gen/out.jpg"), target: File("testfiles/gen/out.jpg"),

View file

@ -2,7 +2,6 @@
instructions: { instructions: {
0: Read(( 0: Read((
source: File("testfiles/rails.png"), source: File("testfiles/rails.png"),
format: Png,
)), )),
1: Filter(Invert), 1: Filter(Invert),
2: Write(( 2: Write((