Inkscape.org
Creating New Extensions Extenssions format
  1. #1
    Kristian Benoit Kristian Benoit @kristian.benoit

    Hi, I've been working on an extension for a liittle while. I now realize it take a lot of time for inkscape to process the modification once the extension is done. The more I use the extension, without restarting, the longer it takes for inkscape to process the changes. I saw a reference about internal extensions and plugins in "C", but did not find more informations. I guest the interface could have a better integration ?

  2. #2
    Martin Owens Martin Owens @doctormo🌹🧀

    I'm not sure, you make need to find out what your extension is doing to the document or Inkscape to work out what's going wrong.

    I can't guess from here what it might be.

    You could make a C++ extension, but it would have to be compiled into Inkscape, must be GPLv3 and should be contributed to Inkscape in the normal way all other C++ code is contributed, via merge requests.

  3. #3
    Kristian Benoit Kristian Benoit @kristian.benoit

    Is there any documentation on creating a C++ extension ?

  4. #4
    Martin Owens Martin Owens @doctormo🌹🧀

    I've never seen any documentation. Only the code examples available here:

    https://gitlab.com/inkscape/inkscape/-/tree/master/src%2Fextension%2Finternal

    Which people liberally evolve into their own code.

  5. #5
    Patrick Storz Patrick Storz @Ede_123

    You actually have to differentiate between

    • internal extensions (which are implemented in C/C++ an compiled into Inkscape; it's what most input/output extensions for the various import/export formats Inkscape offers uses)
    • "plugin" type extensions (which are implemented in C/C++ but are compiled into a separate library and come with an external .inx as well, so they can be distributed separately from Inkscape)

    An example of the second type can be found at https://gitlab.com/inkscape/inkscape/tree/master/src/extension/plugins

  6. #6
    Patrick Storz Patrick Storz @Ede_123
    *

    In any case, you mentioned that you want to use C/C++ to improve performance, however what you wrote ("The more I use the extension, without restarting, the longer it takes for inkscape to process the changes.") seems to suggest that either

    • your extension adds new XML nodes to the SVG file whenever it runs but never deletes them (even if they might be unused), so the file grows and grows; or
    • there's a bug in Inkscape, that makes it grow slower over time (if that would be the case, it's worth a bug report with a stripped down example extension, so we can figure out what is going on).
  7. #7
    Kristian Benoit Kristian Benoit @kristian.benoit
    *
    • Thanks, If I get you right, an external extension in C/C++ is just like a python extension just in another language ... without inkex. The internal extensions has to be part of inkscape. So I'm better at proving interest with an external extension first.
    • The slowness get away after restarting inkscape so it has to be a bug in inkscape. But as it's from, the close to be outdated, ubuntu 18.04 LTS version, it might be fixed in newer versions and as you probably know I am now porting it/developing it on v1.0.