diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-27 01:38:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-27 01:38:28 +0000 |
commit | 367c9cb514c9da766488b9bdb218a18e31cb7624 (patch) | |
tree | f9e343be94161a4837f0f1c1d072a35538ae0f63 /editor/pnmrotate.c | |
parent | 6e88e3326cb0c7f7975b56189278cab3f84ba1bd (diff) | |
download | netpbm-mirror-367c9cb514c9da766488b9bdb218a18e31cb7624.tar.gz netpbm-mirror-367c9cb514c9da766488b9bdb218a18e31cb7624.tar.xz netpbm-mirror-367c9cb514c9da766488b9bdb218a18e31cb7624.zip |
Promote Stable (10.47) to Super Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@2691 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pnmrotate.c')
-rw-r--r-- | editor/pnmrotate.c | 50 |
1 files changed, 7 insertions, 43 deletions
diff --git a/editor/pnmrotate.c b/editor/pnmrotate.c index ba817c17..ba37f4e0 100644 --- a/editor/pnmrotate.c +++ b/editor/pnmrotate.c @@ -15,9 +15,11 @@ #include <math.h> #include <assert.h> -#include "pnm.h" -#include "shhopt.h" +#include "pm_c_util.h" #include "mallocvar.h" +#include "shhopt.h" +#include "ppm.h" +#include "pnm.h" #define SCALE 4096 #define HALFSCALE 2048 @@ -159,27 +161,6 @@ computeNewFormat(bool const antialias, -static bool -isWhite(xel const color, - xelval const maxval) { - - return (PPM_GETR(color) == maxval && - PPM_GETG(color) == maxval && - PPM_GETB(color) == maxval); -} - - - -static bool -isBlack(xel const color) { - - return (PPM_GETR(color) == 0 && - PPM_GETG(color) == 0 && - PPM_GETB(color) == 0); -} - - - static xel backgroundColor(const char * const backgroundColorName, xel * const topRow, @@ -190,24 +171,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 (!isWhite(retval, maxval) && !isBlack(retval)) - 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); @@ -725,7 +689,7 @@ shearXToOutputFile(FILE * const ofP, unsigned int row; xel * xelrow; - pnm_writepnminit(stdout, newcols, rows, maxval, format, 0); + pnm_writepnminit(ofP, newcols, rows, maxval, format, 0); xelrow = pnm_allocrow(newcols); @@ -742,7 +706,7 @@ shearXToOutputFile(FILE * const ofP, shearFinal(xels[row], xelrow, cols, newcols, format, bgColor, antialias, shiftAmount, x2shearjunk); - pnm_writepnmrow(stdout, xelrow, newcols, maxval, format, 0); + pnm_writepnmrow(ofP, xelrow, newcols, maxval, format, 0); } pnm_freerow(xelrow); } |