@@ -246,6 +246,8 @@ def draw_background(stream, bg, clip_box=True, bleed=None, marks=()):
246
246
# Background color
247
247
if bg .color .alpha > 0 :
248
248
with stacked (stream ):
249
+ stream .set_color_rgb (* bg .color [:3 ])
250
+ stream .set_alpha (bg .color .alpha )
249
251
painting_area = bg .layers [- 1 ].painting_area
250
252
if painting_area :
251
253
if bleed :
@@ -259,8 +261,6 @@ def draw_background(stream, bg, clip_box=True, bleed=None, marks=()):
259
261
stream .clip ()
260
262
stream .end ()
261
263
stream .rectangle (* stream .page_rectangle )
262
- stream .set_color_rgb (* bg .color [:3 ])
263
- stream .set_alpha (bg .color .alpha )
264
264
stream .fill ()
265
265
266
266
if bleed and marks :
@@ -686,37 +686,38 @@ def draw_dots(dashes, line, way, x, y, px, py, chl):
686
686
687
687
688
688
def draw_rounded_border (stream , box , style , color ):
689
- rounded_box_path (stream , box .rounded_padding_box ())
690
689
if style in ('ridge' , 'groove' ):
691
- rounded_box_path (stream , box .rounded_box_ratio (1 / 2 ))
692
690
stream .set_color_rgb (* color [0 ][:3 ])
693
691
stream .set_alpha (color [0 ][3 ])
694
- stream . fill ( even_odd = True )
692
+ rounded_box_path ( stream , box . rounded_padding_box () )
695
693
rounded_box_path (stream , box .rounded_box_ratio (1 / 2 ))
696
- rounded_box_path ( stream , box . rounded_border_box () )
694
+ stream . fill ( even_odd = True )
697
695
stream .set_color_rgb (* color [1 ][:3 ])
698
696
stream .set_alpha (color [1 ][3 ])
697
+ rounded_box_path (stream , box .rounded_box_ratio (1 / 2 ))
698
+ rounded_box_path (stream , box .rounded_border_box ())
699
699
stream .fill (even_odd = True )
700
700
return
701
+ stream .set_color_rgb (* color [:3 ])
702
+ stream .set_alpha (color [3 ])
703
+ rounded_box_path (stream , box .rounded_padding_box ())
701
704
if style == 'double' :
702
705
rounded_box_path (stream , box .rounded_box_ratio (1 / 3 ))
703
706
rounded_box_path (stream , box .rounded_box_ratio (2 / 3 ))
704
707
rounded_box_path (stream , box .rounded_border_box ())
705
- stream .set_color_rgb (* color [:3 ])
706
- stream .set_alpha (color [3 ])
707
708
stream .fill (even_odd = True )
708
709
709
710
710
711
def draw_rect_border (stream , box , widths , style , color ):
711
712
bbx , bby , bbw , bbh = box
712
713
bt , br , bb , bl = widths
713
- stream .rectangle (* box )
714
714
if style in ('ridge' , 'groove' ):
715
+ stream .set_color_rgb (* color [0 ][:3 ])
716
+ stream .set_alpha (color [0 ][3 ])
717
+ stream .rectangle (* box )
715
718
stream .rectangle (
716
719
bbx + bl / 2 , bby + bt / 2 ,
717
720
bbw - (bl + br ) / 2 , bbh - (bt + bb ) / 2 )
718
- stream .set_color_rgb (* color [0 ][:3 ])
719
- stream .set_alpha (color [0 ][3 ])
720
721
stream .fill (even_odd = True )
721
722
stream .rectangle (
722
723
bbx + bl / 2 , bby + bt / 2 ,
@@ -726,6 +727,9 @@ def draw_rect_border(stream, box, widths, style, color):
726
727
stream .set_alpha (color [1 ][3 ])
727
728
stream .fill (even_odd = True )
728
729
return
730
+ stream .set_color_rgb (* color [:3 ])
731
+ stream .set_alpha (color [3 ])
732
+ stream .rectangle (* box )
729
733
if style == 'double' :
730
734
stream .rectangle (
731
735
bbx + bl / 3 , bby + bt / 3 ,
@@ -734,8 +738,6 @@ def draw_rect_border(stream, box, widths, style, color):
734
738
bbx + bl * 2 / 3 , bby + bt * 2 / 3 ,
735
739
bbw - (bl + br ) * 2 / 3 , bbh - (bt + bb ) * 2 / 3 )
736
740
stream .rectangle (bbx + bl , bby + bt , bbw - bl - br , bbh - bt - bb )
737
- stream .set_color_rgb (* color [:3 ])
738
- stream .set_alpha (color [3 ])
739
741
stream .fill (even_odd = True )
740
742
741
743
0 commit comments