Hi!
Here's the package for converting images to tokra's new MFLI graphics mode, as *.zip archive (download).
The archive contains an executable for Windows ('mfli_quant.exe'), and the C source files 'mfli_quant.c', 'image.c', 'image.h', and 'matrix.h'.
mfli_quant.c does the main work: main() at first calls the function quant_fore(), which applies the foreground heuristics to the image, assigning the dominant colour of each 4x8 attribute cell. Then, for each line, the function quant_line() is called for all possible combinations of background, border, and auxiliary colour to find out the one with the least error, then quant_line() repeats the best found conversion for that line. quant_line() itself applies Floyd-Steinberg dithering to distribute the error made in the quantizing step to the neighbouring pixels.
image.c and image.h are doing the housekeeping work as small and simple image processing library. This library operates on greyscale-, RGB-, or float-images. matrix.h supplies templates for two functions which can allocate and free 2D matrices of arbitrary type whose size is only known at runtime.
mfli_quant.exe expects a file named 'image.ppm' in the directory, which must be exactly the size 104x256. It then writes 'result.ppm' as preview; 'bitmap.prg' and 'colour.prg' are two files which as can be imported with a tool running on the VIC-20, tokra explains its usage in the MFLI thread in the Programming section.
Questions, discussions about mfli_quant are welcome.
Greetings,
Michael
mfli_quant image converter for tokra's latest MFLI mode
Moderator: Moderators
- Mike
- Herr VC
- Posts: 5134
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
mfli_quant image converter for tokra's latest MFLI mode
Last edited by Mike on Thu Feb 20, 2014 4:37 pm, edited 2 times in total.
Hmmm... Maybe I should add support to display these in PRG Starter. If they all are started with that sys 24171, then it shouldn't be hard to do...
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
- Mike
- Herr VC
- Posts: 5134
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
For the current tool set, you can savely assume SYS 24171 displays the image. The files have the following 'signature':
The files extend up to address $5E8A inclusive. It is possible (and done in the 'Yes VIC can' slide show) to put a BASIC program into the remaining memory by setting the BASIC start to $5E8C. This is done with:
Code: Select all
CBM DOS file type: PRG
load address: $1340 (decimal: 4928)
start address: $5E6B (decimal: 24171)
Req'd RAM extension: +16K
Code: Select all
POKE24203,0:POKE43,140:POKE44,94:NEW
Added support to display them in PRG Starter:
http://user.tninet.se/~jad615g/prgstarter/
http://user.tninet.se/~jad615g/prgstarter/
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
By the way, you can use PRG Starter to convert the picture files into programs you can start with RUN by copying the temporary file created to display the picture. Or you could just rename it so that PRG Starter won't be able to delete it.
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)