diff options
Diffstat (limited to 'converter/other/srftopam.c')
-rw-r--r-- | converter/other/srftopam.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/converter/other/srftopam.c b/converter/other/srftopam.c index efe55253..857d6d92 100644 --- a/converter/other/srftopam.c +++ b/converter/other/srftopam.c @@ -46,9 +46,7 @@ parseCommandLine(int argc, const char ** argv, Note that the strings we return are stored in the storage that was passed to us as the argv array. We also trash *argv. -----------------------------------------------------------------------------*/ - optEntry *option_def; - /* Instructions to pm_optParseOptions3 on how to parse our options. - */ + optEntry * option_def; /* Used by OPTENT3 */ optStruct3 opt; unsigned int option_def_index; @@ -63,7 +61,7 @@ parseCommandLine(int argc, const char ** argv, opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ opt.allowNegNum = FALSE; /* We have no parms that are negative numbers */ - pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0); + pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0); /* Uses and sets argc, argv, and some of *cmdlineP and others. */ if (argc-1 < 1) @@ -82,18 +80,21 @@ srfRed(uint16_t const pixel) { } + static unsigned int srfGrn(uint16_t const pixel) { return ((pixel >> 6) & 0x1f) << 3; } + static unsigned int srfBlu(uint16_t const pixel) { return ((pixel >> 0) & 0x1f) << 3; } + static uint8_t srfAlpha(uint8_t const d) { @@ -130,7 +131,7 @@ writeRaster(struct pam * const pamP, uint16_t const alpha = imgP->alpha.data[rowStart + col]; assert(col < pamP->width); - + tuplerow[col][PAM_RED_PLANE] = srfRed(data); tuplerow[col][PAM_GRN_PLANE] = srfGrn(data); tuplerow[col][PAM_BLU_PLANE] = srfBlu(data); @@ -142,7 +143,7 @@ writeRaster(struct pam * const pamP, tuplerow[col][PAM_GRN_PLANE] = 0; tuplerow[col][PAM_BLU_PLANE] = 0; tuplerow[col][PAM_TRN_PLANE] = 0; - } + } pnm_writepamrow(pamP, tuplerow); } |