Masked objects don't show (outside of Inkscape)

Bug #1649870 reported by Djerk Geurts
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Medium
Unassigned

Bug Description

Version: 0.91.0+devel+15323+77~ubuntu14.04.1_amd64.deb

Having problems with masks. They work perfectly in Inkscape and I can export the images to PDF and PNG just fine. However when I try to view the SVG in Chrome, Firefox, Image Viewer, Nautilus or online the masked object is missing.

I've tried the Inkscape default SVG and the plain SVG option, both with the same result. If I unmask the object all items show up just fine.

Tags: masking
Revision history for this message
Djerk Geurts (djerkg) wrote :
Revision history for this message
Djerk Geurts (djerkg) wrote :

Could only add a single file when logging the case. Nautilus screenshot attached of 2 SVG, a PNG and the PDF. Though these are thumbnails they do show the problem well.

Revision history for this message
Hachmann (marenhachmann) wrote :

Seems to be a problem with the viewbox. If I delete it in the xml, the drawing becomes smaller, but everything shows up just as expected.
How did you create the file?

Revision history for this message
Djerk Geurts (djerkg) wrote :

Opened Inkscape and drew the rectangles. Set fill and stroke on them. Added the circle, set fill and stroke on that. Grouped the rectangles. Selected the group and the circle and set the mask.

I set the page size according to the drawing.

Revision history for this message
Hachmann (marenhachmann) wrote :

I do see a difference between the browser display and the display in Inkscape if I follow your step-by-step instructions. It's not as pronounced as in your case, but different nonetheless.

The difference in display is also still there in Inkscape 0.92r15210. In Chromium, it looks the same as in Firefox. Creating a new layer (to circumvent the layer transform bug) does not make a difference.

But: it looks correct if the transform on the group is removed, by removing the mask, ungrouping after page size change, then regroup and remask.

In Inkscape 0.92pre, if I *create* an image like that there, it seems to work alright, although I only tested with two different sets of objects.

Revision history for this message
Djerk Geurts (djerkg) wrote :

Interesting.

If I unmask, ungroup. Set page size to the drawing (nothing selected). Then select all three items then mask. The Inkscape result is the same. Firefox though shows a clipped image, it's missing a section of the bottom. But the mask and two items underneath are shown

Same result in Chrome, but Nautilus and Image Viewer (Ubuntu 14.04) don't show anything as if the mask doesn't exist resulting in a completely transparent image.

Revision history for this message
Djerk Geurts (djerkg) wrote :

http://tutorials.jenkov.com/svg/svg-viewport-view-box.html

^^^ Looking at the viewbox attribute, Inkscape (v0.91 and 0.92) looks to set the expected values. Increasing the value for height does show more of the masked item but weirdly it's allocated from the top rather than the bottom left, which is where Inkscape puts the 0:0 (x:y) coordinates.

Annoyingly this also adds transparency at the bottom, dynamically increasing the height of the image. Which is only logical if the viewbox height exceeds the page height.

As such it seems that all the viewers mentioned struggle with the viewbox element.

Looking further into this and reading up on userSpaceOnUse I find that Inkscape doesn't specify the
coordinates for the mask. A bit of trial and error shows that if I set these, and double the height value I am able to correct for the mask not showing.

Inkscape default - viewBox="0 0 177 156" with the same height and width as the viewbox:
<mask maskUnits="userSpaceOnUse" id="mask4250">

Corrected value which yields the desired result in Nautilus, Image Viewer, Chrome, Firefox and I assume others:
<mask maskUnits="userSpaceOnUse" id="mask4250" x="0" y="0" width="177" height="312">

Revision history for this message
Djerk Geurts (djerkg) wrote :

Sadly this manual workaround does not help me with an SVG with more elements I'm working on.

Revision history for this message
jazzynico (jazzynico) wrote :

Related (or duplicate): Bug #404009 "rendering different in inkscape than FF/Baltik with masked objects".
<https://bugs.launchpad.net/inkscape/+bug/404009>

Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Nathan Lee (nathan.lee) wrote :

Hi, thanks for reporting.

We've moved our bug tracker to Gitlab, so I'm closing this to continue the tracking the issue in https://gitlab.com/inkscape/inkscape/-/issues/3183 .

Regarding the network file in #8, it renders for me if I change the mask's y value to 1000 (to match the transform that is applied to the layer)

Issue still happens in Inkscape 1.2-dev (c903a5148f, 2022-01-31) Linux Mint 20.

Changed in inkscape:
status: Confirmed → 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.