fxconv: PythonExtra support for bopti-cg

This commit is contained in:
Lephenixnoir 2024-02-02 10:44:04 +01:00
parent 4a84bfdcd4
commit 8030d6bdc6
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -602,6 +602,17 @@ def convert_image_cg(input, params):
data, stride, palette, color_count = image_encode(img, format)
if params["py"]["enabled"]:
w, h = img.size
return [
"import gint\n",
f"{params['name']} = gint.image({format.id}, {color_count}, ",
f"{img.width}, {img.height}, {stride}, ",
data,
", ",
"None" if palette is None else palette,
")\n"]
o = ObjectData()
o += u8(format.id)
o += u8(3) # DATA_RO, PALETTE_RO
@ -1162,6 +1173,8 @@ def convert(input, params, target, output=None, model=None, custom=None):
# PythonExtra conversion: output a file
if params["py"]["enabled"]:
if isinstance(o, ObjectData):
raise FxconvError(f'conversion doe not support Python output')
pyout(o, output, params)
# Standard conversions: save to ELF in the natural way
else: