Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

int Inkscape::Filters::Filter::add_primitive ( FilterPrimitiveType  type )

Creates a new filter primitive under this filter object. New primitive is placed so that it will be executed after all filter primitives defined beforehand for this filter object. Should this filter not have enough space for a new primitive, the filter is enlarged to accomodate the new filter element. It may be enlarged by more that one element. Returns a handle (non-negative integer) to the filter primitive created. Returns -1, if type is not valid filter primitive type or filter primitive of such type cannot be created.

Definition at line 391 of file nr-filter.cpp.

References _enlarge_primitive_table().


    // Check that we can create a new filter of specified type
    if (type < 0 || type >= NR_FILTER_ENDPRIMITIVETYPE)
        return -1;
    if (!_constructor[type]) return -1;
    FilterPrimitive *created = _constructor[type]();

    // If there is no space for new filter primitive, enlarge the table
    if (_primitive_count >= _primitive_table_size) {

    _primitive[_primitive_count] = created;
    int handle = _primitive_count;
    return handle;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index