Source code for wsipipe.utils.geometry

from typing import NamedTuple


[docs]class Point(NamedTuple): """an x y point in integers""" x: int y: int
[docs]class PointF(NamedTuple): """an x y point in floating numbers""" x: float y: float
[docs]class Address(NamedTuple): """a row and column point""" row: int col: int
[docs]class Size(NamedTuple): """size given by width and height""" width: int height: int
[docs] def as_shape(self): return Shape(self.height, self.width)
[docs]class Shape(NamedTuple): """chape given by rows and columns""" num_rows: int num_cols: int
[docs] def as_size(self): return Size(self.num_cols, self.num_rows)