"""
from typing import Union, Optional, Tuple
-from recordclass import recordclass
from PIL import Image
from ._bitmap import Bitmap
from ._colorconverter import ColorConverter
from ._ondiskbitmap import OnDiskBitmap
from ._shape import Shape
from ._palette import Palette
+from ._structs import RectangleStruct, TransformStruct
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
-Rectangle = recordclass("Rectangle", "x1 y1 x2 y2")
-Transform = recordclass("Transform", "x y dx dy scale transpose_xy mirror_x mirror_y")
-
class TileGrid:
# pylint: disable=too-many-instance-attributes
self._pixel_width = width * tile_width
self._pixel_height = height * tile_height
self._tiles = (self._width * self._height) * [default_tile]
- self.in_group = False
- self._absolute_transform = Transform(0, 0, 1, 1, 1, False, False, False)
- self._current_area = Rectangle(0, 0, self._pixel_width, self._pixel_height)
+ self._in_group = False
+ self._absolute_transform = TransformStruct(0, 0, 1, 1, 1, False, False, False)
+ self._current_area = RectangleStruct(
+ 0, 0, self._pixel_width, self._pixel_height
+ )
self._moved = False
def _update_transform(self, absolute_transform):
):
buffer.alpha_composite(image, (x, y), source=(source_x, source_y))
+ def _finish_refresh(self):
+ pass
+
@property
def hidden(self) -> bool:
"""True when the TileGrid is hidden. This may be False even
if not 0 <= value <= 255:
raise ValueError("Tile value out of bounds")
self._tiles[index] = value
+
+ @property
+ def width(self):
+ """Width in tiles"""
+ return self._width
+
+ @width.setter
+ def width(self, new_width):
+ self._width = new_width
+
+ @property
+ def height(self):
+ """Height in tiles"""
+ return self._height
+
+ @height.setter
+ def height(self, new_height):
+ self._height = new_height
+
+ @property
+ def tile_width(self):
+ """Width of each tile in pixels"""
+ return self._tile_width
+
+ @tile_width.setter
+ def tile_width(self, new_tile_width):
+ self._tile_width = new_tile_width
+
+ @property
+ def tile_height(self):
+ """Height of each tile in pixels"""
+ return self._tile_height
+
+ @tile_height.setter
+ def tile_height(self, new_tile_height):
+ self._tile_height = new_tile_height