First public commit.
This commit is contained in:
parent
2a48f52979
commit
4bac9d83ed
288 changed files with 18417 additions and 1076 deletions
24
lenser/coco3/convert/gr16.py
Normal file
24
lenser/coco3/convert/gr16.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
"""CoCo 3 GIME 160x192, 16 colours from the 64-colour palette (flagship photo
|
||||
mode -- wide pixels but the most colour)."""
|
||||
from __future__ import annotations
|
||||
|
||||
from ...convert.base import Conversion, perceptual_error
|
||||
from . import _common
|
||||
|
||||
WIDTH, HEIGHT = 160, 192
|
||||
PIXEL_ASPECT = 2.0 # 160 wide on a 4:3 screen -> pixels twice as wide
|
||||
NCOL = 16
|
||||
CRES = 2
|
||||
|
||||
|
||||
def convert(img_rgb, palette_name="gime", dither_mode="floyd",
|
||||
intensive=False, base_color=None):
|
||||
pen, inks, idx, img_lab, plab, prgb = _common.render(img_rgb, NCOL, dither_mode)
|
||||
screen = _common.PACK[CRES](pen)
|
||||
return Conversion(
|
||||
mode="gr16", width=WIDTH, height=HEIGHT, pixel_aspect=PIXEL_ASPECT,
|
||||
index_image=idx, data=screen, data_addr=0x4000, viewer="coco3",
|
||||
preview_rgb=prgb[idx], error=perceptual_error(idx, img_lab, plab),
|
||||
meta={"palette": "gime", "dither": dither_mode, "cres": CRES,
|
||||
"inks": inks, "border": inks[0] if inks else 0},
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue