"""tools/mask_channels.py on synthetic images: every texel is built here, no game data.""" import io import json import os import struct import sys import tempfile import unittest from contextlib import redirect_stderr, redirect_stdout from unittest import mock ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.join(ROOT, "tools")) import mask_channels as mc # noqa: E402 import report_paths # noqa: E402 W = H = 16 def image(): """R: one 8x8 square (a broad layer). G: constant 200. B: isolated texels on a 4-texel grid (spots). A: 255.""" px = bytearray() for y in range(H): for x in range(W): r = 255 if 4 <= x < 12 and 4 <= y < 12 else 0 b = 255 if x % 4 == 1 and y % 4 == 1 else 0 px += bytes((r, 200, b, 255)) return bytes(px) def rgba8_dds(width, height, payload): header = bytearray(128) header[0:4] = b"DDS " struct.pack_into("