@@ -5,14 +5,15 @@ use core_types::ops::TableConvert;
55use core_types:: render_complexity:: RenderComplexity ;
66use core_types:: table:: { Table , TableRow } ;
77use core_types:: uuid:: NodeId ;
8- use core_types:: { ATTR_CLIPPING_MASK , ATTR_EDITOR_LAYER_PATH , ATTR_OPACITY , ATTR_OPACITY_FILL , ATTR_TRANSFORM , Color } ;
8+ use core_types:: { ATTR_CLIPPING_MASK , ATTR_EDITOR_LAYER_PATH , ATTR_GRADIENT_TYPE , ATTR_OPACITY , ATTR_OPACITY_FILL , ATTR_SPREAD_METHOD , ATTR_TRANSFORM , Color } ;
99use dyn_any:: DynAny ;
1010use glam:: DAffine2 ;
1111use raster_types:: { CPU , GPU , Raster } ;
1212use vector_types:: GradientStops ;
1313// use vector_types::Vector;
1414
1515pub use vector_types:: Vector ;
16+ use vector_types:: vector:: style:: Fill ;
1617
1718/// The possible forms of graphical content that can be rendered by the Render node into either an image or SVG syntax.
1819#[ derive( Clone , Debug , CacheHash , PartialEq , DynAny ) ]
@@ -193,6 +194,22 @@ fn flatten_graphic_table<T>(content: Table<Graphic>, extract_variant: fn(Graphic
193194 output
194195}
195196
197+ fn fill_to_paint ( fill : Fill ) -> Option < Table < Graphic > > {
198+ match fill {
199+ Fill :: None => None ,
200+ Fill :: Solid ( color) => Some ( Table :: new_from_element ( color. into ( ) ) ) ,
201+ Fill :: Gradient ( gradient) => {
202+ let gradient_row = TableRow :: new_from_element ( gradient. stops . clone ( ) )
203+ . with_attribute ( ATTR_TRANSFORM , gradient. to_transform ( ) )
204+ . with_attribute ( ATTR_GRADIENT_TYPE , gradient. gradient_type )
205+ . with_attribute ( ATTR_SPREAD_METHOD , gradient. spread_method ) ;
206+ let gradient_table = Table :: new_from_row ( gradient_row) ;
207+
208+ Some ( Table :: new_from_element ( Graphic :: Gradient ( gradient_table) ) )
209+ }
210+ }
211+ }
212+
196213/// Maps from a concrete element type to its corresponding `Graphic` enum variant,
197214/// enabling type-directed casting of typed `Table`s from a `Graphic` value.
198215pub trait TryFromGraphic : Clone + Sized {
0 commit comments