Author: Carlos Lopez <genet...@gmail.com>
Date:   Thu Apr 11 18:31:18 2013 +0200

CairoColor: add specialisation for blend method MULTIPLY

---

 synfig-core/src/synfig/color.cpp |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/synfig-core/src/synfig/color.cpp b/synfig-core/src/synfig/color.cpp
index 68b3f33..d5ed717 100644
--- a/synfig-core/src/synfig/color.cpp
+++ b/synfig-core/src/synfig/color.cpp
@@ -626,6 +626,30 @@ blendfunc_MULTIPLY(C &a,C &b,float amount)
        return b;
 }
 
+template <>
+CairoColor
+blendfunc_MULTIPLY(CairoColor &a,CairoColor &b, float amount)
+{
+       if(amount<0) a=~a, amount=-amount;
+       amount*=a.get_a()/255;
+       int ra, ga, ba, aa;
+       int rb, gb, bb, ab;
+       int rc, gc, bc, ac;
+
+       ra=a.get_r();
+       ga=a.get_g();
+       ba=a.get_b();
+       
+       rb=b.get_r();
+       gb=b.get_g();
+       bb=b.get_b();
+       
+       b.set_r((rb*ra/255-rb)*(amount)+rb);
+       b.set_g((gb*ga/255-gb)*(amount)+gb);
+       b.set_b((bb*ba/255-bb)*(amount)+bb);
+       return b;
+}
+
 template <class C>
 static C
 blendfunc_DIVIDE(C &a,C &b,float amount)


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to