gradient to bbox edges, not to rect edges

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

Bug Description

While working on bug #1171109 I noticed the following:

1. Create a rect with a 2 px wide border, initially solid Fill and Stroke.
2. Change the FILL to a linear gradient using the Fill and Stroke pane.
3. Save the SVG and inspect it.

The linear gradient starts 1 pixel to the left of the rectangle, and ends 1 pixel to the right. Repeated with different stroke widths = S and the result was always that the gradient starts S/2 to the left and ends S/2 to the right (for a horizontal gradient).

Apparently the bounding box including the stroke around the edges is being used to determine the extents of the gradient.

It is possible to get the gradient initially to match the rect nearly exactly by drawing with a thin Stroke. However, if the stroke is later resized, and the rectangle readjusted, the bounds jump out again to -S/2 and +S/2 (left and right).

Presumably the correct thing to do is to use the bounding box as if the Stroke width was 0, since the Fill should be independent from the stroke. For a gradient on the stroke, the current situation would be correct. The only complication I can see in changing this would be if for some reason one wanted to have exactly the same gradient on the fill and the stroke, in which case one would have to manually fiddle with the settings to make them match.

Tags: gradient
Revision history for this message
David Mathog (mathog) wrote :

This is taking place in sp_gradient_reset_to_userspace in gradient_chemistry.cpp. A bbox is created from the item but there are no tests for whether it is a fill or a stroke.

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

Should probably be optional, or else based on the user's current setting for bounding box to use (visual or geometric; default is visual (which includes the stroke width)).

Changed in inkscape:
importance: Undecided → Wishlist
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.