From 1e31c41a0ef4b0f383d4f9d2941f643ae67ca646 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 28 Aug 2018 19:52:11 +0200 Subject: Fix opacity of rasterized filters in PDF export Opacity was applied thrice: 1. when rendering the filter to a pixbuf (i.e. transparency was baked into the bitmap) 2. when rendering this pixbuf onto a cairo surface 3. when actually rendering the (now doubly opaque) item Avoid 1. and 2. and only apply opacity once. Fixed bug: - https://bugs.launchpad.net/inkscape/+bug/381677 --- src/extension/internal/cairo-renderer.cpp | 2 ++ src/helper/pixbuf-ops.cpp | 3 +++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index b21505431..71bda6bbc 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -523,7 +523,9 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) if (pb) { //TEST(gdk_pixbuf_save( pb, "bitmap.png", "png", NULL, NULL )); + ctx->pushState(); ctx->renderImage(pb.get(), t, item->style); + ctx->popState(); } } diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index 947af3b50..a79efdbdd 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -131,6 +131,9 @@ Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const */*fi // because that would not work if the shown item references something in defs if (item_only) { hide_other_items_recursively(doc->getRoot(), item_only, dkey); + // TODO: The following line forces 100% opacity as required by sp_asbitmap_render() in cairo-renderer.cpp + // Make it contitional if 'item_only' is ever used by other callers which need to retain opacity + item_only->get_arenaitem(dkey)->setOpacity(1.0); } Geom::IntRect final_bbox = Geom::IntRect::from_xywh(0, 0, width, height); -- cgit v1.2.3