| 119 | |
| 120 | |
| 121 | def draw_branch( |
| 122 | draw: ImageDraw.ImageDraw, |
| 123 | group_y: float, |
| 124 | leaf_ys: list[float], |
| 125 | color: tuple[int, int, int], |
| 126 | ) -> None: |
| 127 | stem_x = GROUP_X + 84 |
| 128 | leaf_join_x = LEAF_X - 26 |
| 129 | draw.line((ROOT_X + 72, group_y, GROUP_X - 64, group_y), fill=LINE, width=2) |
| 130 | draw.line((stem_x, min(leaf_ys), stem_x, max(leaf_ys)), fill=LINE, width=2) |
| 131 | draw.line((GROUP_X + 72, group_y, stem_x, group_y), fill=LINE, width=2) |
| 132 | for y in leaf_ys: |
| 133 | draw.line((stem_x, y, leaf_join_x, y), fill=LINE, width=2) |
| 134 | draw.ellipse((leaf_join_x - 5, y - 5, leaf_join_x + 5, y + 5), fill=color) |
| 135 | |
| 136 | |
| 137 | def draw_png() -> Image.Image: |