Added tint and opacity

This commit is contained in:
Will McGugan
2022-06-30 21:41:37 +01:00
parent 410fc91a0e
commit 81481a0e16
8 changed files with 136 additions and 91 deletions

View File

@@ -140,8 +140,8 @@ class Size(NamedTuple):
return Region(0, 0, width, height)
@property
def lines(self) -> list[int]:
return list(range(self.height))
def lines_range(self) -> range:
return range(self.height)
def __add__(self, other: object) -> Size:
if isinstance(other, tuple):
@@ -310,21 +310,21 @@ class Region(NamedTuple):
return bool(self.width and self.height)
@property
def x_extents(self) -> tuple[int, int]:
"""Get the starting and ending x coord.
def column_span(self) -> tuple[int, int]:
"""Get the start and end column (x coord).
The end value is non inclusive.
The end value is exclusive.
Returns:
tuple[int, int]: Pair of x coordinates (row numbers).
tuple[int, int]: Pair of x coordinates (column numbers).
"""
return (self.x, self.x + self.width)
@property
def y_extents(self) -> tuple[int, int]:
"""Get the starting and ending x coord.
def line_span(self) -> tuple[int, int]:
"""Get the star and end line number (y coord).
The end value is non inclusive.
The end value is exclusive.
Returns:
tuple[int, int]: Pair of y coordinates (line numbers).
@@ -385,12 +385,12 @@ class Region(NamedTuple):
return x, y, x + width, y + height
@property
def x_range(self) -> range:
def column_range(self) -> range:
"""A range object for X coordinates."""
return range(self.x, self.x + self.width)
@property
def y_range(self) -> range:
def line_range(self) -> range:
"""A range object for Y coordinates."""
return range(self.y, self.y + self.height)