Logo Search packages:      
Sourcecode: inkscape version File versions

static void sp_offset_class_init ( SPOffsetClass klass  )  [static]

SPOffset is a derivative of SPShape, much like the SPSpiral or SPRect. The goal is to have a source shape (= originalPath), an offset (= radius) and compute the offset of the source by the radius. To get it to work, one needs to know what the source is and what the radius is, and how it's stored in the xml representation. The object itself is a "path" element, to get lots of shape functionality for free. The source is the easy part: it's stored in a "inkscape:original" attribute in the path. In case of "linked" offset, as they've been dubbed, there is an additional "inkscape:href" that contains the id of an element of the svg. When built, the object will attach a listener vector to that object and rebuild the "inkscape:original" whenever the href'd object changes. This is of course grossly inefficient, and also does not react to changes to the href'd during context stuff (like changing the shape of a star by dragging control points) unless the path of that object is changed during the context (seems to be the case for SPEllipse). The computation of the offset is done in sp_offset_set_shape(), a function that is called whenever a change occurs to the offset (change of source or change of radius). just like the sp-star and other, this path derivative can make control points, or more precisely one control point, that's enough to define the radius (look in object-edit).
SPOffset vtable initialization.

Definition at line 145 of file sp-offset.cpp.

References SPObjectClass::build, SPItemClass::description, SPObjectClass::release, SPObjectClass::set, SPItemClass::snappoints, sp_offset_build(), sp_offset_description(), sp_offset_finalize(), sp_offset_release(), sp_offset_set(), sp_offset_set_shape(), sp_offset_snappoints(), sp_offset_update(), sp_offset_write(), SPObjectClass::update, and SPObjectClass::write.

Referenced by sp_offset_get_type().

    GObjectClass  *gobject_class = (GObjectClass *) klass;
    SPObjectClass *sp_object_class = (SPObjectClass *) klass;
    SPItemClass   *item_class = (SPItemClass *) klass;
    SPShapeClass  *shape_class = (SPShapeClass *) klass;

    parent_class = (SPShapeClass *) g_type_class_ref (SP_TYPE_SHAPE);

    gobject_class->finalize = sp_offset_finalize;

    sp_object_class->build = sp_offset_build;
    sp_object_class->write = sp_offset_write;
    sp_object_class->set = sp_offset_set;
    sp_object_class->update = sp_offset_update;
    sp_object_class->release = sp_offset_release;

    item_class->description = sp_offset_description;
    item_class->snappoints = sp_offset_snappoints;

    shape_class->set_shape = sp_offset_set_shape;

Generated by  Doxygen 1.6.0   Back to index