Difference between revisions of "Creating Live Path Effects"

From Inkscape Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
Instructions for making Live Path Effects.
 
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 <i>skeleton</i> 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.
 +
 +
=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!
 
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:
+
=Parameter types:=
 
* RealParam: a number of type 'gdouble'. (see lpe-slant.cpp to learn how to use this type)
 
* 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)
 
* 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)
 
* 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)
 
* 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)

Revision as of 23:01, 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.

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)