| 1 | from math import pi |
| 2 | from pathlib import Path |
| 3 | import cairo |
| 4 | |
| 5 | |
| 6 | def draw(cr, width, height): |
| 7 | |
| 8 | cr.scale(width, height) |
| 9 | cr.arc(0.5, 0.5, 0.25, 0, 2 * pi) |
| 10 | cr.clip() |
| 11 | |
| 12 | image = cairo.ImageSurface.create_from_png( |
| 13 | Path(__file__).parent / "romedalen.png" |
| 14 | ) |
| 15 | w, h = image.get_width(), image.get_height() |
| 16 | cr.scale(1 / w, 1 / h) |
| 17 | |
| 18 | cr.set_source_surface(image) |
| 19 | cr.paint() |