Skip to content

Write star and arc sodipodi path creators

Many extensions draw stars and arc using the sodipodi namespaces, this works ok when the paths are sent back to inkscape, but cause problems if you ask for the bounding box or want to use inkex outside of the inkscape context.

Marc has provided a javascript version of how to write the stars:

Star.prototype.draw_star=function(r_ext,n_pic,r_int,poly,angle_dec){
  angle_dec=angle_dec||0;
  s="M"+r_ext+" 0L";
  for( var i=0; i<n_pic; i++){
    s+=Math.cos(2*Math.PI*i/n_pic)*r_ext+","+Math.sin(2*Math.PI*i/n_pic)*r_ext
        +" ";
    if(!poly){
      s+=Math.cos(2*Math.PI*(i+0.5)/n_pic+angle_dec)*r_int+","
          +Math.sin(2*Math.PI*(i+0.5)/n_pic+angle_dec)*r_int+" ";
    }
  }
  s+="z";
  return s;
};

This code, and arc code needs to be added in the def path section if path is not defined yet (or if the sodipodi settings get set) This might involve separate classes like is currently done for Layer

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information