@@ -7,7 +7,7 @@ use accesskit::{Node, Role};
77use smallvec:: { smallvec, SmallVec } ;
88use tracing:: { trace_span, warn, Span } ;
99use vello:: kurbo:: { Affine , RoundedRectRadii } ;
10- use vello:: peniko:: { Brush , Color , Fill } ;
10+ use vello:: peniko:: { Brush , Fill } ;
1111use vello:: Scene ;
1212
1313use crate :: paint_scene_helpers:: stroke;
@@ -22,7 +22,7 @@ use crate::{
2222/// Something that can be used as the border for a widget.
2323struct BorderStyle {
2424 width : f64 ,
25- color : Color ,
25+ brush : Brush ,
2626}
2727
2828/// Padding specifies the spacing between the edges of the box and the child view.
@@ -292,10 +292,10 @@ impl SizedBox {
292292 self
293293 }
294294
295- /// Builder-style method for painting a border around the widget with a color and width.
296- pub fn border ( mut self , color : impl Into < Color > , width : impl Into < f64 > ) -> Self {
295+ /// Builder-style method for painting a border around the widget with a brush and width.
296+ pub fn border ( mut self , brush : impl Into < Brush > , width : impl Into < f64 > ) -> Self {
297297 self . border = Some ( BorderStyle {
298- color : color . into ( ) ,
298+ brush : brush . into ( ) ,
299299 width : width. into ( ) ,
300300 } ) ;
301301 self
@@ -386,14 +386,14 @@ impl SizedBox {
386386 this. ctx . request_paint_only ( ) ;
387387 }
388388
389- /// Paint a border around the widget with a color and width.
389+ /// Paint a border around the widget with a brush and width.
390390 pub fn set_border (
391391 this : & mut WidgetMut < ' _ , Self > ,
392- color : impl Into < Color > ,
392+ brush : impl Into < Brush > ,
393393 width : impl Into < f64 > ,
394394 ) {
395395 this. widget . border = Some ( BorderStyle {
396- color : color . into ( ) ,
396+ brush : brush . into ( ) ,
397397 width : width. into ( ) ,
398398 } ) ;
399399 this. ctx . request_layout ( ) ;
@@ -547,7 +547,7 @@ impl Widget for SizedBox {
547547 . to_rect ( )
548548 . inset ( border_width / -2.0 )
549549 . to_rounded_rect ( corner_radius) ;
550- stroke ( scene, & border_rect, border. color , border_width) ;
550+ stroke ( scene, & border_rect, & border. brush , border_width) ;
551551 } ;
552552 }
553553
@@ -574,7 +574,7 @@ impl Widget for SizedBox {
574574#[ cfg( test) ]
575575mod tests {
576576 use insta:: assert_debug_snapshot;
577- use vello:: peniko:: Gradient ;
577+ use vello:: peniko:: { Color , Gradient } ;
578578
579579 use super :: * ;
580580 use crate :: assert_render_snapshot;
0 commit comments