mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-27 16:34:05 +00:00
Add "Blend" node (#1024)
* Add Blend node * Add more implementations Currently, known buggy implementations: * Color Burn * Saturation Opacity is currently achieved by linear interpolation, this will be changed as soon as all filters are implemented. * Add more implementations Currently, known incorrect implementations: * Color Burn * Saturation Not yet Tested: * Linear Burn * Linear Dodge * Vivid Light * Linear Light * Pin Light * Hard Mix * Subtract * Divide Opacity is currently achieved by linear interpolation, this will be changed as soon as all filters are implemented. * Cleanup * Removed Unused Code * Fixed Clamping Issue * Fixed Inverted Opacity * Moved Opacity Calculation from individual Blend Functions into 'blend_node' function * Fix 'Color Burn' blend mode Currently, known incorrect implementations: * Saturation Not yet Tested: * Linear Burn * Darker Color * Linear Dodge * Lighter Color * Vivid Light * Linear Light * Pin Light * Hard Mix * Subtract * Divide Opacity is currently achieved by linear interpolation, this will be changed as soon as all filters are implemented. * Fix 'Saturation' blend mode Currently, known incorrect implementations: * None :D Not yet Tested: * Linear Burn * Darker Color * Linear Dodge * Lighter Color * Vivid Light * Linear Light * Pin Light * Hard Mix * Subtract * Divide Opacity is currently achieved by linear interpolation, this will be changed as soon as all filters are implemented. * Final Cleanups * Add proper Inputs * cargo fmt * Add test for doubling number * Display implementation for ProtoNetwork * Switch top and bottom * Add input types for blend image node * Fix test --------- Co-authored-by: 0hypercube <0hypercube@gmail.com> Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
parent
48dcc2774b
commit
8fe19063c1
10 changed files with 534 additions and 10 deletions
|
@ -115,4 +115,49 @@ mod tests {
|
|||
let val = *dyn_any::downcast::<u32>(result).unwrap();
|
||||
assert_eq!(val, 33_u32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn double_number() {
|
||||
use graph_craft::document::*;
|
||||
|
||||
use graph_craft::*;
|
||||
|
||||
let network = NodeNetwork {
|
||||
inputs: vec![0],
|
||||
outputs: vec![NodeOutput::new(1, 0)],
|
||||
nodes: [
|
||||
// Simple identity node taking a number as input from ouside the graph
|
||||
(
|
||||
0,
|
||||
DocumentNode {
|
||||
name: "id".into(),
|
||||
inputs: vec![NodeInput::Network(concrete!(u32))],
|
||||
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")),
|
||||
metadata: DocumentNodeMetadata::default(),
|
||||
},
|
||||
),
|
||||
// An add node adding the result of the id node to its self
|
||||
(
|
||||
1,
|
||||
DocumentNode {
|
||||
name: "Add".into(),
|
||||
inputs: vec![NodeInput::node(0, 0), NodeInput::node(0, 0)],
|
||||
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::AddParameterNode<_>")),
|
||||
metadata: DocumentNodeMetadata::default(),
|
||||
},
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.collect(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
use crate::executor::DynamicExecutor;
|
||||
use graph_craft::executor::{Compiler, Executor};
|
||||
|
||||
let compiler = Compiler {};
|
||||
let protograph = compiler.compile_single(network, true).expect("Graph should be generated");
|
||||
|
||||
let exec = DynamicExecutor::new(protograph).map(|e| panic!("The network should not type check: {:#?}", e)).unwrap_err();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue