diff options
-rw-r--r-- | doc/HISTORY | 2 | ||||
-rw-r--r-- | generator/pamgradient.c | 17 |
2 files changed, 9 insertions, 10 deletions
diff --git a/doc/HISTORY b/doc/HISTORY index 1d47c828..4595baca 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -18,6 +18,8 @@ not yet BJH Release 10.44.00 pnmpaste: fail if user specified stdin for both images. + pamgradient: fix bug: always produces color, not grayscale. + pnm_backgroundxel(), pnm_backgroundxelrow() (affects pnmrotate, pnmshear, pnmcrop, pnmcat: correctly average corner colors to determine background (fill) color. diff --git a/generator/pamgradient.c b/generator/pamgradient.c index bca586c2..bc278a6c 100644 --- a/generator/pamgradient.c +++ b/generator/pamgradient.c @@ -120,13 +120,10 @@ interpolate(struct pam * const pamP, static int -isgray(struct pam * const pamP, - tuple const color) { +isgray(tuple const color) { - return (pamP->depth == 1) - || ((pamP->depth == 3) - && (color[PAM_RED_PLANE] == color[PAM_GRN_PLANE]) - && (color[PAM_RED_PLANE] == color[PAM_BLU_PLANE])); + return (color[PAM_RED_PLANE] == color[PAM_GRN_PLANE]) + && (color[PAM_RED_PLANE] == color[PAM_BLU_PLANE]); } @@ -177,10 +174,10 @@ main(int argc, char *argv[]) { pam.maxval = cmdline.maxval; pam.bytes_per_sample = pnm_bytespersample(pam.maxval); pam.format = PAM_FORMAT; - if (isgray(&pam, cmdline.colorTopLeft) - && isgray(&pam, cmdline.colorTopRight) - && isgray(&pam, cmdline.colorBottomLeft) - && isgray(&pam, cmdline.colorBottomRight)) { + if (isgray(cmdline.colorTopLeft) + && isgray(cmdline.colorTopRight) + && isgray(cmdline.colorBottomLeft) + && isgray(cmdline.colorBottomRight)) { pam.depth = 1; strcpy(pam.tuple_type, PAM_PGM_TUPLETYPE); } else { |