feat: graph-ir (continueing #6) #10
5 changed files with 15 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
|||
use rpl::instructions::{FilterInstruction, Instruction};
|
||||
use rpl::instructions::{Filter, Instruction};
|
||||
|
||||
use crate::value::Dynamic;
|
||||
mod instructions;
|
||||
|
@ -25,12 +25,12 @@ impl crate::Executor for Executor {
|
|||
Instruction::Blend(_) => todo!(),
|
||||
Instruction::Noise(_) => todo!(),
|
||||
Instruction::Filter(filter_instruction) => match filter_instruction {
|
||||
FilterInstruction::Invert => Some(Dynamic::Image(
|
||||
instructions::filters::invert::invert(match input {
|
||||
Filter::Invert => Some(Dynamic::Image(instructions::filters::invert::invert(
|
||||
match input {
|
||||
Some(Dynamic::Image(img)) => img,
|
||||
_ => panic!("invalid value type for invert"),
|
||||
}),
|
||||
)),
|
||||
},
|
||||
))),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ pub mod write;
|
|||
pub enum Instruction {
|
||||
Read(read::Read),
|
||||
Write(write::Write),
|
||||
Math(MathInstruction),
|
||||
Blend(BlendInstruction),
|
||||
Noise(NoiseInstruction),
|
||||
Filter(FilterInstruction),
|
||||
Math(Math),
|
||||
Blend(Blend),
|
||||
Noise(Noise),
|
||||
Filter(Filter),
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
||||
pub enum MathInstruction {
|
||||
pub enum Math {
|
||||
Add,
|
||||
Subtract,
|
||||
Multiply,
|
||||
|
@ -22,7 +22,7 @@ pub enum MathInstruction {
|
|||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
||||
pub enum BlendInstruction {
|
||||
pub enum Blend {
|
||||
Normal,
|
||||
Multiply,
|
||||
Additive,
|
||||
|
@ -35,13 +35,13 @@ pub enum BlendInstruction {
|
|||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
||||
pub enum NoiseInstruction {
|
||||
pub enum Noise {
|
||||
Perlin,
|
||||
Simplex,
|
||||
Voronoi,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
||||
pub enum FilterInstruction {
|
||||
pub enum Filter {
|
||||
Invert,
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ mod tests {
|
|||
use crate::instructions::{
|
||||
read::{SourceFormat, SourceType},
|
||||
write::{TargetFormat, TargetType},
|
||||
MathInstruction,
|
||||
Math,
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
@ -40,7 +40,7 @@ mod tests {
|
|||
source: SourceType::File("~/example/file.png".into()),
|
||||
format: SourceFormat::Png
|
||||
}),
|
||||
Instruction::Math(MathInstruction::Add),
|
||||
Instruction::Math(Math::Add),
|
||||
Instruction::Write(instructions::write::Write {
|
||||
target: TargetType::File("~/example/out.jpg".into()),
|
||||
format: TargetFormat::Jpeg
|
||||
|
|
Loading…
Reference in a new issue