cega 0.1.1

CGA and EGA binary image file processing library
Documentation

cega

CGA/EGA graphics binary file parsing for Rust

Crates.io Crates.io License License Contributors

Warning

This is currently very much in an alpha state. EGA is not currently implemented. Output to a usable file format is not either. It's currently a preview tool that uses ANSI escape codes for a terminal view and SDL2 for a gui preview window.

Usage

This can be used as a library or executable. Pending finalizing internal API I'll demonstrate the CLI usage instead (check main.rs for how to call etc).

The binary handles arguments (and thus help) via clap 4

     Running `target/debug/cega --help`
Usage: cega [OPTIONS] <IMAGE>

Arguments:
  <IMAGE>  

Options:
  -t, --terminal-output <TERMINAL_OUTPUT>
          [possible values: a, c, p, h]
          a = plain ascii
          c = colored ascii
          p = full pixels via ansi bg color
          h = horizontal half pixels
          Images may be wider than terminal and will then crop
  -p, --palette [<PALETTE>]
          [default: 1] [possible values: 0, 0i, 1, 1i]
  -c, --custom-ascii <CUSTOM_ASCII>
          4 chars palette like -a " +%0"
  -w, --width <WIDTH>
          
  -m, --max-width <MAX_WIDTH>
          [default: 320]
  -r, --retile-height <RETILE_HEIGHT>
          
  -s, --sdl
          
  -q, --quiet
          
  -i, --image-type <IMAGE_TYPE>
          [default: cga] [possible values: cga, ega]
  -h, --help
          Print help
  -V, --version
          Print version

cega can parse tiled/spritesheet style cga and output "pixels" to the terminal

cega ../../assets/game/CGATILES.BIN -w 16 -r 16 -i cga -t p:

cega will output some suggestions, like if it's not a CGA fullscreen image, but you don't specify tiling:

cega ../../assets/game/CGATILES.BIN -t a:

cega will ouput in different preview formats, such as colored ASCII or a gui window:

cega ../../assets/game/CGATILES.BIN -w 16 -r 16 -i cga -t c -c "1234" -s: