"""Shared painting helpers for background scenes: gradients, soft glows, and the mockup's spread space."""
from svg_common import css_colour, num
SCENE_WIDTH, SCENE_HEIGHT = 1920, 1080
def in_spread_space(body, shift_y):
"""Scale mockup spread coordinates (960 x 450) by 2, shifted down by `shift_y`."""
return f'{body}'
def vertical_gradient(gradient_id, stops):
stop_text = "".join(f''
for offset, colour, opacity in stops)
return f'{stop_text}'
def radial_gradient(gradient_id, stops, centre=(0.5, 0.5), radius=0.5):
stop_text = "".join(f''
for offset, colour, opacity in stops)
return (f'{stop_text}')
def soft_ellipse_glow(gradient_id, colour_text, centre, radii, fade_from=0.0):
"""A CSS 'radial-gradient(rx ry at cx cy, colour, transparent)' over the full scene.
The gradient is drawn on a box sized 2*rx by 2*ry, so its bounding box makes the circle an ellipse."""
colour, opacity = css_colour(colour_text)
gradient = radial_gradient(gradient_id, [(fade_from, colour, opacity), (1, colour, 0)])
box_x, box_y = centre[0] - radii[0], centre[1] - radii[1]
shape = (f'')
return gradient, shape