Author: Carlos Lopez <genet...@gmail.com>
Date:   Sat Aug 11 09:24:46 2012 +0200

Circle Layer: initial support for straight blend inverted linear feathered 
circles

---

 synfig-core/src/modules/mod_geometry/circle.cpp |   32 ++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/synfig-core/src/modules/mod_geometry/circle.cpp 
b/synfig-core/src/modules/mod_geometry/circle.cpp
index aaa343b..604e8ea 100644
--- a/synfig-core/src/modules/mod_geometry/circle.cpp
+++ b/synfig-core/src/modules/mod_geometry/circle.cpp
@@ -788,7 +788,7 @@ Circle::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int qua
        const Real pw = (br[0] - tl[0]) / w;
        const Real ph = (br[1] - tl[1]) / h;
        
-       // True if circle is degenerated (in_radius <0)
+       // True if circle is degenerated (out_radius <0)
        bool degenerated(false);
        
        // Don't render feathering at all when quality is 10
@@ -1014,6 +1014,36 @@ Circle::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int qua
        }
        else // feathered circle
        {
+               if(invert)
+               {
+                       // Draw the inverted feathered circle
+                               cairo_pattern_t* 
gradient=cairo_pattern_create_radial(origin[0], origin[1], out_radius, 
origin[0], origin[1], in_radius);
+                               cairo_pattern_add_color_stop_rgba(gradient, 
0.0, r, g, b, a);
+                               cairo_pattern_add_color_stop_rgba(gradient, 
1.0, r, g, b, 0);
+                               // Now draw the circle with the out_radius
+                               cairo_save(cr);
+                               // This is the scale and translation values
+                               double tx(-tl[0]/pw);
+                               double ty(-tl[1]/ph);
+                               double sx(1/pw);
+                               double sy(1/ph);
+                               
+                               cairo_translate(cr, tx , ty);
+                               cairo_scale(cr, sx, sy);
+                               cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+                               cairo_set_source(cr, gradient);
+                               cairo_paint_with_alpha(cr, get_amount());
+                               cairo_restore(cr);
+                               cairo_pattern_destroy(gradient);
+                               cairo_destroy(cr);
+                               return true;
+
+                       
+               }
+               else
+               {
+                       
+               }
                
        }
        cairo_destroy(cr);


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to