예제 #1
0
 def test_add_stop_color(self):
     rg = RadialGradient()
     rg.add_stop_color(offset=0.5, color='red', opacity=1.0)
     self.assertEqual(
         rg.tostring(),
         '<radialGradient><stop offset="0.5" stop-color="red" stop-opacity="1.0" /></radialGradient>'
     )
예제 #2
0
def draw_background(drawing):

    rad = RadialGradient(center=("50%", "50%"), r="50%", focal=("50%", "50%"))
    rad.add_stop_color(offset="0%", color="rgb(170,170,170)", opacity="1")
    rad.add_stop_color(offset="90%", color="rgb(0,0,0)", opacity="1")
    drawing.defs.add(rad)

    size = max(WIDTH, HEIGHT) / 1.25

    c = Circle(center=(WIDTH / 2, HEIGHT / 2),
               r=size,
               fill=rad.get_paint_server())

    drawing.add(c)
예제 #3
0
 def test_add_stop_color(self):
     rg = RadialGradient()
     rg.add_stop_color(offset=0.5, color='red', opacity=1.0)
     self.assertEqual(rg.tostring(), '<radialGradient><stop offset="0.5" stop-color="red" stop-opacity="1.0" /></radialGradient>')