Page background is not an SVG element

Bug #180890 reported by MenTaLguY
50
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Medium
Unassigned

Bug Description

Since we cannot make blend modes work correctly over transparent backgrounds within the confines of SVG, we will need a good workaround. The problems are, unfortunately, extremely user-visible.

The best idea I've been able to come up with so far is to add an opaque rectangle as a child of the root <svg> element, underneath the bottom-most layer. The rectangle should be:

- opaque
- have its fill synchronized with the document background color
- have its dimensions synchronized with the document dimensions

The rectangle would be added the first time that blend mode is engaged for a layer in the document, and ideally removed when no layers any longer have a special blending mode. Export transparency should also be disabled when blend modes are in use.

Edit: This is about the double counting background problem as described in http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Filters-Compositing.html

Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

Note that this only applies to blend modes applied via the "blend mode" selector UI. If people want to use feBlend directly as a filter, that usage should probably not trigger the "backstop rectangle". Also note that this workaround is only useful if "blend modes" are restricted to layers.

Changed in inkscape:
importance: Undecided → Critical
milestone: none → 0.46
status: New → Confirmed
Changed in inkscape:
assignee: nobody → mental
Revision history for this message
Martin Andersen (msandersen) wrote :

Wouldn't simply changing the page colour to some solid colour (white if it isn't already set, full opacity of any other colour set) fix this, rather than a "backstop rectangle"? Obviously then you wouldn't have to resize anything.

Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

No. The SVG rendering model for background accumulation buffers (used for filter input) starts with a transparent buffer and provides no way to paint anything into that buffer before objects are rendered into it. It never includes the page color. The only way to pre-paint opaque pixels to the buffer before objects are rendered into it is to give them an opaque sibling at the very bottom (i.e. something like a "backstop rectangle").

Besides a rect, another option might be an empty group with an feFlood filter applied with the filter effect area being the document dimensions.

Revision history for this message
Bryce Harrington (bryce) wrote :

Mental, how is the implementation status of this so far?

Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

I don't think it's attainable for 0.46 at this point. There are really too many subtle implementation and architectural issues.

Revision history for this message
Bryce Harrington (bryce) wrote :

Sounds good; I've listed this as a known issue in the ReleaseNotes, and moved the milestone to 0.47. Mental, feel free to unassign yourself if you'd like to leave the task for someone else to do (but if so please offer mentorship in case a future developer has Q's).

Changed in inkscape:
milestone: 0.46 → 0.47
tags: added: filters-svg
ScislaC (scislac)
Changed in inkscape:
milestone: 0.47 → none
Revision history for this message
Krzysztof Kosinski (tweenk) wrote :

The fact that the page background is not an actual SVG element also has the negative effect that images with non-transparent background render incorrectly in other SVG renderers. When I set a black background I would expect the image to show up that way in other viewers.

I don't think it's critical though - there are valid workarounds, for example creating a background rect manually. Dropping to Medium.

summary: - work around deficiencies of feBlend-based blend modes
+ Page background is not an SVG element
Changed in inkscape:
importance: Critical → Medium
Niko Kiirala (kiirala)
description: updated
jazzynico (jazzynico)
Changed in inkscape:
status: Confirmed → Triaged
Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

'background' is/will be added in SVG 2.

Revision history for this message
Roul P. (perhelion1) wrote :

> "'background' is/will be added in SVG 2."

As we can see these happens only in years. -.- This is would be also not a proper solution, because no backward compatibility.
I don't understand why this high wanted feature don't get solved since over 12 years (2005-01 reported Bug #166213), it's fucking simple!!

Revision history for this message
grey tomorrow (gtomorrow) wrote :

Closing because INVALID.

Please see https://gitlab.com/inkscape/inbox/-/issues/286

If you feel this issue has been unjustly closed, please feel free to open a new issue at https://inkscape.org/report . Thank you.

Closed by: https://gitlab.com/greytomorrow

tags: added: bug-migration
Changed in inkscape:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.