Hello,

as SVG uses premultiplied alpha, we should not multiply it a second time.

hal
>From 47bdab232b382efb89881e79491b7f2c9dbd3ead Mon Sep 17 00:00:00 2001
From: hal <[email protected]>
Date: Sun, 10 Mar 2013 22:56:33 +0100
Subject: [PATCH] Fix: svg uses premultiplied alpha, we didn't respect this.

---
 src/iop/watermark.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/iop/watermark.c b/src/iop/watermark.c
index 3b8fad7..e30936a 100644
--- a/src/iop/watermark.c
+++ b/src/iop/watermark.c
@@ -645,9 +645,10 @@ void process (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, void
   for(int j=0; j<roi_out->height; j++) for(int i=0; i<roi_out->width; i++)
     {
       float alpha = (sd[3]/255.0)*opacity;
-      out[0] = ((1.0-alpha)*in[0]) + (alpha*(sd[2]/255.0));
-      out[1] = ((1.0-alpha)*in[1]) + (alpha*(sd[1]/255.0));
-      out[2] = ((1.0-alpha)*in[2]) + (alpha*(sd[0]/255.0));
+      /* svg uses a premultiplied alpha, so only use opacity for the blending */
+      out[0] = ((1.0-alpha)*in[0]) + (opacity*(sd[2]/255.0));
+      out[1] = ((1.0-alpha)*in[1]) + (opacity*(sd[1]/255.0));
+      out[2] = ((1.0-alpha)*in[2]) + (opacity*(sd[0]/255.0));
       out[3] = in[3];
 
       out+=ch;
-- 
1.7.10.4

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
darktable-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to