diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-11-28 06:14:47 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-11-28 06:14:47 +0000 |
commit | 42981754a445355aac8d62efdd276ba96fcdac03 (patch) | |
tree | 195742bf12807c159b5f35f0cd2bbc31c16d44d7 /editor/pnmshear.c | |
parent | 352e360cc05a80c3338a73a355d34be3b181ea4b (diff) | |
download | netpbm-mirror-42981754a445355aac8d62efdd276ba96fcdac03.tar.gz netpbm-mirror-42981754a445355aac8d62efdd276ba96fcdac03.tar.xz netpbm-mirror-42981754a445355aac8d62efdd276ba96fcdac03.zip |
Fix -background with PGM/PBM input - pnmrotate, pnmshear
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@156 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pnmshear.c')
-rw-r--r-- | editor/pnmshear.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/editor/pnmshear.c b/editor/pnmshear.c index 5ed6c5c5..9fd788a5 100644 --- a/editor/pnmshear.c +++ b/editor/pnmshear.c @@ -16,6 +16,7 @@ #include <math.h> #include <string.h> +#include "ppm.h" #include "pnm.h" #include "shhopt.h" @@ -95,7 +96,7 @@ makeNewXel(xel * const outputXelP, The format of the pixel is 'format'. -----------------------------------------------------------------------------*/ - switch ( PNM_FORMAT_TYPE(format) ) { + switch (PNM_FORMAT_TYPE(format)) { case PPM_TYPE: PPM_ASSIGN(*outputXelP, (fracnew0 * PPM_GETR(prevXel) @@ -178,7 +179,6 @@ shearRow(xel * const xelrow, } - static xel backgroundColor(const char * const backgroundColorName, xel * const topRow, @@ -189,24 +189,7 @@ backgroundColor(const char * const backgroundColorName, xel retval; if (backgroundColorName) { - retval = ppm_parsecolor(backgroundColorName, maxval); - - switch(PNM_FORMAT_TYPE(format)) { - case PGM_TYPE: - if (!PPM_ISGRAY(retval)) - pm_error("Image is PGM (grayscale), " - "but you specified a non-gray " - "background color '%s'", backgroundColorName); - break; - case PBM_TYPE: - if (!PNM_EQUAL(retval, pnm_whitexel(maxval, format)) && - !PNM_EQUAL(retval, pnm_blackxel(maxval, format))) - pm_error ("Image is PBM (black and white), " - "but you specified '%s', which is neither black " - "nor white, as background color", - backgroundColorName); - break; - } + retval = pnm_parsecolorxel(backgroundColorName, maxval, format); } else retval = pnm_backgroundxelrow(topRow, cols, maxval, format); |