diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-12-28 19:53:34 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-12-28 19:53:34 +0000 |
commit | 5d16663331afd0bc2edaeb2e49042dc219ce9c2f (patch) | |
tree | 476fbb2ab4311d4bb6d65b250825e254a7a2c1ef /converter/ppm/ppmtoterm.c | |
parent | 42f0bf8e7f1ff88000a3584c265e6f1631662ec4 (diff) | |
download | netpbm-mirror-5d16663331afd0bc2edaeb2e49042dc219ce9c2f.tar.gz netpbm-mirror-5d16663331afd0bc2edaeb2e49042dc219ce9c2f.tar.xz netpbm-mirror-5d16663331afd0bc2edaeb2e49042dc219ce9c2f.zip |
promote Development to Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4827 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/ppmtoterm.c')
-rw-r--r-- | converter/ppm/ppmtoterm.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/converter/ppm/ppmtoterm.c b/converter/ppm/ppmtoterm.c index d388f77d..6e41a8cb 100644 --- a/converter/ppm/ppmtoterm.c +++ b/converter/ppm/ppmtoterm.c @@ -86,7 +86,7 @@ parseCommandLine(int argc, const char ** argv, static void -generatePalette(unsigned char rgb[NUM_COLORS][3], +generatePalette(unsigned char rgb[NUM_COLORS][3], char ansiCode[NUM_COLORS][MAX_ANSI_STR_LEN], unsigned int * const paletteSizeP) { /*---------------------------------------------------------------------------- @@ -150,7 +150,7 @@ generatePalette(unsigned char rgb[NUM_COLORS][3], static void lookupInPalette(pixel const pixel, pixval const maxval, - unsigned char rgb[NUM_COLORS][3], + unsigned char rgb[NUM_COLORS][3], unsigned int const palLen, unsigned int * const paletteIdxP) { /*---------------------------------------------------------------------------- @@ -166,7 +166,7 @@ lookupInPalette(pixel const pixel, unsigned int paletteIdxSoFar; unsigned int dist; unsigned int i; - + /* The following loop calculates the index that corresponds to the minimum color distance between the given RGB values and the values available in the palette. @@ -200,18 +200,18 @@ main(int argc, const char ** argv) { unsigned char rgb[NUM_COLORS][3]; char ansiCode[NUM_COLORS][MAX_ANSI_STR_LEN]; - pm_proginit(&argc, argv); + pm_proginit(&argc, argv); parseCommandLine(argc, argv, &cmdline); ifP = pm_openr(cmdline.inputFileName); - + pixels = ppm_readppm(ifP, &cols, &rows, &maxval); pm_close(ifP); - + generatePalette(rgb, ansiCode, &palLen); - + for (row = 0; row < rows; ++row) { unsigned int col; for (col = 0; col < cols; ++col) { @@ -227,6 +227,9 @@ main(int argc, const char ** argv) { printf(ESC "\x30m"); ppm_freearray(pixels, rows); - + return 0; } + + + |