Recent

Author Topic: TBGRASVG: is it just me or does TBGRASVG not handle <defs>/<use>  (Read 1151 times)

mike_p

  • New Member
  • *
  • Posts: 28
I've created a nice little path editing program for SVGs using Lazarus.
To help preview my edited SVGs I use TBGRASVG to convert the svg text to an image.

However, if I try to use <defs>...</defs> followed by <use...> the preview doesn't show anything. The same SVG renders correctly in a browser.

Am I mis-using or has that never been implemented?

circular

  • Hero Member
  • *****
  • Posts: 4350
    • Personal webpage
Re: TBGRASVG: is it just me or does TBGRASVG not handle <defs>/<use>
« Reply #1 on: August 13, 2024, 08:34:28 am »
Hello mike,

Indeed, <use> is not implemented yet. I thought we had an issue on GitHub for that, but I can't find it anymore.

Last time I considered this <use> tag, I didn't see how to implement it. Now thinking about it, maybe a solution would be to have a stack of parent redirection on an SVG node and when using the node, to add the <use> node as parent redirection while calling the draw method on the used node.
Conscience is the debugger of the mind

mike_p

  • New Member
  • *
  • Posts: 28
Re: TBGRASVG: is it just me or does TBGRASVG not handle <defs>/<use>
« Reply #2 on: August 13, 2024, 12:45:07 pm »
Thanks for the reply.
Maybe sime time I'll have a peak and see If I could help implement it.

I'm also wondering whether my SVG editor could be of use within Lazpaint?

Here's a screen shot of it's path editor.

hedgehog

  • New Member
  • *
  • Posts: 48
Re: TBGRASVG: is it just me or does TBGRASVG not handle <defs>/<use>
« Reply #3 on: August 13, 2024, 03:10:25 pm »
This is awesome!
Can you share the source code?

circular

  • Hero Member
  • *****
  • Posts: 4350
    • Personal webpage
Re: TBGRASVG: is it just me or does TBGRASVG not handle <defs>/<use>
« Reply #4 on: August 17, 2024, 10:22:17 pm »
Now thinking about it, maybe a solution would be to have a stack of parent redirection on an SVG node and when using the node, to add the <use> node as parent redirection while calling the draw method on the used node.
Or maybe just have a simple variable for parent redirection.

Thanks for the reply.
Maybe some time I'll have a peak and see If I could help implement it.
Sure, any input is welcome.

Quote
Here's a screen shot of it's path editor.
Looks good.  :)

Quote
I'm also wondering whether my SVG editor could be of use within Lazpaint?
LazPaint has SVG layers, so in theory it would be possible to implement selection of shapes, and for paths, the modification of paths. There would the matrix transformation to consider, because within SVG it is possible transform a part and the SVG layer itself can be transformed.

There is already kind of framework to provide an editor for a layer (TBGRALayerOriginal), that is used by the (non SVG) vector layers (TVectorOriginal in LazPaintControls package).

There would be some plumbing to do to detect clicks, whether they land on an SVG shape.
Conscience is the debugger of the mind

mike_p

  • New Member
  • *
  • Posts: 28
Re: TBGRASVG: is it just me or does TBGRASVG not handle <defs>/<use>
« Reply #5 on: August 18, 2024, 04:08:07 pm »
This is awesome!
Can you share the source code?
Yes, I''l look at putting it into gihthub. Currently I have it in my own svn repository.
Its very much work in progress. eg it does the things that I need it to, but needs input from other people to help me mak it into a really good app.
eg in the path editor, it gets confused when faced with arcs.

 

TinyPortal © 2005-2018