Greetings from Santiago,
After looking for this information all around the web, I decided to ask experts.
This is my first post in this forum.
Does Inkscape API provide access to actual coordinate points of
gradient handles? Does exists a plugin that could draw these handles
in a different layer?
Take a look at attached png image. A Radial gradient handle has a L shape
and a Linear gradient handle is a single line.
I am using this information for importing SVG files with gradients into
my android application.
Thanks in advance
Al
Plug in for drawing gradient handles
Re: Plug in for drawing gradient handles
Does Inkscape API provide access to actual coordinate points of
gradient handles?
- No, it doesn't, as far as I know.
Does exists a plugin that could draw these handles
in a different layer?
- You mean, for visualization? I don't know of any, but that's probably not too difficult to do. We already have 'visualize path' with 'draw handles' and 'number nodes', these should be similar.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: Plug in for drawing gradient handles
Many thanks for your answer, Moini. I found information about the Inkscape extensions that you mentioned in this webpage: http://tavmjong.free.fr/INKSCAPE/MANUAL.html
Re: Plug in for drawing gradient handles
You can make a feature request (sounds like it might be useful to some) here: https://bugs.launchpad.net/inkscape, but if you need fast results, and know some python, read the SVG source or use the XML editor to determine how gradient handle positions are set, and then write a function that draws those. You can make use of some prepared functions in the helper files.
If you keep your drawings simple (no transformed groups, for example, using one Inkscape version consistently for your files), then this shouldn't be too difficult to do.
If you keep your drawings simple (no transformed groups, for example, using one Inkscape version consistently for your files), then this shouldn't be too difficult to do.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: Plug in for drawing gradient handles
Some people on IRC may also be able to guide you a bit.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: Plug in for drawing gradient handles
Great! Thanks a lot for your guidance
Re: Plug in for drawing gradient handles
Probably there was one point of info missing, judging from your post to the mailing list (btw. the Inkscape source code lives at https://gitlab.com/inkscape/inkscape/). You can access the SVG's source code from inside the extensions. In the source code, the handles' coordinates are set as attributes for the gradient in the defs section. You need to do the parsing yourself.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: Plug in for drawing gradient handles
Do you mean that internally, Inkscape only stores gradient handles like this?
We could calculate the actual position of the L shaped handle for this Radial Gradient
multiplying the gradient center (95.666649,987.04877) the gradient vector (190.666649,987.04877)
and the gradient normal (95.666649,892.04877) by the gradient transform matrix:
(0.62319928,0.62388171,-1.0181927,1.0170788,1017.3415,-88.883758)
Then, we multiply the result with next transformation, and so on until
gradient coordinates falls in it's correct position.
But please notice, Inkscape already calculate and shows this information within it's GUI.
Hopefully, Inkscape Developers have made accessible this information using
Inkscape Python API.
Alejandro
Code: Select all
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4296"
id="radialGradient4312"
cx="95.666649"
cy="987.04877"
r="95"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.62319928,0.62388171,-1.0181927,1.0170788,1017.3415,-88.883758)"
We could calculate the actual position of the L shaped handle for this Radial Gradient
multiplying the gradient center (95.666649,987.04877) the gradient vector (190.666649,987.04877)
and the gradient normal (95.666649,892.04877) by the gradient transform matrix:
(0.62319928,0.62388171,-1.0181927,1.0170788,1017.3415,-88.883758)
Then, we multiply the result with next transformation, and so on until
gradient coordinates falls in it's correct position.
But please notice, Inkscape already calculate and shows this information within it's GUI.
Hopefully, Inkscape Developers have made accessible this information using
Inkscape Python API.
Alejandro
Re: Plug in for drawing gradient handles
They haven't.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: Plug in for drawing gradient handles
Then, I will raise a bug report asking for this feature.
Meanwhile, probably will create an application, just
for this purpose.
Many Thanks again, Moini, for your help!
Alejandro
Meanwhile, probably will create an application, just
for this purpose.
Many Thanks again, Moini, for your help!
Alejandro
Re: Plug in for drawing gradient handles
When you have written such an extension, would you perhaps share it on the Inkscape website? It would be put here: https://inkscape.org/en/download/addons/ when you upload it within the 'Extensions' category.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)