33#[ cfg( feature = "alloc" ) ]
44use crate :: raster:: curve:: { Curve , CurveManipulatorGroup , ValueMapperNode } ;
55#[ cfg( feature = "alloc" ) ]
6- use crate :: raster:: image:: { ImageFrame , ImageFrameTable } ;
6+ use crate :: raster:: image:: { Image , ImageFrameTable } ;
77use crate :: raster:: { Channel , Color , Pixel } ;
88use crate :: registry:: types:: { Angle , Percentage , SignedPercentage } ;
99use crate :: vector:: style:: GradientStops ;
@@ -605,15 +605,13 @@ impl Blend<Color> for ImageFrameTable<Color> {
605605 let mut result = self . clone ( ) ;
606606
607607 for ( over, under) in result. instances_mut ( ) . zip ( under. instances ( ) ) {
608- let data = over. instance . image . data . iter ( ) . zip ( under. instance . image . data . iter ( ) ) . map ( |( a, b) | blend_fn ( * a, * b) ) . collect ( ) ;
609-
610- * over. instance = ImageFrame {
611- image : super :: Image {
612- data,
613- width : over. instance . image . width ,
614- height : over. instance . image . height ,
615- base64_string : None ,
616- } ,
608+ let data = over. instance . data . iter ( ) . zip ( under. instance . data . iter ( ) ) . map ( |( a, b) | blend_fn ( * a, * b) ) . collect ( ) ;
609+
610+ * over. instance = Image {
611+ data,
612+ width : over. instance . width ,
613+ height : over. instance . height ,
614+ base64_string : None ,
617615 } ;
618616 }
619617
@@ -738,11 +736,11 @@ impl<P: Pixel> Adjust<P> for ImageFrameTable<P>
738736where
739737 P : dyn_any:: StaticType ,
740738 P :: Static : Pixel ,
741- GraphicElement : From < ImageFrame < P > > ,
739+ GraphicElement : From < Image < P > > ,
742740{
743741 fn adjust ( & mut self , map_fn : impl Fn ( & P ) -> P ) {
744742 for instance in self . instances_mut ( ) {
745- for c in instance. instance . image . data . iter_mut ( ) {
743+ for c in instance. instance . data . iter_mut ( ) {
746744 * c = map_fn ( c) ;
747745 }
748746 }
@@ -1386,7 +1384,7 @@ impl<P: Pixel> MultiplyAlpha for ImageFrameTable<P>
13861384where
13871385 P : dyn_any:: StaticType ,
13881386 P :: Static : Pixel ,
1389- GraphicElement : From < ImageFrame < P > > ,
1387+ GraphicElement : From < Image < P > > ,
13901388{
13911389 fn multiply_alpha ( & mut self , factor : f64 ) {
13921390 for instance in self . instances_mut ( ) {
@@ -1539,13 +1537,13 @@ fn color_overlay<T: Adjust<Color>>(
15391537
15401538// #[cfg(feature = "alloc")]
15411539// mod index_node {
1542- // use crate::raster::{Color, ImageFrame };
1540+ // use crate::raster::{Color, Image };
15431541// use crate::Ctx;
15441542
15451543// #[node_macro::node(category(""))]
15461544// pub fn index<T: Default + Clone>(
15471545// _: impl Ctx,
1548- // #[implementations(Vec<ImageFrame <Color>>, Vec<Color>)]
1546+ // #[implementations(Vec<Image <Color>>, Vec<Color>)]
15491547// #[widget(ParsedWidgetOverride::Hidden)]
15501548// input: Vec<T>,
15511549// index: u32,
@@ -1561,7 +1559,7 @@ fn color_overlay<T: Adjust<Color>>(
15611559
15621560#[ cfg( test) ]
15631561mod test {
1564- use crate :: raster:: image:: { ImageFrame , ImageFrameTable } ;
1562+ use crate :: raster:: image:: { Image , ImageFrameTable } ;
15651563 use crate :: raster:: { BlendMode , Image } ;
15661564 use crate :: { Color , Node } ;
15671565 use std:: pin:: Pin ;
@@ -1580,7 +1578,7 @@ mod test {
15801578 #[ tokio:: test]
15811579 async fn color_overlay_multiply ( ) {
15821580 let image_color = Color :: from_rgbaf32_unchecked ( 0.7 , 0.6 , 0.5 , 0.4 ) ;
1583- let image = ImageFrame { image : Image :: new ( 1 , 1 , image_color) } ;
1581+ let image = Image :: new ( 1 , 1 , image_color) ;
15841582
15851583 // Color { red: 0., green: 1., blue: 0., alpha: 1. }
15861584 let overlay_color = Color :: GREEN ;
@@ -1592,6 +1590,6 @@ mod test {
15921590 let result = result. one_instance ( ) . instance ;
15931591
15941592 // The output should just be the original green and alpha channels (as we multiply them by 1 and other channels by 0)
1595- assert_eq ! ( result. image . data[ 0 ] , Color :: from_rgbaf32_unchecked( 0. , image_color. g( ) , 0. , image_color. a( ) ) ) ;
1593+ assert_eq ! ( result. data[ 0 ] , Color :: from_rgbaf32_unchecked( 0. , image_color. g( ) , 0. , image_color. a( ) ) ) ;
15961594 }
15971595}
0 commit comments