from PIL import Image from collections import namedtuple from quicktex.s3tc.bc1 import BC1Block from quicktex import RawTexture import os.path image_path = os.path.dirname(os.path.realpath(__file__)) class BC1Blocks: class Entry: def __init__(self, filename, block): path = os.path.join(image_path, 'blocks', filename) self.image = Image.open(path).convert('RGBA') self.texture = RawTexture.frombytes(self.image.tobytes('raw', 'RGBA'), *self.image.size) self.block = block greyscale = Entry('greyscale_unpacked.png', BC1Block.frombytes(b'\xFF\xFF\x49\x4A\x78\x78\x78\x78')) three_color = Entry('3color_unpacked.png', BC1Block.frombytes(b'\xE0\x07\x00\xF8\x29\x29\x29\x29')) three_color_black = Entry('3color_black_unpacked.png', BC1Block.frombytes(b'\xE0\x07\x00\xF8\x27\x27\x27\x27'))