feat: graph-ir (continueing #6) #10
4 changed files with 1 additions and 10 deletions
|
@ -2,7 +2,7 @@ pub mod read {
|
|||
use image::{io::Reader as ImageReader, DynamicImage};
|
||||
use ir::instruction::read::{Read, SourceType};
|
||||
|
||||
pub fn read(Read { source, .. }: Read) -> DynamicImage {
|
||||
pub fn read(Read { source }: Read) -> DynamicImage {
|
||||
// TODO: actual error handling
|
||||
let img = ImageReader::open(match source {
|
||||
SourceType::File(path) => path,
|
||||
|
|
|
@ -4,16 +4,9 @@ use std::path::PathBuf;
|
|||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
pub struct Read {
|
||||
pub source: SourceType,
|
||||
pub format: SourceFormat,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
pub enum SourceType {
|
||||
File(PathBuf),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
pub enum SourceFormat {
|
||||
Jpeg,
|
||||
Png,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
instructions: {
|
||||
0: Read((
|
||||
source: File("testfiles/rails.png"),
|
||||
format: Png,
|
||||
)),
|
||||
1: Write((
|
||||
target: File("testfiles/gen/out.jpg"),
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
instructions: {
|
||||
0: Read((
|
||||
source: File("testfiles/rails.png"),
|
||||
format: Png,
|
||||
)),
|
||||
1: Filter(Invert),
|
||||
2: Write((
|
||||
|
|
Loading…
Reference in a new issue