about summary refs log tree commit diff
path: root/editor
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-12-03 16:08:00 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-12-03 16:08:00 +0000
commit8e01637df59e9a366dede344bfb0df4343f540eb (patch)
tree983ca737ba523ba57e12b9c3b502db9f63c15619 /editor
parentacd527864efe6651f58a291ec6d707188ea20b29 (diff)
downloadnetpbm-mirror-8e01637df59e9a366dede344bfb0df4343f540eb.tar.gz
netpbm-mirror-8e01637df59e9a366dede344bfb0df4343f540eb.tar.xz
netpbm-mirror-8e01637df59e9a366dede344bfb0df4343f540eb.zip
Release 10.35.19
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@163 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rw-r--r--editor/pnmrotate.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/editor/pnmrotate.c b/editor/pnmrotate.c
index 64c69e2a..ba817c17 100644
--- a/editor/pnmrotate.c
+++ b/editor/pnmrotate.c
@@ -159,6 +159,27 @@ 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,
@@ -180,8 +201,7 @@ backgroundColor(const char * const backgroundColorName,
 
             break;
         case PBM_TYPE:
-            if (!PNM_EQUAL(retval, pnm_whitexel(maxval, format)) &&
-                !PNM_EQUAL(retval, pnm_blackxel(maxval, format)))
+            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",