ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

commit a4b7dc80fbcd65d234e08d2e58a1e8988276cc34
parent a46f95ca27c2964837f76293e28d91b76031370f
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Sun,  6 Sep 2015 20:02:40 +0200

Merge pull request #6 from timb/master

update readme/help to match behaviour
Diffstat:
MREADME.md | 62+++++++++++++++++++++++++++++++-------------------------------
Msrc/main.c | 71++++++++++++++++++++++++++++++++++++++---------------------------------
2 files changed, 69 insertions(+), 64 deletions(-)

diff --git a/README.md b/README.md @@ -66,7 +66,7 @@ Even more: - Output files are highly optimized 4-bit PNGs. - Optionally generates additional (and proper) Retina @2x PNG. -- You can use custom operands for adjusting output results. +- You can use custom options for adjusting output results. - Built-in support for rendering Amiga ASCII. # Documentation @@ -75,33 +75,28 @@ One major goal for AnsiLove/C was implementing the look and feel of common UNIX ## Synopsis - ansilove file -i [operands] - ansilove file -ir [operands] - ansilove file -o output [operands] - ansilove file -or output [operands] - ansilove file -s - ansilove -vhe + ansilove [options] file + ansilove -e | -h | -v ## Options - -i output identical to input with .png suffix added - -ir same as -i, creates additional Retina @2x output file - -o specify custom file name / path for output - -or same as -o, creates additional Retina @2x output file - -s display SAUCE record without generating output - -v version information, equivalent to --version - -h show help, equivalent to --help - -e print a list of examples + -b bits set to 9 to render 9th column of block characters (default: 8) + -c columns adjust number of columns for BIN files (default: 160) + -e print a list of examples + -f font select font (default: 80x25) + -h show help + -m mode set rendering mode for ANS files: + ced black on gray, with 78 columns + transparent render with transparent background + workbench use Amiga Workbench palette + -o file specify output filename/path + -r creates additional Retina @2x output file + -s show SAUCE record without generating output + -v show version information -Hint: Don't add .png suffix when specifying a custom path/name for output as it will be added automatically. +There are certain cases where you need to set options for proper rendering. However, this is occassionally. Results turn out well with the built-in defaults. You may launch AnsiLove with the option `-e` to get a list of basic examples. Note that columns is restricted to `BIN` files, it won't affect other file types. -## Operands - - font bits icecolors columns - -Optional values to adjust output. There are certain cases where you need to set operands for proper rendering. However, this is occassionally. Results turn out well with the built-in defaults. You may launch AnsiLove with the option `-e` to get a list of basic examples, with and without operands. Note that columns is restricted to `BIN` files, it won't affect other file types. It's also worth mentioning that setting a certain operand requires to set all operands before, so if you need to modifiy the `icecolors` operand, you have to set `font` and `bits` as well. On the other hand, it's fine to set the `font` operand while not setting any of the following. Got that? - -## font (operand) +## Fonts We dumped many fonts as binary data right into AnsiLove/C, so the most popular typefaces for rendering ANSi / ASCII art are available at your fingertips. @@ -136,25 +131,30 @@ AMIGA fonts can be (all case-sensitive): - `topaz500` (Original Topaz Kickstart 1.x version) - `topaz500+` (Modified Topaz Kickstart 1.x version) -## bits (operand) +## Bits `bits` can be (all case-sensitive): - `8` (8-bit) - `9` (9-bit) + +Setting the bits to `9` will render the 9th column of block characters, so the output will look like it is displayed in real textmode. + +## Rendering Mode + +`mode` can be (all case-sensitive): + - `ced` - `transparent` - `workbench` -Setting the bits to `9` will render the 9th column of block characters, so the output will look like it is displayed in real textmode. - -Setting the bits to `ced` will cause the input file to be rendered in black on gray, and limit the output to 78 columns (only available for `ANS` files). Used together with an `AMIGA` font, the output will look like it is displayed on Amiga. +Setting the mode to `ced` will cause the input file to be rendered in black on gray, and limit the output to 78 columns (only available for `ANS` files). Used together with an `AMIGA` font, the output will look like it is displayed on Amiga. -Setting the bits to `workbench` will cause the input file to be rendered using Amiga Workbench colors (only available for `ANS` files). +Setting the mode to `workbench` will cause the input file to be rendered using Amiga Workbench colors (only available for `ANS` files). -Settings the bits to `transparent` will produce output files with transparent background (only available for `ANS` files). +Settings the mode to `transparent` will produce output files with transparent background (only available for `ANS` files). -## icecolors (operand) +## iCE Colors `icecolors` can be: @@ -163,7 +163,7 @@ Settings the bits to `transparent` will produce output files with transparent ba Setting `icecolors` to `1` will enable iCE color codes. On the opposite `0` means that that `icecolors` are disabled, which is the default value. When an ANSi source was created using iCE colors, it was done with a special mode where the blinking was disabled, and you had 16 background colors available. Basically, you had the same choice for background colors as for foreground colors, that's iCE colors. But now the important part: when the ANSi source does not make specific use of iCE colors, you should NOT set this flag. The file could look pretty weird in normal mode. So in most cases it's fine to turn iCE colors off. -## columns (operand) +## Columns `columns` is only relevant for ANSi source files with `BIN` extension and even for those files optional. In most cases conversion will work fine if you don't set this flag, the default value is `160` then. So please pass `columns` only to `BIN` files and only if you exactly know what you're doing. A KITTEN MAY DIE SOMEWHERE. diff --git a/src/main.c b/src/main.c @@ -30,12 +30,21 @@ void showHelp(void) printf("\nSUPPORTED FILE TYPES:\n" " ANS BIN ADF IDF XB PCB TND ASC NFO DIZ\n" " Files with custom suffix default to the ANSi renderer.\n\n" - "OPERANDS:\n" - " Optional values to adjust output. There are certain cases where you need to\n" - " set operands for proper rendering. However, this is occassionally. Results\n" - " turn out well with the built-in defaults. You may launch AnsiLove with the\n" - " option -e to get a list of basic examples, with and without operands. Note\n" - " that columns is restricted to BIN files, it won't affect other file types.\n\n" + "PC FONTS:\n" + " 80x25 icelandic\n" + " 80x50 latin1\n" + " baltic latin2\n" + " cyrillic nordic\n" + " french-canadian portuguese\n" + " greek russian\n" + " greek-869 terminus\n" + " hebrew turkish\n\n" + "AMIGA FONTS:\n" + " amiga topaz\n" + " microknight topaz+\n" + " microknight+ topaz500\n" + " mosoul topaz500+\n" + " pot-noodle\n\n" "DOCUMENTATION:\n" " Detailed help is available at the AnsiLove/C repository on GitHub.\n" " <https://github.com/ansilove/AnsiLove-C>\n\n"); @@ -44,17 +53,13 @@ void showHelp(void) void listExamples(void) { printf("\nEXAMPLES:\n"); - printf(" ansilove file.ans -i (output path/name identical to input, no operands)\n" - " ansilove file.ans -ir (same as -i, adds Retina @2x output file)\n" - " ansilove file.ans -o dir/file (custom path/name for output, no operands)\n" - " ansilove file.ans -or dir/file (same as -o, adds Retina @2x output file)\n" - " ansilove file.bin -s (just display SAUCE record, don't generate output)\n" - " ansilove file.bin -i terminus 8 1 202 (set font, bits, icecolors, columns)\n" - " ansilove file.ans -o dir/file terminus 8 1 (custom font, bits, icecolors)\n" - " ansilove file.ans -or dir/file 80x25 8 1 (DOS font, bits, iCE, Retina)\n\n" - "HINT:\n" - " Don't add .png suffix when specifying a custom path/name for output as it\n" - " will be added automatically.\n\n"); + printf(" ansilove file.ans (output path/name identical to input, no options)\n" + " ansilove -r file.ans (adds Retina @2x output file)\n" + " ansilove -o dir/file file.ans (custom path/name for output)\n" + " ansilove -s file.bin (just display SAUCE record, don't generate output)\n" + " ansilove -m transparent file.ans (render with transparent background)\n" + " ansilove -f amiga -b 9 -c 202 file.bin (set font, bits, columns)\n" + "\n"); } void versionInfo(void) @@ -72,23 +77,23 @@ void versionInfo(void) void synopsis(void) { printf("\nSYNOPSIS:\n" - " ansilove input -i [operands]\n" - " ansilove input -ir [operands]\n" - " ansilove input -o output [operands]\n" - " ansilove input -or output [operands]\n" - " ansilove input -s\n" - " ansilove -vhe\n\n" + " ansilove [options] file\n" + " ansilove -e | -h | -v\n\n" "OPTIONS:\n" - " -i output identical to input with .png suffix added\n" - " -ir same as -i, creates additional Retina @2x output file\n" - " -o specify custom file name/path for output\n" - " -or same as -o, creates additional Retina @2x output file\n" - " -s display SAUCE record without generating output\n" - " -v version information, equivalent to --version\n" - " -h show help, equivalent to --help\n" - " -e print a list of examples\n\n" - "OPERANDS:\n" - " font bits icecolors columns\n\n"); + " -b bits set to 9 to render 9th column of block characters (default: 8)\n" + " -c columns adjust number of columns for BIN files (default: 160)\n" + " -e print a list of examples\n" + " -f font select font (default: 80x25)\n" + " -h show help\n" + " -m mode set rendering mode for ANS files:\n" + " ced black on gray, with 78 columns\n" + " transparent render with transparent background\n" + " workbench use Amiga Workbench palette\n" + " -o file specify output filename/path\n" + " -r creates additional Retina @2x output file\n" + " -s show SAUCE record without generating output\n" + " -v show version information\n" + "\n"); } int main(int argc, char *argv[])