diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-12-29 16:04:24 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-12-29 16:04:24 +0000 |
commit | 26092f5e2264b80706f4a980a9e79a8289254103 (patch) | |
tree | 90c2f65cbd99a8ac9180ad1f6621637c599351cc /editor/pnmpad.c | |
parent | 7a53900f121af84c64eda0102d540aa9c9be63df (diff) | |
download | netpbm-mirror-26092f5e2264b80706f4a980a9e79a8289254103.tar.gz netpbm-mirror-26092f5e2264b80706f4a980a9e79a8289254103.tar.xz netpbm-mirror-26092f5e2264b80706f4a980a9e79a8289254103.zip |
Promote Development to Advanced as 10.89.00
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3723 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pnmpad.c')
-rw-r--r-- | editor/pnmpad.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/editor/pnmpad.c b/editor/pnmpad.c index 9c7a77e5..55cdcd6c 100644 --- a/editor/pnmpad.c +++ b/editor/pnmpad.c @@ -38,6 +38,7 @@ struct cmdlineInfo { unsigned int mwidth; unsigned int mheight; unsigned int white; /* >0: pad white; 0: pad black */ + unsigned int reportonly; unsigned int verbose; }; @@ -86,14 +87,16 @@ parseCommandLine(int argc, const char ** argv, &yalignSpec, 0); OPTENT3(0, "valign", OPT_FLOAT, &cmdlineP->yalign, &yalignSpec, 0); - OPTENT3(0, "black", OPT_FLAG, NULL, - &blackOpt, 0); OPTENT3(0, "mwidth", OPT_UINT, &cmdlineP->mwidth, &mwidthSpec, 0); OPTENT3(0, "mheight", OPT_UINT, &cmdlineP->mheight, &mheightSpec, 0); + OPTENT3(0, "black", OPT_FLAG, NULL, + &blackOpt, 0); OPTENT3(0, "white", OPT_FLAG, NULL, &cmdlineP->white, 0); + OPTENT3(0, "reportonly", OPT_FLAG, NULL, + &cmdlineP->reportonly, 0); OPTENT3(0, "verbose", OPT_FLAG, NULL, &cmdlineP->verbose, 0); @@ -489,6 +492,23 @@ computePadSizes(struct cmdlineInfo const cmdline, static void +reportPadSizes(int const inCols, + int const inRows, + unsigned int const lpad, + unsigned int const rpad, + unsigned int const tpad, + unsigned int const bpad) { + + unsigned int const outCols = inCols + lpad + rpad; + unsigned int const outRows = inRows + tpad + bpad; + + printf("%u %u %u %u %u %u\n", lpad, rpad, tpad, bpad, outCols, outRows); + +} + + + +static void padPbm(FILE * const ifP, unsigned int const cols, unsigned int const rows, @@ -636,12 +656,16 @@ main(int argc, const char ** argv) { newcols = cols + lpad + rpad; - if (PNM_FORMAT_TYPE(format) == PBM_TYPE) - padPbm(ifP, cols, rows, format, newcols, lpad, rpad, tpad, bpad, - !!cmdline.white); - else - padGeneral(ifP, cols, rows, maxval, format, - newcols, lpad, rpad, tpad, bpad, !!cmdline.white); + if (cmdline.reportonly) + reportPadSizes(cols, rows, lpad, rpad, tpad, bpad); + else { + if (PNM_FORMAT_TYPE(format) == PBM_TYPE) + padPbm(ifP, cols, rows, format, newcols, lpad, rpad, tpad, bpad, + !!cmdline.white); + else + padGeneral(ifP, cols, rows, maxval, format, + newcols, lpad, rpad, tpad, bpad, !!cmdline.white); + } pm_close(ifP); |