filter: get the stroke (outline + color) or the inside ?

Discuss SVG code, accessible via the XML Editor.
v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

filter: get the stroke (outline + color) or the inside ?

Postby v1nce » Thu Jan 05, 2012 9:29 am

Hi,

1) Am I missing something or there's no way to get the stroke in svg filter ?
We can get the SourceGraphic (of course), the SourceAlpha (we could get this one by running SourceGraphic through a colormatrix)
but what about the individual Fill (and Fill alpha) and Stroke (and alpha) ?

2) it looks like FillPaint and StrokePaint don't work in inkscape (I get the shape instead of an "infinite" rect filled with the fill and stroke colors/gradients). Can anybody confirm this ?

Thanks for reading.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: filter: get the stroke (outline + color) or the inside

Postby ~suv » Thu Jan 05, 2012 1:58 pm

v1nce wrote:2) it looks like FillPaint and StrokePaint don't work in inkscape

AFAIK it was never implemented in Inkscape: Inkscape Wiki: Filter Effects

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: filter: get the stroke (outline + color) or the inside

Postby chriswww » Thu Jan 19, 2012 1:24 pm

i think svg spec itself is that filter is assigned to object, not to the fill or stroke. in other words, filter is another settable attribute of an object, fill and stroke are other such attributes. a possible workaround is to duplicate the object, remove the stroke on the duplicate and remove the fill on the original (or vice versa), and then apply the filter to the one you want.
it's the same situation for object blur amount and transparency, they apply to the entire object itself; not the fill or stroke.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: filter: get the stroke (outline + color) or the inside

Postby ~suv » Thu Jan 19, 2012 1:39 pm

Edit: nevermind - yours is the answer to the first part of the question… sorry ;)
Off topic:
chriswww wrote:i think svg spec itself is that filter is assigned to object, not to the fill or stroke. (…)
That was not the question asked here (please reread the original comment): There are two filter input sources defined in the SVG 1.1 specification which are not supported in Inkscape: They allow to extract the color (aka paint) of the fill or stroke and use that 'paint' (an image with conceptually infinite extent) as input source for various filter primitives in the filter definition.

For the details, see the SVG 1.1 specification.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: filter: get the stroke (outline + color) or the inside

Postby ~suv » Thu Jan 19, 2012 2:11 pm

chriswww wrote:it's the same situation for object blur amount and transparency, they apply to the entire object itself; not the fill or stroke.

Note: "object blur" is itself an SVG filter effect (feGaussianBlur).

With regard to transparency, SVG 1.1 knows 'opacity' (applies to the object itself), fill-opacity as well as stroke-opacity (applies to fill or stroke, corresponds to the 'Alpha' slider in Inkscape), and stop-opacity (for gradient stops).

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: filter: get the stroke (outline + color) or the inside

Postby v1nce » Fri Jan 20, 2012 6:59 am

chriswww wrote:i think svg spec itself is that filter is assigned to object, not to the fill or stroke.


So the svg specs are stupid/incomplete

IMHO You could do less things with the current FillPaint StrokePaint that you could do if there was
StrokeGraphic + FillGraphic (= SourceGraphic)
StrokeAlpha + FillAlpha (= SourceAlpha)

chriswww wrote:A possible workaround is to duplicate the object, remove the stroke on the duplicate and remove the fill on the original (or vice versa),

Or maybe just "emulate" the border by getting the stroke width
pseudostroke => SourceGraphic in [morphology(+0.5*width) - morphology(-0.5*width) ]

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: filter: get the stroke (outline + color) or the inside

Postby chriswww » Fri Jan 20, 2012 10:46 am

looks like i haven't kept up with the spec. thanks ~suv.
wonder if there's a wave of new books about SVG, now that it's back in fashion.


Return to “SVG / XML Code”