def get_tile(self, codepoint: int) -> np.ndarray: """Return a copy of a tile for the given codepoint. If the tile does not exist yet then a blank array will be returned. The tile will have a shape of (height, width, rgba) and a dtype of uint8. Note that most grey-scale tiles will only use the alpha channel and will usually have a solid white color channel. """ tile = np.zeros(self.tile_shape + (4, ), dtype=np.uint8) lib.TCOD_tileset_get_tile_( self._tileset_p, codepoint, ffi.from_buffer("struct TCOD_ColorRGBA*", tile), ) return tile
def __contains__(self, codepoint: int) -> bool: """Test if a tileset has a codepoint with ``n in tileset``.""" return bool( lib.TCOD_tileset_get_tile_(self._tileset_p, codepoint, ffi.NULL) == 0)