Ok, the latest trunk (0.48+devel+12780+44~ubuntu13.04.1) renders objectBoundingBox gradients correctly.

However, as su_v pointed out, Inkscape doesn't really support these when editing. As soon as I edit the gradient on-canvas, or move the object associated with the gradient, the gradient immediately reverts to userSpaceOnUse. This is pretty annoying, because it takes a little while to set up the coordinates by hand, only to have Inkscape destroy them on the slightest interaction.

I guess this is a "feature not a bug", in that I'm using Inkscape in a slightly unusual way. However, I'd be keen to (have someone) add a feature to allow this usage. Could anyone give me some pointers on where to start looking in the code, how big a job this might be, and perhaps if there is someone else out there who might be keen to implement the feature?

 - Bryan



On Thu, Oct 31, 2013 at 11:12 PM, su_v <suv-sf@...58...> wrote:
On 2013-10-31 04:20 +0200, Bryan Hoyt | Brush Technology wrote:
> If I create a gradient in Inkscape, the default coordinate space is
> userSpaceOnUse, as opposed to objectBoundingBox
> (see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/gradientUnits).
>
> This is ok, but if I edit a gradient manually (via a text editor or the
> XML editor) to change it to objectBoundingBox coordinates, I would like
> it to stay that way.
>
> objectBoundingBox gradients are very useful if you want to animate or
> otherwise interact with the SVG using javascript in a browser -- the
> gradient will move relative to the object, and you don't have to write
> extra complicated code to try and keep it lined up.
>
> Currently,
> *a)* Inkscape initially renders the gradient nodes in the correct
> position, but does not render the gradient colours themselves. So the
> object has a flat colour.

Please attach a sample SVG file - based on your other email I guess this
refers to Inkscape trunk, too: which revision of trunk are you currently
using?

Note: there had been regressions wrt to rendering gradients which use
'objectBoundingBox' in trunk (rev >= 12528), but AFAIK those have been
fixed again (rev >= 12646).

> *b) *As soon as I drag one of the endpoints, it reverts to
> userSpaceOnUse coordinates.

Inkscape only supports 'userSpaceOnUse' when writing gradient definitions.

> Which means that it becomes quite difficult to edit my SVG file in
> Inkscape ever after! Ideally, the object would be coloured correctly,
> and if I move a node or endpoint, it would remain in objectBoundingBox
> coordinates.
>
> Better yet, there would be a way to switch to objectBoundingBox
> coordinates from within the GUI, to avoid having to calculate the
> conversion maths in the XML editor.




--
Bryan Hoyt, Software Developer  --  Brush Technology
Ph: +64 3 741 1204     Mobile: +64 21 238 7955
Web: brush.co.nz