(self, source_width: int, source_height: int,
canvas_width: int = None, canvas_height: int = None)
| 21 | """Convert source image coordinates to canvas geometry with optional scaling.""" |
| 22 | |
| 23 | def __init__(self, source_width: int, source_height: int, |
| 24 | canvas_width: int = None, canvas_height: int = None): |
| 25 | self.source_width = source_width |
| 26 | self.source_height = source_height |
| 27 | self.canvas_width = canvas_width if canvas_width is not None else source_width |
| 28 | self.canvas_height = canvas_height if canvas_height is not None else source_height |
| 29 | self.scale_x = self.canvas_width / source_width |
| 30 | self.scale_y = self.canvas_height / source_height |
| 31 | self.uniform_scale = min(self.scale_x, self.scale_y) |
| 32 | |
| 33 | def normalize_polygon(self, polygon: list[tuple[float, float]]) -> NormalizedCoords: |
| 34 | """Normalize quadrilateral to canvas geometry.""" |
nothing calls this directly
no outgoing calls
no test coverage detected