0N/APublic interface for NR::Filter and NR::FilterPrimitive
3876N/A
0N/AConstructors
0N/A============
0N/A
0N/AFilter::Filter()
2362N/ACreates a new filter with space for one filter element
0N/A
2362N/AFilter::Filter(int n)
0N/ACreates a new filter with space for n filter elements. If number of filter
0N/Aelements is known beforehand, it's better to use this constructor.
0N/A
0N/A
0N/AManaging filter primitives
0N/A==========================
0N/A
0N/AFilterPrimitive * Filter::add_primitive(FilterPrimitiveType type)
0N/ACreates a new filter primitive under this filter object.
0N/ANew primitive is placed so that it will be executed after all filter
0N/Aprimitives defined beforehand for this filter object.
2362N/AShould this filter not have enough space for a new primitive, the filter
2362N/Ais enlarged to accomodate the new filter element. It may be enlarged by more
2362N/Athat one element.
0N/AReturns a pointer to the filter primitive created.
0N/AReturns NULL, if type is not valid filter primitive type or filter primitive
0N/Aof such type cannot be created.
0N/A
0N/Avoid Filter::clear_primitives()
0N/ARemoves all filter primitives from this filter.
0N/AAll pointers to filter primitives inside this filter should be considered
0N/Ainvalid after calling this function.
0N/A
0N/AFilterPrimitive * Filter::replace_primitive(FilterPrimitive *target,
0N/A FilterPrimitiveType type)
0N/AReplaces filter primitive pointed by 'target' with a new filter primitive of
0N/Atype 'type'
0N/AIf 'target' does not correspond to any primitive inside this filter OR
0N/A'type' is not a valid filter primitive type OR
0N/Afilter primitive of such type cannot be created,
0N/Athis function returns NULL and doesn't change the internal state of this
0N/Afilter.
0N/AOtherwise, a new filter primitive is created. Any pointers to filter primitive
0N/A'target' should be considered invalid. A pointer to the newly created
0N/Aprimitive is returned.
0N/A
0N/A
0N/AFilter primitive types
0N/A======================
0N/A
0N/Aenum FilterPrimitiveType is declared in display/nr-filter-types.h
1696N/A
0N/AEnumeration value Corresponding filter primitive
0N/ANR_FILTER_BLEND feBlend
0N/ANR_FILTER_COLORMATRIX feColorMatrix
0N/ANR_FILTER_COMPONENTTRANSFER feComponentTransfer
0N/ANR_FILTER_COMPOSITE feComposite
0N/ANR_FILTER_CONVOLVEMATRIX feConvolveMatrix
0N/ANR_FILTER_DIFFUSELIGHTING feDiffuseLighting
0N/ANR_FILTER_DISPLACEMENTMAP feDisplacementMap
0N/ANR_FILTER_FLOOD feFlood
0N/ANR_FILTER_GAUSSIANBLUR feGaussianBlur
0N/ANR_FILTER_IMAGE feImage
0N/ANR_FILTER_MERGE feMerge
0N/ANR_FILTER_MORPHOLOGY feMorphology
0N/ANR_FILTER_OFFSET feOffset
0N/ANR_FILTER_SPECULARLIGHTING feSpecularLighting
0N/ANR_FILTER_TILE feTile
0N/ANR_FILTER_TURBULENCE feTurbulence
0N/A
0N/A
0N/ASetting inputs and outputs for filter primitives
0N/A================================================
0N/A
0N/AEach filter primitive can take one or more images as inputs and produces
0N/Aa single image as output. In NR::Filter these are managed as image slots.
0N/AEvery slot can hold one image.
0N/A
0N/AThere are two types of slots: pre-defined and user defined. Pre-defined
0N/Aslots may only be used as inputs, while user defined slots may be used as
0N/Aboth inputs and outputs. User defined slots are numbered from 0 upwards,
0N/Apre-defined slots are numbered with the following constants:
0N/A
0N/AConstant name Corresponding SVG input name
0N/ANR_FILTER_SOURCEGRAPHIC SourceGraphic
0N/ANR_FILTER_SOURCEALPHA SourceAlpha
0N/ANR_FILTER_BACKGROUNDIMAGE BackgroundImage
0N/ANR_FILTER_BACKGROUNDALPHA BackgroundAlpha
0N/ANR_FILTER_FILLPAINT FillPaint
0N/ANR_FILTER_SOURCEPAINT SourcePaint
0N/A(defined in display/nr-filter-types.h)
0N/A
0N/AAny user defined slot used as input must be the output of some previous
0N/Afilter primitive. Other than that, user defined input slots do not need to be
0N/Aused in any particular order.
0N/A
0N/Avoid FilterPrimitive::set_input(int slot)
0N/ASets the input slot number 'slot' to be used as input in rendering filter
0N/Aprimitive 'primitive'
0N/AFor filter primitive types accepting more than one input, this sets the
0N/Afirst input.
0N/AIf any of the required input slots is not set, the output of previous filter
0N/Aprimitive is used, or SourceGraphic if this is the first primitive for this
0N/Afilter.
0N/A
0N/Avoid FilterPrimitive::set_input(int input, int slot)
0N/ASets the input slot number 'slot' to be user as input number 'input' in
0N/Arendering filter primitive 'primitive'
0N/AFirst input for a filter primitive is number 0. For primitives with attributes
0N/A'in' and 'in2', these are numbered 0 and 1, respectively.
0N/AIf any of required input slots for a filter is not set, the output of
0N/Aprevious filter primitive is used, or SourceGraphic if this is the first
0N/Afilter primitive for this filter.
0N/A
0N/Avoid FilterPrimitive::set_output(int slot)
0N/ASets the slot number 'slot' to be used as output from filter primitive
0N/A'primitive'
0N/AIf output slot for a filter element is not set, one of the unused image
0N/Aslots is used.
0N/AIt is an error to specify a pre-defined slot as 'slot'. Such call does
0N/Anot have any effect to the state of filter or its primitives.
0N/A
0N/Avoid Filter::set_output(int slot)
0N/ASets the slot number 'slot' to be used as result from this filter.
0N/AIf output is not set, the output from last filter primitive is used as
0N/Aoutput from the filter.
0N/AIt is an error to specify a pre-defined slot as 'slot'. Such call does
0N/Anot have any effect to the state of filter or its primitives.
0N/A
0N/A
0N/AFunctions for reading filter state
0N/A==================================
0N/A
0N/Aint Filter::get_enlarge(Matrix const &m)
0N/AReturns the amount of pixels the rendering area should be enlarged
0N/Ato prevent visual artefacts when filter needs to read pixels that
0N/Aare outside its output area (e.g. gaussian blur)
0N/A
0N/Avoid Fiter::bbox_enlarge(NRRectL &bbox)
0N/AGiven an object bounding box, this function enlarges it so that it
0N/Acontains the filter effect area
0N/A
0N/A
0N/AFilter effects region and filter primitive subregion
0N/A====================================================
0N/A
0N/Avoid Filter::set_x(SVGLength &lenght)
0N/Avoid FilterPrimitive::set_x(SVGLength &length)
0N/A
0N/Avoid Filter::set_y(SVGLength &length)
0N/Avoid FilterPrimitive::set_y(SVGLength &length)
0N/A
0N/Avoid Filter::set_width(SVGLength &length)
0N/Avoid FilterPrimitive::set_width(SVGLength &length)
0N/A
0N/Avoid Filter::set_height(SVGLength &length)
0N/Avoid FilterPrimitive::set_width(SVGLength &length)
0N/A
0N/AThese functions set the parameters for filter effects region and filter
0N/Aprimitive subregion.
0N/APassing an unset length (length._set == false) results in no changes to
0N/Afilter state.
0N/AFilter will not hold any references to the passed SVGLength object after
0N/Afunction returns.
0N/AIf any of these parameters does not get set - either because function
0N/Afor setting that is not called, or it is called with an unset length -
0N/Athe default value, as defined in SVG standard, for that parameter is
0N/Aused instead.
0N/A
0N/Avoid Filter::set_region(SVGLength &x, SVGLength &y,
0N/A SVGLength &width, SVGLength &height)
0N/Avoid FilterPrimitive::set_region(SVGLength &x, SVGLength &y,
0N/A SVGLength &width, SVGLength &height)
0N/A
0N/AThis is shorthand for calling set_x(x), set_y(y), set_width(width) and
0N/Aset_height(height). The result is as if those four functions had been
0N/Acalled separately.
0N/A
0N/Avoid Filter::reset_region()
0N/Avoid FilterPrimitive::reset_region()
0N/A
0N/AResets the filter effects region or filter primitive subregion to its
0N/Adefault value as defined in SVG standard.
0N/A
0N/Avoid Filter::set_resolution(double x_pixels)
0N/A
0N/ASets the width of intermediate images in pixels. If not set, suitable
0N/Aresolution is determined automatically. If x_pixels is less than zero,
0N/Acalling this function results in no changes to filter state.
0N/A
0N/Avoid Filter::set_resolution(double x_pixels, double y_pixels)
0N/A
0N/ASets the width and height of intermediate images in pixels. If not set,
0N/Asuitable resolution is determined automatically. If either parameter is
0N/Aless than zero, calling this function results in no changes to filter
0N/Astate.
0N/A
0N/Avoid Filter::reset_resolution()
0N/A
0N/AResets the filter resolution to its default value, i.e. automatically
0N/Adetermined.
0N/A
0N/Avoid Filter::set_filter_units(SPFilterUnits unit)
0N/Avoid Filter::set_primitive_units(SPFilterUnits unit)
0N/A
0N/ASet the filterUnits and primitiveUnits -properteries, respectively. If
0N/Anot set, the default values are used: objectBoundingBox for filterUnits
0N/Aand userSpaceOnUse for primitiveUnits. If the parameter value is not a
0N/Avalid enumeration value from SPFilterUnits, no changes to filter state
0N/Aare made.
0N/A
0N/A
0N/AParameters specific to some filter primitive type
0N/A=================================================
0N/A
0N/AGaussian blur
0N/A-------------
0N/A
0N/Avoid FilterGaussian::set_deviation(double deviation)
0N/Avoid FilterGaussian::set_deviation(double x, double y)
0N/A
0N/ASet the standard deviation value for gaussian blur. One-parameter
0N/Aversion sets deviation along both axis to same value, two-parameter
0N/Aversion allows setting deviation along x- and y-axis separately.
0N/APassing either of these functions a negative value, NaN or infinity is
0N/Aconsidered an error and no changes to filter state are made. If not set,
0N/Adefault value of zero is used, which means the filter results in
0N/Atransparent black image.
0N/A(NB: as for now, the default value can be overriden with configuration
0N/Afile parameter options.filtertest)
0N/A