Author: Carlos Lopez <genet...@gmail.com> Date: Thu Nov 8 19:23:09 2012 +0100
Some layers now renders using the correct blend method. --- .../src/modules/lyr_freetype/lyr_freetype.cpp | 3 +-- synfig-core/src/modules/mod_filter/blur.cpp | 3 +-- .../src/modules/mod_geometry/checkerboard.cpp | 8 ++++++-- synfig-core/src/modules/mod_geometry/circle.cpp | 12 ++++-------- synfig-core/src/modules/mod_geometry/outline.cpp | 3 +-- synfig-core/src/modules/mod_geometry/region.cpp | 3 +-- .../src/modules/mod_gradient/conicalgradient.cpp | 3 +-- .../src/modules/mod_gradient/lineargradient.cpp | 3 +-- .../src/modules/mod_gradient/radialgradient.cpp | 3 +-- synfig-core/src/synfig/layer_polygon.cpp | 3 +-- synfig-core/src/synfig/layer_solidcolor.cpp | 5 ++--- 11 files changed, 20 insertions(+), 29 deletions(-) diff --git a/synfig-core/src/modules/lyr_freetype/lyr_freetype.cpp b/synfig-core/src/modules/lyr_freetype/lyr_freetype.cpp index ff18718..dcee2db 100644 --- a/synfig-core/src/modules/lyr_freetype/lyr_freetype.cpp +++ b/synfig-core/src/modules/lyr_freetype/lyr_freetype.cpp @@ -1066,8 +1066,7 @@ Layer_Freetype::accelerated_cairorender(Context context,cairo_surface_t *surface } else { - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); } cairo_restore(cr); diff --git a/synfig-core/src/modules/mod_filter/blur.cpp b/synfig-core/src/modules/mod_filter/blur.cpp index f9f92c8..ec5e5dd 100644 --- a/synfig-core/src/modules/mod_filter/blur.cpp +++ b/synfig-core/src/modules/mod_filter/blur.cpp @@ -345,8 +345,7 @@ Blur_Layer::accelerated_cairorender(Context context,cairo_surface_t *surface,int cairo_save(cr); cairo_set_source_surface(cr, blurred, -halfsizex, -halfsizey); - cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); // TODO this has to be the real operator - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_restore(cr); if(cb && !cb->amount_complete(10000,10000)) diff --git a/synfig-core/src/modules/mod_geometry/checkerboard.cpp b/synfig-core/src/modules/mod_geometry/checkerboard.cpp index 6c61447..606e375 100644 --- a/synfig-core/src/modules/mod_geometry/checkerboard.cpp +++ b/synfig-core/src/modules/mod_geometry/checkerboard.cpp @@ -278,10 +278,14 @@ CheckerBoard::accelerated_cairorender(Context context,cairo_surface_t *surface,i cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); cairo_set_source(cr, pattern); if(is_solid_color()) + { cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); + cairo_paint_with_alpha(cr, get_amount()); + } else - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO this has to be the real operator - cairo_paint_with_alpha(cr, get_amount()); + { + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); + } cairo_restore(cr); cairo_surface_destroy(subimage); cairo_pattern_destroy(pattern); diff --git a/synfig-core/src/modules/mod_geometry/circle.cpp b/synfig-core/src/modules/mod_geometry/circle.cpp index ff26c55..ae01776 100644 --- a/synfig-core/src/modules/mod_geometry/circle.cpp +++ b/synfig-core/src/modules/mod_geometry/circle.cpp @@ -953,8 +953,7 @@ Circle::accelerated_cairorender(Context context,cairo_surface_t *surface,int qua // now let's paint the inverted circle with the hole on the rendered context cairo_save(cr); cairo_set_source_surface(cr, subimage, 0, 0); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO this has to be the real operator - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_restore(cr); cairo_surface_destroy(subimage); cairo_destroy(subcr); @@ -1005,9 +1004,8 @@ Circle::accelerated_cairorender(Context context,cairo_surface_t *surface,int qua cairo_scale(cr, sx, sy); cairo_arc(cr, origin[0], origin[1], out_radius, 0., 2*M_PI); cairo_clip(cr); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator cairo_set_source_rgba(cr, r, g, b, a); - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_restore(cr); cairo_destroy(cr); return true; @@ -1101,9 +1099,8 @@ Circle::accelerated_cairorender(Context context,cairo_surface_t *surface,int qua cairo_save(cr); cairo_translate(cr, tx , ty); cairo_scale(cr, sx, sy); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator cairo_set_source(cr, gradient); - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_pattern_destroy(gradient); // Not needed more cairo_restore(cr); cairo_destroy(cr); @@ -1153,9 +1150,8 @@ Circle::accelerated_cairorender(Context context,cairo_surface_t *surface,int qua cairo_save(cr); cairo_translate(cr, tx , ty); cairo_scale(cr, sx, sy); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator cairo_set_source(cr, gradient); - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_pattern_destroy(gradient); // Not needed more cairo_restore(cr); cairo_destroy(cr); diff --git a/synfig-core/src/modules/mod_geometry/outline.cpp b/synfig-core/src/modules/mod_geometry/outline.cpp index 0faa75a..1d7b7c1 100644 --- a/synfig-core/src/modules/mod_geometry/outline.cpp +++ b/synfig-core/src/modules/mod_geometry/outline.cpp @@ -1079,8 +1079,7 @@ Outline::accelerated_cairorender(Context context,cairo_surface_t *surface,int qu double py(tl[1]-workdesc.get_tl()[1]); cairo_save(cr); cairo_set_source_surface(cr, subimage, px, py ); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_restore(cr); cairo_surface_destroy(subimage); cairo_destroy(subcr); diff --git a/synfig-core/src/modules/mod_geometry/region.cpp b/synfig-core/src/modules/mod_geometry/region.cpp index 11b0ab6..c9eb832 100644 --- a/synfig-core/src/modules/mod_geometry/region.cpp +++ b/synfig-core/src/modules/mod_geometry/region.cpp @@ -455,8 +455,7 @@ Region::accelerated_cairorender(Context context,cairo_surface_t *surface,int qua double py(tl[1]-workdesc.get_tl()[1]); cairo_save(cr); cairo_set_source_surface(cr, subimage, px, py ); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_restore(cr); cairo_surface_destroy(subimage); cairo_destroy(subcr); diff --git a/synfig-core/src/modules/mod_gradient/conicalgradient.cpp b/synfig-core/src/modules/mod_gradient/conicalgradient.cpp index 4f09627..b14efe3 100644 --- a/synfig-core/src/modules/mod_gradient/conicalgradient.cpp +++ b/synfig-core/src/modules/mod_gradient/conicalgradient.cpp @@ -345,9 +345,8 @@ ConicalGradient::accelerated_cairorender(Context context,cairo_surface_t *surfac } cairo_translate(cr, tx , ty); cairo_scale(cr, sx, sy); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator cairo_set_source(cr, pattern); - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_pattern_destroy(pattern); // Not needed more cairo_restore(cr); diff --git a/synfig-core/src/modules/mod_gradient/lineargradient.cpp b/synfig-core/src/modules/mod_gradient/lineargradient.cpp index 35e14e6..25f54aa 100644 --- a/synfig-core/src/modules/mod_gradient/lineargradient.cpp +++ b/synfig-core/src/modules/mod_gradient/lineargradient.cpp @@ -311,9 +311,8 @@ LinearGradient::accelerated_cairorender(Context context,cairo_surface_t *surface } cairo_translate(cr, tx , ty); cairo_scale(cr, sx, sy); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator cairo_set_source(cr, pattern); - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_pattern_destroy(pattern); // Not needed more cairo_restore(cr); diff --git a/synfig-core/src/modules/mod_gradient/radialgradient.cpp b/synfig-core/src/modules/mod_gradient/radialgradient.cpp index e6a3413..e8b9c8e 100644 --- a/synfig-core/src/modules/mod_gradient/radialgradient.cpp +++ b/synfig-core/src/modules/mod_gradient/radialgradient.cpp @@ -299,9 +299,8 @@ RadialGradient::accelerated_cairorender(Context context,cairo_surface_t *surface } cairo_translate(cr, tx , ty); cairo_scale(cr, sx, sy); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator cairo_set_source(cr, pattern); - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_pattern_destroy(pattern); // Not needed more cairo_restore(cr); diff --git a/synfig-core/src/synfig/layer_polygon.cpp b/synfig-core/src/synfig/layer_polygon.cpp index f7cbb2c..ac6d373 100644 --- a/synfig-core/src/synfig/layer_polygon.cpp +++ b/synfig-core/src/synfig/layer_polygon.cpp @@ -360,8 +360,7 @@ Layer_Polygon::accelerated_cairorender(Context context,cairo_surface_t *surface, double px(tl[0]-workdesc.get_tl()[0]); double py(tl[1]-workdesc.get_tl()[1]); cairo_set_source_surface(cr, subimage, px, py ); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real operator - cairo_paint_with_alpha(cr, get_amount()); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); cairo_restore(cr); cairo_surface_destroy(subimage); cairo_destroy(subcr); diff --git a/synfig-core/src/synfig/layer_solidcolor.cpp b/synfig-core/src/synfig/layer_solidcolor.cpp index db41f64..db2e26f 100644 --- a/synfig-core/src/synfig/layer_solidcolor.cpp +++ b/synfig-core/src/synfig/layer_solidcolor.cpp @@ -210,9 +210,8 @@ Layer_SolidColor::accelerated_cairorender(Context context,cairo_surface_t *surfa } cairo_set_source_rgba(cr, r, g, b, a); - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO: this has to be the real blend method! - cairo_paint_with_alpha(cr, get_amount()); - cairo_destroy(cr); + cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method()); + cairo_destroy(cr); // Mark our progress as finished if(cb && !cb->amount_complete(10000,10000)) ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ Synfig-devl mailing list Synfig-devl@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synfig-devl