How to properly Mask/Clip/Exclude drop shadow filter

Post questions on how to use or achieve an effect in Inkscape.
arsenius
Posts: 18
Joined: Sat Jan 28, 2012 4:20 pm

How to properly Mask/Clip/Exclude drop shadow filter

Postby arsenius » Sun Jan 29, 2012 2:45 pm

I'm trying to cut out the center of a button so that I can fill it in in my app. The button has a drop shadow on it (applied via filters...drop shadow), and I can't get the drop shadow to stay, while cutting out the center.

I want the red portion to be transparent in my final image:
Image

But the closest I have been able to get is this:
Image

which is basically the opposite effect I want, as the drop shadow only remains on the inside, while I need it on the outside.

I have tried all of the clip/mask and path tools, but I'm sure I am not applying them in the right way. One other thing I thought of doing was to convert the drop shadow to a path, and cut that out. But I have no idea how to do that, or if it was possible.

What is the best way to get this cut out?

Thanks in advance!

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby brynn » Sun Jan 29, 2012 4:59 pm

Image
Welcome to InkscapeForum!

I'm not clear what you're trying to do. You can remove the filter using Filter menu > Remove filters. Is that enough info to help you? Otherwise I'd need to ask a bunch of questions to try and clarify.

arsenius
Posts: 18
Joined: Sat Jan 28, 2012 4:20 pm

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby arsenius » Sun Jan 29, 2012 5:57 pm

Thanks Brynn,

I do not want to remove the drop shadow. I just want to cut out the red area. I was able to do it in Gimp using the select by color tool and then deleting, but I would like to know if it is possible in Inkscape as well.

Image

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby brynn » Sun Jan 29, 2012 7:21 pm

Oh, yes it can be done with Inkscape, but not in the same way. An easy way might have been to just change the color from red to white, or whatever color. Unless you want that area to be transparent? In that case, you could make it transparent by changing the Alpha value of the red color.

arsenius
Posts: 18
Joined: Sat Jan 28, 2012 4:20 pm

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby arsenius » Mon Jan 30, 2012 12:44 am

Unfortunately just changing the alpha doesn't work. It removes the drop shadow as well, presumably because there is nothing to "block the light" when the alpha is 0.

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby Maestral » Mon Jan 30, 2012 2:57 am

Perhaps you could make the shape which would be blurred and represent dropshadow. Set it in back, while having the shape of the button present and on top, then use Path/Difference which would make shadow independent.

After all this, add the outlined shape of the button.

Image

*since the shape which represents shadow is blurred, it could (as shown) put some shadow on the button aswell but it could be prevented with careful choice of strokes width, on both "shadow" and "button" shapes.
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby brynn » Mon Jan 30, 2012 4:27 am

Unfortunately just changing the alpha doesn't work. It removes the drop shadow as well, presumably because there is nothing to "block the light" when the alpha is 0.

It worked when I tried it.

1 - draw rectangle
2 - add fill color
3 - apply drop shadow filter
4 - Fill and Stroke dialog > Fill tab > change A slider, not Opacity slider

Hhm....I see....changing Opacity to 0 makes entire thing transparent. Changing the A slider to 0 makes the red rectangle completely transparent, and the drop shadow partially transparent. That seems weird to me, but I can't explain it....??

arsenius
Posts: 18
Joined: Sat Jan 28, 2012 4:20 pm

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby arsenius » Mon Jan 30, 2012 7:07 pm

That's okay, thanks for trying! Guess it's gimp to the rescue for this one.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby druban » Mon Jan 30, 2012 7:18 pm

What is the best way to get this cut out?

The fast and easy way is to use the 'cutout' options in the drop shadow dialog, but not always the best result, note in my example the bottom of the drop shadow appears cut off, Depending on the size of your objects your results may be acceptable.

rect3219.png
rect3219.png (68.54 KiB) Viewed 5471 times

Manual clipping is the best way to get this effect, IMO. The shadow object is below a large rectangle with the shape of the original rounded corner rectangle cut out of it (with difference). The new shape is used to clip the blurred shadow rectangle.

rect5947.png
rect5947.png (74.35 KiB) Viewed 5482 times


Later edit: Oops, I should add that to use the cutout options you may have to download a more recent build of Inkscape.
Attachments
clipped cutout.svg
(48.38 KiB) Downloaded 199 times
Last edited by druban on Mon Jan 30, 2012 8:00 pm, edited 3 times in total.
Your mind is what you think it is.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby brynn » Mon Jan 30, 2012 7:44 pm

Oh, that's an awesome effect there, druban!

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby Maestral » Mon Jan 30, 2012 8:58 pm

Excellent idea, druban.
I use cutout a lot, but here`s what I got in combination with masking
Image
*red stripe is just transparency reference.
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

arsenius
Posts: 18
Joined: Sat Jan 28, 2012 4:20 pm

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby arsenius » Tue Jan 31, 2012 1:50 am

druban wrote:
What is the best way to get this cut out?

Manual clipping is the best way to get this effect, IMO. The shadow object is below a large rectangle with the shape of the original rounded corner rectangle cut out of it (with difference). The new shape is used to clip the blurred shadow rectangle.


Thank you very much!

This is almost working for me, except for a small problem. You probably couldn't have noticed it since you used black as the color of your box before the drop shadow. I think there is a small size difference between the first cutout (difference) and the actual shape. Therefore, a little bit of the color leaks through. It's kind of weird, but when I zoom in, the color disappears, and when I zoom out, it reappears. But it is clearly visible when exported.

Here is the exported bitmap, where it is most obvious (zoomed in):
Image

Zoomed out in inkscape, has a bit of green tint (I took a screenshot, zoomed into the screenshot, and took another screenshot):
Image

And zoomed way in in inkscape, the green almost disappears:
Image

Unless you zoom into the bitmap:
Image

Is this a bug?

arsenius
Posts: 18
Joined: Sat Jan 28, 2012 4:20 pm

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby arsenius » Tue Jan 31, 2012 2:15 am

Just in case anyone reads this, I was able to take care of the slight outline by increasing the width and height by about .150 pixels each, re-centering over the original object, and then doing difference using the slightly enlarged object.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby druban » Tue Jan 31, 2012 3:10 am

i believe whaat you are seeing is an expected behaviour when exporting screen resolution bitmaps in which the objects are not aligned with a pixel grid. In this case in particular the clipping object should be aligned with the pixelgrid (rather than the drop shadow, which is soft edged anyway) to give the sharpest effect. Expanding its size may have had the same effect.
Your mind is what you think it is.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to properly Mask/Clip/Exclude drop shadow filter

Postby brynn » Tue Jan 31, 2012 6:53 pm

druban wrote:i believe whaat you are seeing is an expected behaviour when exporting screen resolution bitmaps in which the objects are not aligned with a pixel grid. In this case in particular the clipping object should be aligned with the pixelgrid (rather than the drop shadow, which is soft edged anyway) to give the sharpest effect. Expanding its size may have had the same effect.

Interesting that it's green though! Did you use green anywhere in the image?


Return to “Help with using Inkscape”