"""C128 VDC high-resolution greyscale / black-and-white (640x200). MAME's 8563 has no true linear bitmap renderer (its R25-bit7 "bitmap" path only emits one bit per 8-pixel cell), so genuine 640x200 detail has to come through the character/font path -- exactly as the `hicolor` mode does. This mode reuses that machinery restricted to the VDC's four greys (black, dark grey, light grey, white): each 8x8 cell picks the grey that best matches it over a global grey background and dithers to a 1bpp glyph, giving smooth multi-level greyscale at full resolution. `--mono-base` swaps the grey ramp for a black->colour->white ramp to tint the result. """ from __future__ import annotations from . import hicolor WIDTH, HEIGHT = hicolor.WIDTH, hicolor.HEIGHT PIXEL_ASPECT = hicolor.PIXEL_ASPECT GREYS = [0, 1, 14, 15] # VDC black, dark grey, light grey, white def convert(img_rgb, palette_name="vdc", dither_mode="floyd", intensive=False, base_color=None): if base_color in range(1, 16): inks = sorted({0, int(base_color), 15}) # black -> tint -> white else: inks = GREYS return hicolor.build(img_rgb, dither_mode, inks=inks, bg_list=inks, mode_name="mono")