Fill Filter Primitives

These primitives provide some type of Fill for the filter region.

Flood

The Flood primitive fills the Filter Effects Region with a specified color and opacity. This filter primitive is most useful when combined with other filters primitives.

Flood Filter.
An example of using the Flood filter. From left to right: 1. A simple circle. 2. After adding the Flood filter with a light blue color. Note that the default Filter Effects Region is larger than the bounding box of the circle. 3. After the addition of a Composite filter primitive using the In operator. The first input is the output of the Flood filter and the second is the Source Graphic. 4. The Fill of the circle has been changed to the Cloth pattern (with the Fill and Stroke dialog) and the Composite type has been changed to Arithmetic with K1 = 0.5, K2 = 0.0, K3 = 0.5, and K4 = 0.0.

Image

Partially Implemented.

The Image primitive renders an external graphics file or an internal SVG object. It allows more than one object to be referenced in a complex filter (the first being the object attached to the filter).

Unfortunately, this very useful filter primitive is not yet fully implemented in Inkscape with only external images supported. The GUI will create a reference with an absolute path to the external image. Use the XML Editor to change an absolute path to a relative one if required.

By default, the image is shrunk or stretched to fit inside the bounding box of the object to which the filter is attached.

Images.
An image applied to two objects with the Image filter primitive. The rectangles show the bounding box of the objects.

The placement of the image within the bounding box can be controlled using the parameters x, y, width, and height. The coordinate system is the same as used for the object. The XML Editor must be used to modify these parameters. An additional parameter, preserveAspectRatio, is not supported by Inkscape.

[Note]Note

Firefox, Opera, and Batik render the image differently than Inkscape. They use the default Filter Effects Region to determine the image placement (even if set to a different value). They also, by default, preserve the aspect ratio of the image.

Images.
An image applied to two objects with the Image filter primitive specifying different image regions. On the left, x is 60 px and width 60 px. On the right, x is −60 px and width 180 px.

Tile

Not implemented.

The Tile primitive fills a rectangular region with a repeated input image.

No options.

Turbulence

The Turbulence primitive allows the creation of artificial textures such as marble surfaces or clouds. It is based on the work of Ken Perlin who won an Academy Award for creating realistic textures with computers. Perlin solved the problem of using random numbers to produce smooth random fluctuations in color. A simplified version of his method is to generate random intensities at given intervals and then connect these points smoothly together.

Note that Firefox, Opera, and Batik will render this filter differently than Inkscape if the attribute color-interpolation-filters="sRGB" is not added to the filter definition.

The following figure gives an idea of how the filter would be implemented in one dimension:

Turbulence: 1D.
A one-dimensional illustration of the Perlin method of generating noise. Fractal Noise is shown on the left and Turbulence on the right. The Base Frequency is set to 0.05 giving a wave length of 20 pixels (indicated by the vertical dotted lines). The contributions from three Octaves are shown individually and then summed.

The RGB and Alpha components are each derived separately.

Turbulence: Components.
The components of a Fractal NoiseTurbulence filter. From left to right: Red, Green, Blue, Alpha, Combined. There is a black rectangle behind the right half of the latter. The Color Matrix primitive was used to extract the individual components.

The Type can either be Fractal Noise or Turbulence. Turbulence tends to have more dramatic dark regions as the absolute values of the noise terms are used, creating visual cusps.[14]

Turbulence: Types.
The two types of noise available: Left: Fractal Noise. Right: Turbulence. Top: Only red channel. Bottom: All channels. There are black rectangles behind the right halves.

The Base Frequency is defined by default in terms of inverse Screen pixels. For example, a frequency of 0.1 would have a wave length of 10 pixels. Inkscape cannot yet create resolution independent noise. Reasonable values for this attribute range from 0.01 (a slowly varying texture) to 0.2 (a rapidly varying texture).

Turbulence: Base Frequency.
Fractal Noise as a function of Base Frequency. From left to right: 0.05, 0.10, 0.20, Top: Only red channel. Bottom: All channels, a black rectangle has been placed behind the right halves.

The number of Octaves determines the complexity of the noise, the more Octaves, the more complex. Each Octave adds a term with twice the Frequency but half the amplitude. Using more than four or five Octaves isn't so useful as the spatial and color variations become too small to be seen (and increases the CPU load).

Turbulence: Octaves.
Fractal Noise as a function of Octaves. All with Base Frequency of 0.05. From left to right: 1 octave, 2 octaves, 3 octaves. Top: Only red channel. Bottom: All channels, a black rectangle has been placed behind the right halves.

The Turbulence primitive uses a pseudo-random number generator. In principle, renderings with different SVG viewers should use the same generator and produce the same textures (at the same scale). If you use the filter twice on two identical objects, the textures should be the same. Changing the seed will force the random-number sequence to be different and thus the textures will be different too.



[14] See http://www.noisemachine.com/talk1/22.html.