def stub_fetch(tileset, tile): from zaloa import FetchResult # return back # r r r r # g w w g # g w w g # b b b b # oriented around test coordinate of 2/1/1 # 2/1/1 -> 3/2/2 (top left corner) # 3/1/1 3/2/1 3/3/1 3/4/1 # 3/1/2 3/2/2 3/3/2 3/4/2 # 3/1/3 3/2/3 3/3/3 3/4/3 # 3/1/4 3/2/4 3/3/4 3/4/4 if tile in (Tile(3, 1, 1), Tile(3, 2, 1), Tile(3, 3, 1), Tile(3, 4, 1)): # top row color = 255, 0, 0 elif tile in (Tile(3, 1, 2), Tile(3, 1, 3), Tile(3, 4, 2), Tile(3, 4, 3)): # left and right edges color = 0, 255, 0 elif tile in (Tile(3, 2, 2), Tile(3, 3, 2), Tile(3, 2, 3), Tile(3, 3, 3)): # center tiles color = 255, 255, 255 elif tile in (Tile(3, 1, 4), Tile(3, 2, 4), Tile(3, 3, 4), Tile(3, 4, 4)): # bottom row color = 0, 0, 255 else: assert not 'Invalid tile coordinate: %s' % tile image_bytes = self._gen_stub_image(color) return FetchResult(image_bytes, tile)
def stub_fetch(tileset, tile): # return back # r g # b w # oriented around test coordinate of 2/1/1 from zaloa import FetchResult if tile == Tile(3, 2, 2): # nw color = 255, 0, 0 elif tile == Tile(3, 3, 2): # ne color = 0, 255, 0 elif tile == Tile(3, 2, 3): # sw color = 0, 0, 255 elif tile == Tile(3, 3, 3): # se color = 255, 255, 255 else: assert not 'Invalid tile coordinate: %s' % tile image_bytes = self._gen_stub_image(color) return FetchResult(image_bytes, tile)
def stub_fetch(tileset, tile): # return back # r r r # g w g # b b b # oriented around test coordinate of 2/1/1 from zaloa import FetchResult if tile in (Tile(2, 0, 0), Tile(2, 1, 0), Tile(2, 2, 0)): # top row color = 255, 0, 0 elif tile in (Tile(2, 0, 1), Tile(2, 2, 1)): # left and right edges color = 0, 255, 0 elif tile == Tile(2, 1, 1): # center tile color = 255, 255, 255 elif tile in (Tile(2, 0, 2), Tile(2, 1, 2), Tile(2, 2, 2)): # bottom row color = 0, 0, 255 else: assert not 'Invalid tile coordinate: %s' % tile image_bytes = self._gen_stub_image(color) return FetchResult(image_bytes, tile)
def stub_fetch(tileset, tile): from zaloa import FetchResult return FetchResult('image data', tile)