mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Introduce scopes (#1053)
* Implement let binding * Add lambda inputs * Fix tests * Fix proto network formatting * Generate a template Scoped network by default * Add comment to explain the lambda parameter * Move binding wrapping out of the template * Fix errors cause by image frames
This commit is contained in:
committed by
Keavon Chambers
parent
0b813805d2
commit
7254c008f9
@@ -131,13 +131,14 @@ pub struct BlendImageNode<Second, MapFn> {
|
||||
map_fn: MapFn,
|
||||
}
|
||||
|
||||
// TODO: Implement proper blending
|
||||
#[node_macro::node_fn(BlendImageNode)]
|
||||
fn blend_image<MapFn>(image: Image, second: Image, map_fn: &'any_input MapFn) -> Image
|
||||
fn blend_image<MapFn>(image: ImageFrame, second: ImageFrame, map_fn: &'any_input MapFn) -> ImageFrame
|
||||
where
|
||||
MapFn: for<'any_input> Node<'any_input, (Color, Color), Output = Color> + 'input,
|
||||
{
|
||||
let mut image = image;
|
||||
for (pixel, sec_pixel) in &mut image.data.iter_mut().zip(second.data.iter()) {
|
||||
for (pixel, sec_pixel) in &mut image.image.data.iter_mut().zip(second.image.data.iter()) {
|
||||
*pixel = map_fn.eval((*pixel, *sec_pixel));
|
||||
}
|
||||
image
|
||||
|
||||
Reference in New Issue
Block a user