How to make a nondestructive mask in Inkscape?

I wish to achieve a white icon (final result is a white PNG image with transparency).

For example – I want a white rectangle with the text “NOTHING HERE” subtracted from that rectangle (I want the final PNG to have the transparency where the text is).

Doing this is very simple – I create a rectangle, add the text, then subtract the text (possibly after converting it to a path) from the rectangle.

This works, but leaves the text fixed and I can no longer edit it.

The above is a simplified description of what I’m facing. I usually don’t work with just text – I need to subtract one shape from another, but I’d like to be able to keep working on the shape used for the subtraction.

I was thinking about using a mask, but I can’t seem to figure out how would I use it for this case. That said, editing masks / clips is also made more difficult. Ideally I’d like to use a filter which simply makes anything below the object it’s applied to “vanish”, but I’m not sure which filter I should use (and how I should configure it).

EDIT: Quick note – I used to work a bit with Corel Draw. If memory serves, Corel can turn an object into a sort of mask-like filter, where it applies whatever effect you select to anything directly under the object. I believe it’s called a lens. Said lenses could apply various effects (including color manipulation and more). Doesn’t Inkscape have anything similar?

Answer

This is possible to do with masks, and keep the text as text. With the creative use of clones, you can also make it so the text is editable without having to release the mask too!

gif of result

Here is a quick run of the steps:

  1. First, create your rectangle that you want to ‘cut’ the text out of I made mine magenta

  2. Next, duplicate the magenta rectangle, and make it 100% White.

  3. Add your text above the white rectangle, and make the text 100% Black.

  4. Clone the text object (Alt + D)

  5. Select the cloned text object and the white rectangle, and group them together.

  6. Select the Magenta rectangle, and the group containing the clone and the white rectangle, and do Edit > Mask > Set

  7. Select the original text object, add it to a group by itself, and set the master opacity (the slider at the bottom the fill/stroke dialog) of this group to 0.

  8. Select everything, and group it all together. To edit the text object, pick the Text tool, and click on the text to edit.

Attribution
Source : Link , Question Author : Shaamaan , Answer Author : ryanlerch

Leave a Comment