about summary refs log tree commit diff
path: root/editor/pnmrotate.c
diff options
context:
space:
mode:
Diffstat (limited to 'editor/pnmrotate.c')
-rw-r--r--editor/pnmrotate.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/editor/pnmrotate.c b/editor/pnmrotate.c
index fafb2f3a..a8cf62b0 100644
--- a/editor/pnmrotate.c
+++ b/editor/pnmrotate.c
@@ -15,9 +15,10 @@
 #include <math.h>
 #include <assert.h>
 
-#include "pnm.h"
-#include "shhopt.h"
 #include "mallocvar.h"
+#include "shhopt.h"
+#include "ppm.h"
+#include "pnm.h"
 
 #define SCALE 4096
 #define HALFSCALE 2048
@@ -169,25 +170,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);