From 2be579ebe9adb75296037faf3ed89d7a5f25bbbd Mon Sep 17 00:00:00 2001 From: mental Date: Sun, 24 Jun 2007 18:42:24 +0000 Subject: [PATCH] move blend after blur, and blend with background buffer (enabled as necessary) --- src/filter-chemistry.cpp | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index 336ac3576..d3a02852e 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -211,21 +211,6 @@ new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdo // get corresponding object SPFilter *f = SP_FILTER( document->getObjectByRepr(repr) ); - // Blend primitive - if(strcmp(blendmode, "normal")) { - Inkscape::XML::Node *b_repr; - b_repr = xml_doc->createElement("svg:feBlend"); - b_repr->setAttribute("inkscape::collect", "always"); - b_repr->setAttribute("mode", blendmode); - - // set feBlend as child of filter node - repr->appendChild(b_repr); - Inkscape::GC::release(b_repr); - - SPFeBlend *b = SP_FEBLEND(document->getObjectByRepr(b_repr)); - g_assert(b != NULL); - g_assert(SP_IS_FEBLEND(b)); - } // Gaussian blur primitive if(radius != 0) { set_filter_area(repr, radius, expansion, expansionX, expansionY, width, height); @@ -250,6 +235,28 @@ new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdo g_assert(b != NULL); g_assert(SP_IS_GAUSSIANBLUR(b)); } + // Blend primitive + if(strcmp(blendmode, "normal")) { + Inkscape::XML::Node *b_repr; + b_repr = xml_doc->createElement("svg:feBlend"); + b_repr->setAttribute("inkscape:collect", "always"); + b_repr->setAttribute("mode", blendmode); + b_repr->setAttribute("in2", "BackgroundImage"); + + // set feBlend as child of filter node + repr->appendChild(b_repr); + Inkscape::GC::release(b_repr); + + // Enable background image buffer for document + Inkscape::XML::Node *root = b_repr->root(); + if (!root->attribute("enable-background")) { + root->setAttribute("enable-background", "new"); + } + + SPFeBlend *b = SP_FEBLEND(document->getObjectByRepr(b_repr)); + g_assert(b != NULL); + g_assert(SP_IS_FEBLEND(b)); + } g_assert(f != NULL); g_assert(SP_IS_FILTER(f)); -- 2.30.2