MCPcopy Create free account
hub / github.com/BIT-DataLab/Edit-Banana / __init__

Method __init__

modules/text/coord_processor.py:23–31  ·  view source on GitHub ↗
(self, source_width: int, source_height: int,
                 canvas_width: int = None, canvas_height: int = None)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected