UI to set filter size in px instead of %

Bug #1047975 reported by v1nce
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Wishlist
Unassigned

Bug Description

Lots of filters needs extra space around the bounding box (for blurring or offseting).

For now, inkscape UI only allows us to define the width and height as %.
% are fine because you don't have to care about the size of selected object.
but px are fine when you want to express the extraspace needed.

Could the ui been reworked so that we could mix up % and px in "expression" ?

Typically I would use "100% + 2 * x px" for a blur of size x (or a matrix of size 2x+1, or an offset of 2x px)

If it's too diffcult to add an expression evaluator could we at least have extra fields to specify some additionnal spacing in px ?

Why that ?

Right now some filters are clipped when applied on small objects.
On the opposite a lot of CPU power could be wasted because the width settings are set too high.

Proposed UI

coordinates : 0 0 offset: -5px -5px
dimensions : 1 1 offset: 10 px 10px

if bbox of object is 200,100 then filter would be

filter x="-5%" y="-2.5%" width="110%" height="105%" primitiveUnits="objectBoundingBox"

Tags: filters-svg ui
Revision history for this message
su_v (suv-lp) wrote :

Duplicate of Bug #497094 “editing of big text area (>500 characters) makes typing extremely slow”?
<https://bugs.launchpad.net/inkscape/+bug/497094>

tags: added: performance text
Revision history for this message
su_v (suv-lp) wrote :

Sorry, please ignore prior comment (pasted into wrong tab).

tags: removed: performance text
tags: added: filters-svg ui
Revision history for this message
su_v (suv-lp) wrote :
Download full text (3.2 KiB)

> Could the ui been reworked so that we could mix up % and px
> in "expression" ?
> (…)
> If it's too diffcult to add an expression evaluator could we at
> least have extra fields to specify some additionnal spacing in px ?

Based on the current SVG 1.1 specification:

This is unlikely to work the way you propose (or for only very limited use cases where one filter definition is applied only once in the current document, and to an object which is never edited in size later on):
- AFAIU the SVG 1.1 specification does not allow a mix of absolute units with bbox percentages if the coordinate system for attributes ‘x’, ‘y’, ‘width’ and ‘height’ is defined as 'objectBoundingBox'.
- Inkscape currently only supports 'objectBoundingBox' as coordinate system for the filter effects region when editing/writing filter effects. Any absolute margins (aka offsets) entered in the GUI would need to be converted to percentages of the current object bounding box when saving the filter definition in SVG.
- If the geometry of such a filtered object is edited later on (I'm not talking about scaling with the select tool, which scales the filtered result, not the geometry), the filter effects region will no longer match the user's expectation since it is now based on 'objectBoundingBox' percentages as stored in the filter definition (and knows nothing about prior absolute offset values which might have been entered in the GUI earlier). A similar issue would occur if the same filter effect is applied to differently sized objects.
- Inkscape currently only supports reading/rendering (but not editing/writing) of 'userSpaceOnUse' coordinates for the filter effects region of SVG filter effects.

AFAIU the core of your request probably is to implement 'useSpaceOnUse' coordinates for the filter effects region as option in the filter editor and add support for it when editing such filtered objects (including possibly auto-forking of filter definitions or daisy-chaining filter definitions (per object) to achieve different absolut positions and sizes when reusing the some definition for several objects).

If support for 'userSpaceOnUse' gets implemented, filters probably would need a similar 'Affects:' setting for the select tool (because the coordinates for the filter effects region in 'userSpaceOnUse' filter units need to be adjusted each time the filtered object gets moved or otherwise transformed, similar to what happens now with gradients and patterns (which Inkscape always edits/writes with values in 'userSpaceOnUse' coordinates for now)).

> filter x="-5%" y="-2.5%" width="110%" height="105%" primitiveUnits="objectBoundingBox"

In my understanding, 'primitiveUnits' is the wrong attribute here - the filter effects region as shown and edited in Inkscape's filter editor depends on 'filterUnits', not 'primitiveUnits' ('primitiveUnits' defines the coordinate system of a subregion which restricts calculation and rendering of the given filter primitive):
<http://www.w3.org/TR/SVG11/filters.html#FilterEffectsRegion>
<http://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveSubRegion>
AFAICT based on test files from W3C Inkscape does not yet support 'primitiveUnits' (ne...

Read more...

Changed in inkscape:
importance: Undecided → Wishlist
Revision history for this message
v1nce (vincent-pennec) wrote :

> Inkscape currently only supports 'objectBoundingBox' as coordinate system for the filter effects region when editing/writing filter effects. Any absolute margins (aka offsets) entered in the GUI would need to be converted to percentages of the current object bounding box when saving the filter definition in SVG.

Yes that's what I'm asking for.

> - If the geometry of such a filtered object is edited later on (I'm not talking about scaling with the select tool, which scales the filtered result, not the geometry), the filter effects region will no longer match the user's expectation since it is now based on 'objectBoundingBox' percentages as stored in the filter definition (and knows nothing about prior absolute offset values which might have been entered in the GUI earlier). A similar issue would occur if the same filter effect is applied to differently sized objects.

One would need to store some extra info in inkscape NS (like for LPE) and duplicate filter for each object that use it

<filter id="dropdownshadowbottomright" inkscape:name="dropdownshadowbottomright" x="0" y="0" w="1" h="1" inkscape:filterbox="0 0 0 0 1 1 10 10">...</filter>

define a filter whose width is 100% + 10 px (same for height).

everytime a new object (foo1) is added and reference this filter then -under the hood- a new filter is created (and masked) and the x,y,width and height are calculated according to the "defintion" in inkscape:filterbox and the object size.
If size is 100,100
<filter inkscape:hidden="true" inkscape:reference=url(#dropdownshadowbottomright) id="foo1_dropdownshadowbottomright" x="0" y="0" w="1.1" h="1.1">...</filter>

if another object foo2 is created with a size of 400,200
<filter inkscape:hidden="true" inkscape:reference=url(#dropdownshadowbottomright) id="foo2_dropdownshadowbottomright" x="0" y="0" w="1.025" h="1.05">...</filter>

> AFAIU the core of your request probably is to implement 'useSpaceOnUse' coordinates for the filter effects region as option in the filter editor and add support for it

I need to reread the specs. I'm not sure of USOU will help againts OBB here.

> when editing such filtered objects (including possibly auto-forking of filter definitions or daisy-chaining filter definitions (per object) to achieve different absolut positions and sizes when reusing the some definition for several objects).

yes

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.