diff --git a/node-graph/nodes/math/src/lib.rs b/node-graph/nodes/math/src/lib.rs index 987f962095..b2230425b4 100644 --- a/node-graph/nodes/math/src/lib.rs +++ b/node-graph/nodes/math/src/lib.rs @@ -861,7 +861,7 @@ fn hex_to_color(_: impl Ctx, hex_code: String) -> List { /// Constructs a gradient value which may be set to any sequence of color stops to represent the transition between colors. #[node_macro::node(category("Value"))] -fn gradient_value(_: impl Ctx, _primary: (), gradient: List) -> List { +fn gradient_value(_: impl Ctx, _primary: (), gradient: GradientStops) -> GradientStops { gradient } diff --git a/node-graph/nodes/raster/src/blending_nodes.rs b/node-graph/nodes/raster/src/blending_nodes.rs index ab7378b636..f4f9a7845c 100644 --- a/node-graph/nodes/raster/src/blending_nodes.rs +++ b/node-graph/nodes/raster/src/blending_nodes.rs @@ -27,6 +27,18 @@ mod blend_std { use raster_types::Image; use raster_types::Raster; + impl Blend for Raster { + fn blend(&self, under: &Self, blend_fn: impl Fn(Color, Color) -> Color) -> Self { + let data = self.data.iter().zip(under.data.iter()).map(|(a, b)| blend_fn(*a, *b)).collect(); + Raster::new_cpu(Image { + data, + width: self.width, + height: self.height, + base64_string: None, + }) + } + } + impl Blend for List> { fn blend(&self, under: &Self, blend_fn: impl Fn(Color, Color) -> Color) -> Self { let mut result_list = self.clone(); @@ -141,21 +153,22 @@ pub fn apply_blend_mode(foreground: Color, background: Color, blend_mode: BlendM } } +#[cfg(feature = "std")] #[node_macro::node(category("Raster"), cfg(feature = "std"))] -fn mix + Send>( +fn mix + Clone + Send + Sync + core_types::CacheHash + 'static>( _: impl Ctx, #[implementations( - List>, - List, - List, + Raster, + Color, + GradientStops, )] #[gpu_image] over: T, #[expose] #[implementations( - List>, - List, - List, + Raster, + Color, + GradientStops, )] #[gpu_image] under: T,