Difference between revisions of "Creating Live Path Effects"

From Inkscape Wiki
Jump to navigation Jump to search
Line 7: Line 7:


Add your effect to the "const Util::EnumData<EffectType> LPETypeData[INVALID_LPE]" array in /live_effects/effect.cpp. This way, Inkscape knows how to tell the user what the name of the effect is and also how to write its name to SVG.
Add your effect to the "const Util::EnumData<EffectType> LPETypeData[INVALID_LPE]" array in /live_effects/effect.cpp. This way, Inkscape knows how to tell the user what the name of the effect is and also how to write its name to SVG.
One more thing to do: add your files to /live_effects/Makefile_insert. (Be aware of the spaces and tabs in that file!)


That's all! Now your effect should pop up in the LivePathEffect dialog in Inkscape! But your effect won't do anything now, it would just pass along the original path. Time to start writing the main machinery of your cool effect!
That's all! Now your effect should pop up in the LivePathEffect dialog in Inkscape! But your effect won't do anything now, it would just pass along the original path. Time to start writing the main machinery of your cool effect!

Revision as of 23:07, 17 August 2007

Instructions for making Live Path Effects.

Groundwork:

It is best to put your new effect in the /live_effects directory. Copy lpe-skeleton.cpp and lpe-skeleton.h to your files, and rename everything from skeleton to your name.

Add your effect to the enumeration in effect.h: "enum EffectType". This way, Inkscape knows how to refer to your effect.

Add your effect to the "const Util::EnumData<EffectType> LPETypeData[INVALID_LPE]" array in /live_effects/effect.cpp. This way, Inkscape knows how to tell the user what the name of the effect is and also how to write its name to SVG.

One more thing to do: add your files to /live_effects/Makefile_insert. (Be aware of the spaces and tabs in that file!)

That's all! Now your effect should pop up in the LivePathEffect dialog in Inkscape! But your effect won't do anything now, it would just pass along the original path. Time to start writing the main machinery of your cool effect!

Write your effect:

Have a look at the doEffect functions of lpe-slant.cpp and lpe-skeleton.cpp to see what is possible and how to implement something!

Parameter types:

  • RealParam: a number of type 'gdouble'. (see lpe-slant.cpp to learn how to use this type)
  • PointParam: a parameter that describes a coordinate on the page (see lpe-skeletal.cpp to learn how to use this type)
  • PathParam: a parameter that is a path. (see lpe-skeletal.cpp to learn how to use this type)
  • EnumParam: a parameter that lets the user choose between a number of options from a dropdown box. (see lpe-skeletal.cpp to learn how to use this type)