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/other/pnmtopalm | |
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/other/pnmtopalm')
-rw-r--r-- | converter/other/pnmtopalm/gen_palm_colormap.c | 4 | ||||
-rw-r--r-- | converter/other/pnmtopalm/palm.h | 2 | ||||
-rw-r--r-- | converter/other/pnmtopalm/palmcolormap.c | 35 | ||||
-rw-r--r-- | converter/other/pnmtopalm/palmtopnm.c | 4 | ||||
-rw-r--r-- | converter/other/pnmtopalm/pnmtopalm.c | 4 |
5 files changed, 32 insertions, 17 deletions
diff --git a/converter/other/pnmtopalm/gen_palm_colormap.c b/converter/other/pnmtopalm/gen_palm_colormap.c index 0f3f8a5f..04555221 100644 --- a/converter/other/pnmtopalm/gen_palm_colormap.c +++ b/converter/other/pnmtopalm/gen_palm_colormap.c @@ -15,7 +15,7 @@ main(int argc, Colormap defaultMap; unsigned int i; pixel pix; - + defaultMap = palmcolor_build_default_8bit_colormap(); qsort (defaultMap->color_entries, defaultMap->ncolors, sizeof(Color_s), palmcolor_compare_indices); @@ -44,3 +44,5 @@ main(int argc, return 0; } + + diff --git a/converter/other/pnmtopalm/palm.h b/converter/other/pnmtopalm/palm.h index 0edf9a28..0a2a7cfc 100644 --- a/converter/other/pnmtopalm/palm.h +++ b/converter/other/pnmtopalm/palm.h @@ -7,7 +7,7 @@ #define PALM_INDIRECT_BITMAP 0x1000 /* Palm says internal use only */ #define PALM_FOR_SCREEN 0x0800 /* Palm says internal use only */ #define PALM_DIRECT_COLOR_FLAG 0x0400 -#define PALM_INDIRECT_COLORMAP 0x0200 /* Palm says internal use only */ +#define PALM_INDIRECT_COLORMAP 0x0200 /* Palm says internal use only */ #define PALM_NO_DITHER_FLAG 0x0100 /* rather mysterious */ #define PALM_COMPRESSION_SCANLINE 0x00 diff --git a/converter/other/pnmtopalm/palmcolormap.c b/converter/other/pnmtopalm/palmcolormap.c index 1341ca2b..de3def22 100644 --- a/converter/other/pnmtopalm/palmcolormap.c +++ b/converter/other/pnmtopalm/palmcolormap.c @@ -28,7 +28,7 @@ palmcolor_mapEntryColorFmPixel(pixel const color, return 0 - | (scaleSample(PPM_GETR(color), maxval, newMaxval) << 16) + | (scaleSample(PPM_GETR(color), maxval, newMaxval) << 16) | (scaleSample(PPM_GETG(color), maxval, newMaxval) << 8) | (scaleSample(PPM_GETB(color), maxval, newMaxval) << 0); } @@ -68,6 +68,8 @@ palmcolor_compare_colors(const void * const p1, return 0; } + + /*********************************************************************** *********************************************************************** *********************************************************************** @@ -81,7 +83,7 @@ palmcolor_compare_colors(const void * const p1, /* * The 1bit-2 color system palette for Palm Computing Devices. */ -static int PalmPalette1bpp[2][3] = +static int PalmPalette1bpp[2][3] = { { 255, 255, 255}, { 0, 0, 0 } }; @@ -89,7 +91,7 @@ static int PalmPalette1bpp[2][3] = /* * The 2bit-4 color system palette for Palm Computing Devices. */ -static int PalmPalette2bpp[4][3] = +static int PalmPalette2bpp[4][3] = { { 255, 255, 255}, { 192, 192, 192}, { 128, 128, 128 }, { 0, 0, 0 } }; @@ -97,7 +99,7 @@ static int PalmPalette2bpp[4][3] = /* * The 4bit-16 color system palette for Palm Computing Devices. */ -static int PalmPalette4bpp[16][3] = +static int PalmPalette4bpp[16][3] = { { 255, 255, 255}, { 238, 238, 238 }, { 221, 221, 221 }, { 204, 204, 204 }, { 187, 187, 187}, { 170, 170, 170 }, { 153, 153, 153 }, { 136, 136, 136 }, @@ -108,7 +110,7 @@ static int PalmPalette4bpp[16][3] = /* * The 4bit-16 color system palette for Palm Computing Devices. */ -static int PalmPalette4bppColor[16][3] = +static int PalmPalette4bppColor[16][3] = { { 255, 255, 255}, { 128, 128, 128 }, { 128, 0, 0 }, { 128, 128, 0 }, { 0, 128, 0}, { 0, 128, 128 }, { 0, 0, 128 }, { 128, 0, 128 }, @@ -123,12 +125,12 @@ static int PalmPalette4bppColor[16][3] = * * NOTE: only the first 231, plus the last one, are valid. */ -static int PalmPalette8bpp[256][3] = +static int PalmPalette8bpp[256][3] = { - { 255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 }, - { 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 }, - { 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 }, - { 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 }, + { 255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 }, + { 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 }, + { 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 }, + { 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 }, { 255, 51, 153 }, { 255, 0, 153 }, { 204, 255, 255 }, { 204, 204, 255 }, { 204, 153, 255 }, { 204, 102, 255 }, { 204, 51, 255 }, { 204, 0, 255 }, { 204, 255, 204 }, { 204, 204, 204 }, { 204, 153, 204 }, { 204, 102, 204 }, @@ -215,7 +217,7 @@ palmcolor_build_default_8bit_colormap(void) { cmP->ncolors = 232; /* now sort the table */ - qsort(cmP->color_entries, cmP->ncolors, sizeof(ColormapEntry), + qsort(cmP->color_entries, cmP->ncolors, sizeof(ColormapEntry), palmcolor_compare_colors); return cmP; } @@ -235,7 +237,7 @@ palmcolor_build_custom_8bit_colormap(pixel ** const pixels, colormapP->nentries = 256; MALLOCARRAY_NOFAIL(colormapP->color_entries, colormapP->nentries); colormapP->ncolors = 0; /* initial value */ - + for (row = 0; row < rows; ++row) { unsigned int col; for (col = 0; col < cols; ++col) { @@ -259,7 +261,7 @@ palmcolor_build_custom_8bit_colormap(pixel ** const pixels, ColormapEntry const newEntry = searchTarget | (colorIndex << 24); colormapP->color_entries[colorIndex] = newEntry; - qsort(colormapP->color_entries, colormapP->ncolors, + qsort(colormapP->color_entries, colormapP->ncolors, sizeof(ColormapEntry), palmcolor_compare_colors); } } @@ -276,7 +278,7 @@ palmcolor_read_colormap (FILE * const ifP) { unsigned short ncolors; Colormap * retval; int rc; - + rc = pm_readbigshort(ifP, (short *) &ncolors); if (rc != 0) retval = NULL; @@ -289,7 +291,7 @@ palmcolor_read_colormap (FILE * const ifP) { MALLOCVAR_NOFAIL(colormapP); colormapP->nentries = ncolors; MALLOCARRAY_NOFAIL(colormapP->color_entries, colormapP->nentries); - + for (i = 0, error = FALSE; i < ncolors && !error; ++i) { int rc; rc = pm_readbiglong(ifP, &colorentry); @@ -309,3 +311,6 @@ palmcolor_read_colormap (FILE * const ifP) { } return retval; } + + + diff --git a/converter/other/pnmtopalm/palmtopnm.c b/converter/other/pnmtopalm/palmtopnm.c index a64ab01c..0e83f5e0 100644 --- a/converter/other/pnmtopalm/palmtopnm.c +++ b/converter/other/pnmtopalm/palmtopnm.c @@ -445,6 +445,7 @@ yesno(bool const arg) { } + static void reportPalmHeader(struct PalmHeader const palmHeader, struct DirectColorInfo const directColorInfo) { @@ -1250,3 +1251,6 @@ main(int argc, const char **argv) { return 0; } + + + diff --git a/converter/other/pnmtopalm/pnmtopalm.c b/converter/other/pnmtopalm/pnmtopalm.c index 9fc92790..ab82996e 100644 --- a/converter/other/pnmtopalm/pnmtopalm.c +++ b/converter/other/pnmtopalm/pnmtopalm.c @@ -816,6 +816,7 @@ computeRawRowNonDirect(const xel * const xelrow, } + typedef struct { /*---------------------------------------------------------------------------- A buffer to which one can write bytes sequentially. @@ -1352,3 +1353,6 @@ main( int argc, const char **argv ) { return 0; } + + + |