about summary refs log tree commit diff
path: root/editor
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-08-18 02:17:07 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-08-18 02:17:07 +0000
commitcb90201b95844e16740e620efec54d695d3fceca (patch)
treea720f2302ed3aa8e86b058145bb9dc435c2ad700 /editor
parentb2e350036b3d3e65d9d130f2eafbd06b2f69f34d (diff)
downloadnetpbm-mirror-cb90201b95844e16740e620efec54d695d3fceca.tar.gz
netpbm-mirror-cb90201b95844e16740e620efec54d695d3fceca.tar.xz
netpbm-mirror-cb90201b95844e16740e620efec54d695d3fceca.zip
Fix manipulation of supposed opacity plane when it's not a visual image
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4415 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rw-r--r--editor/pamcat.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/editor/pamcat.c b/editor/pamcat.c
index f44062c5..edceb835 100644
--- a/editor/pamcat.c
+++ b/editor/pamcat.c
@@ -912,11 +912,15 @@ createLrImgCtlArray(const struct pam *  const inpam,  /* array */
                 break;
             }
         }
-        /* Opacity sample of background color sample is meaningless at this
-           point; make it opaque.
-        */
-        if (outpamP->have_opacity)
-            thisEntryP->background[outpamP->opacity_plane] = outpamP->maxval;
+        if (outpamP->visual) {
+            /* Any opacity sample in background color tuple is meaningless at
+               this point; make it opaque.
+            */
+            if (outpamP->have_opacity) {
+                thisEntryP->background[outpamP->opacity_plane] =
+                    outpamP->maxval;
+            }
+        }
 
     }
     *imgCtlP = imgCtl;
@@ -1032,11 +1036,13 @@ initialBackgroundColor(const struct pam *  const outpamP,
         break;
     }
 
-    /* Opacity sample of background color sample is meaningless at this point;
-       make it opaque.
-    */
-    if (outpamP->have_opacity)
-        retval[outpamP->opacity_plane] = outpamP->maxval;
+    if (outpamP->visual) {
+        /* Any opacity sample in background color tuple is meaningless at this
+           point; make it opaque.
+        */
+        if (outpamP->have_opacity)
+            retval[outpamP->opacity_plane] = outpamP->maxval;
+    }
 
     return retval;
 }
@@ -1133,9 +1139,11 @@ readFirstTBRowAndDetermineBackground(const struct pam *  const inpamP,
 
         background = pnm_backgroundtuplerow(&partialOutpam, out);
 
-        /* Make the background opaque */
-        if (outpamP->have_opacity)
-            background[outpamP->opacity_plane] = outpamP->maxval;
+        if (outpamP->visual) {
+            /* Make the background opaque. */
+            if (outpamP->have_opacity)
+                background[outpamP->opacity_plane] = outpamP->maxval;
+        }
 
         *backgroundP = background;
     }