diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2008-09-17 02:30:00 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2008-09-17 02:30:00 +0000 |
commit | 346774c389571825d7bfbd5b2a065a70c7b02fe5 (patch) | |
tree | 73707e263eff6875d4d04d6b7dd15779785e8dc9 | |
parent | 07bf731055482e4e7eab73816ec1fd55edb07887 (diff) | |
download | netpbm-mirror-346774c389571825d7bfbd5b2a065a70c7b02fe5.tar.gz netpbm-mirror-346774c389571825d7bfbd5b2a065a70c7b02fe5.tar.xz netpbm-mirror-346774c389571825d7bfbd5b2a065a70c7b02fe5.zip |
fix bug: always produces color, not grayscale
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@726 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-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 { |