25 lines
1,008 B
Python
25 lines
1,008 B
Python
"""ColecoVision / Adam conversion dispatch.
|
|
|
|
Both machines use the same TMS9918A VDP as the TI-99/4A, so the Graphics Mode 2
|
|
image encoding (palette + 6144-byte pattern + 768 per-cell colours) is identical
|
|
-- we reuse the TI-99 GM2 encoder unchanged.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from ... import imageprep
|
|
from ...ti99.convert import gm2 as _gm2, mono as _mono
|
|
|
|
_MODULES = {"gm2": _gm2, "mono": _mono}
|
|
MODES = ["gm2", "mono"]
|
|
|
|
|
|
def convert_image(path_or_img, mode="gm2", palette_name="tms9918",
|
|
dither_mode="floyd", intensive=False, prep_opt=None, base_color=None):
|
|
prep_opt = prep_opt or imageprep.PrepOptions()
|
|
module = _MODULES.get(mode, _gm2)
|
|
img_rgb = imageprep.prepare(path_or_img, module.WIDTH, module.HEIGHT,
|
|
module.PIXEL_ASPECT, prep_opt, border_rgb=(0, 0, 0))
|
|
conv = module.convert(img_rgb, palette_name, dither_mode, intensive,
|
|
base_color=base_color)
|
|
conv.viewer = "coleco"
|
|
return conv
|