(self, ctx)
| 91 | super().__init__() |
| 92 | |
| 93 | def set_context(self, ctx): |
| 94 | surface = ctx.get_target() |
| 95 | if hasattr(surface, "get_width") and hasattr(surface, "get_height"): |
| 96 | size = surface.get_width(), surface.get_height() |
| 97 | elif hasattr(surface, "get_extents"): # GTK4 RecordingSurface. |
| 98 | ext = surface.get_extents() |
| 99 | size = ext.width, ext.height |
| 100 | else: # vector surfaces. |
| 101 | ctx.save() |
| 102 | ctx.reset_clip() |
| 103 | rect, *rest = ctx.copy_clip_rectangle_list() |
| 104 | if rest: |
| 105 | raise TypeError("Cannot infer surface size") |
| 106 | _, _, *size = rect |
| 107 | ctx.restore() |
| 108 | self.gc.ctx = ctx |
| 109 | self.width, self.height = size |
| 110 | |
| 111 | @staticmethod |
| 112 | def _fill_and_stroke(ctx, fill_c, alpha, alpha_overrides): |
no test coverage detected