filter(parent, id, x, y, width, height, settings) |
filter element |
Add a filter definition.
Note that this method is directly on the SVG wrapper object,
not under the filters entry point. The remaining filter methods
below are connected to one of these filter definitions (as the parent).
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
id (string) is the ID for this filter.
x (number) is the x-coordinate for the left edge of the filter.
y (number) is the y-coordinate for the top edge of the filter.
width (number) is the width of the filter.
height (number) is the height of the filter.
settings (object, optional) is additional settings for the filter.
var filter = svg.filter(defs, 'MyFilter', 0, 0,
200, 120, {filterUnits: 'userSpaceOnUse'});
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
distantLight(parent, result, azimuth, elevation, settings) |
filter element |
Add a distant light filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
azimuth (number) is the angle (degrees) in the XY plane for the light source.
elevation (number) is the angle (degrees) in the YZ plane for the light source.
settings (object, optional) is additional settings for the filter.
svg.filters.distantLight(filter, 'lit', 45, 60);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
pointLight(parent, result, x, y, z, settings) |
filter element |
Add a point light filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
x (number) is the x-coordinate for the light source.
y (number) is the y-coordinate for the light source.
z (number) is the z-coordinate for the light source.
settings (object, optional) is additional settings for the filter.
svg.filters.pointLight(filter, '',
-5000, -10000, 20000);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
spotLight(parent, result, x, y, z, toX, toY, toZ, settings) |
filter element |
Add a spot light filter.
Specify all of toX , toY , toZ or none of them.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
x (number) is the x-coordinate for the light source.
y (number) is the y-coordinate for the light source.
z (number) is the z-coordinate for the light source.
toX (number, optional) is the x-coordinate for where the light is pointing.
toY (number, optional) is the y-coordinate for where the light is pointing.
toZ (number, optional) is the z-coordinate for where the light is pointing.
settings (object, optional) is additional settings for the filter.
svg.filters.spotLight(filter, 'lit', 10, 20, 30);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
blend(parent, result, mode, in1, in2, settings) |
filter element |
Add a blend filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
mode (string) is 'normal', 'multiply', 'screen', 'darken', or 'lighten'.
in1 (string) is the first image to blend.
in2 (string) is the second image to blend.
settings (object, optional) is additional settings for the filter.
svg.filters.blend(filter, 'blended', 'darken',
'SourceGraphic', 'BackgroundImage');
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
colorMatrix(parent, result, in1, type, values, settings) |
filter element |
Add a colour matrix filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
in1 (string) is the source to colour.
type (string) is 'matrix', 'saturate', 'hueRotate', or 'luminanceToAlpha'.
values (number[4][5]) for 'matrix' the matrix (5x4) values to apply or
(number) for 'saturate' 0.0 to 1.0 or (number) for 'hueRotate' degrees or
omitted for 'luminanceToAlpha'.
settings (object, optional) is additional settings for the filter.
svg.filters.colorMatrix(filter,
'', 'SourceGraphic', 'matrix',
[[0.33, 0.33, 0.33, 0, 0],
[0.33, 0.33, 0.33, 0, 0],
[0.33, 0.33, 0.33, 0, 0],
[0.33, 0.33, 0.33, 0, 0]]);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
componentTransfer(parent, result, functions, settings) |
filter element |
Add a component transfer filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
functions (object[3 or 4]) is one for each of RGB and A (alpha, optional)
for each entry: [0] (string) is 'identity', 'table', 'discrete', 'linear', or 'gamma',
[1] (number[]) is for 'table' or 'discrete' the list of interpolation or step values OR
(number) for 'linear' the slope, for 'gamma' the amplitude,
[2] (number) is for 'linear' the intercept, for 'gamma' the exponent,
[3] (number) is for 'gamma' the offset.
settings (object, optional) is additional settings for the filter.
svg.filters.componentTransfer(filter, '',
[['table', [0, 0, 1, 1]],
['table', [1, 1, 0, 0]],
['table', [0, 1, 1, 0]]]);
svg.filters.componentTransfer(filter, '',
[['gamma', 2, 5, 0], ['gamma', 2, 3, 0],
['gamma', 2, 1, 0]]);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
composite(parent, result, operator, in1, in2, k1, k2, k3, k4, settings) |
filter element |
Add a composite filter.
Specify all of k1 , k2 , k3 ,
k4 or none of them.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
operator (string) is 'over', 'in', 'out', 'atop', 'xor', or 'arithmetic'.
in1 (string) is the first filter to compose.
in2 (string) is the second filter to compose.
k1 (number, optional) is for 'arithmetic'.
k2 (number, optional) is for 'arithmetic'.
k3 (number, optional) is for 'arithmetic'.
k4 (number, optional) is for 'arithmetic'.
settings (object, optional) is additional settings for the filter.
svg.filters.composite(filter, 'specOut', 'in',
'specOut', 'SourceAlpha');
svg.filters.composite(filter, 'litPaint',
'arithmetic', 'SourceGraphic',
'specOut', 0, 1, 1, 0);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
convolveMatrix(parent, result, order, matrix, settings) |
filter element |
Add a convolve matrix filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
order (int or 'int int') is the size(s) of the matrix.
matrix (number[][]) is the kernel matrix for the convolution.
settings (object, optional) is additional settings for the filter.
svg.filters.convolveMatrix(filter, '', 3,
[[1, 1, 1], [1, 3, 1], [1, 1, 1]]);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
diffuseLighting(parent, result, settings) |
filter element |
Add a diffuse lighting filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
colour (string, optional) is the lighting colour.
settings (object, optional) is additional settings for the filter.
svg.filters.diffuseLighting(filter, '', 'red');
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
displacementMap(parent, result, in1, in2, settings) |
filter element |
Add a displacement map filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
in1 (string) is the source image.
in2 (string) is the displacement image.
settings (object, optional) is additional settings for the filter.
svg.filters.displacementMap(filter, '',
'SourceGraphic', 'displaceImg');
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
flood(parent, result, x, y, width, height, colour, opacity, settings) |
filter element |
Add a flood filter.
Specify all of x , y , width ,
height or none of them.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
x (number, optional) is the left coordinate of the rectangle.
y (number, optional) is the top coordinate of the rectangle.
width (number, optional) is the width of the rectangle.
height (number, optional) is the height of the rectangle.
colour (string) is the colour to fill with.
opacity (number) is the opacity 0.0-1.0.
settings (object, optional) is additional settings for the filter.
svg.filters.flood(filter, '', 'yellow', 0.5);
svg.filters.flood(filter, '', 10, 20, 100, 50,
'green', 0.1);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
gaussianBlur(parent, result, in1, stdDevX, stdDevY, settings) |
filter element |
Add a Gaussian blur filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
in1 (string) is the source filter.
stdDevX (number) is the standard deviation along the x-axis.
stdDevY (number, optional) is the standard deviation along the y-axis,
defaults to stdDevX .
settings (object, optional) is additional settings for the filter.
svg.filters.gaussianBlur(filter,
'blur', 'SourceAlpha', 4);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
image(parent, result, href, settings) |
filter element |
Add an image filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
href (string) is the URL of the image.
settings (object, optional) is additional settings for the filter.
svg.filters.image(filter, '',
'/images/texture.jpg');
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
merge(parent, result, refs, settings) |
filter element |
Add a merge filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
refs (string[]) is the IDs of the filters to merge.
settings (object, optional) is additional settings for the filter.
svg.filters.merge(filter, '',
['offsetBlur', 'litPaint']);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
morphology(parent, result, in1, operator, radiusX, radiusY, settings) |
filter element |
Add a morphology filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
in1 (string) is the source filter.
operator (string) is 'erode' or 'dilate'.
radiusX (number) is the size of the operation in the x-axis.
radiusY (number, optional) is the size of the operation in the y-axis,
defaults to radiusX .
settings (object, optional) is additional settings for the filter.
svg.filters.morphology(filter, '',
'SourceGraphic', 'dilate', 6);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
offset(parent, result, in1, dx, dy, settings) |
filter element |
Add an offset filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
in1 (string) is the source filter.
dX (number) is the offset in the x-axis.
dY (number) is the offset in the y-axis.
settings (object, optional) is additional settings for the filter.
svg.filters.offset(filter, 'offsetBlur',
'blur', 4, 4);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
specularLighting(parent, result, in1, surfaceScale, specularConstant, specularExponent, settings) |
filter element |
Add a specular lighting filter.
Numeric params are only optional if following numeric params are also omitted.
Add one of distantLight ,
pointLight , or
spotLight
as a child to specify the light source.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
in1 (string) is the source filter.
surfaceScale (number, optional) is the surface height when Ain = 1.
specularConstant (number, optional) is the ks in Phong lighting model.
specularExponent (number, optional) is the shininess 1.0-128.0.
settings (object, optional) is additional settings for the filter.
svg.filters.specularLighting(filter, 'specOut',
'blur', 5, 0.75, 20,
{lightingColor: '#bbbbbb'});
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
tile(parent, result, in1, x, y, width, height, settings) |
filter element |
Add a tile filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
in1 (string) is the source filter.
x (number) is the left coordinate of the rectangle.
y (number) is the top coordinate of the rectangle.
width (number) is the width of the rectangle.
height (number) is the height of the rectangle.
settings (object, optional) is additional settings for the filter.
svg.filters.tile(filter, 'tiled',
'img', 50, 60, 100, 200);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |
turbulence(parent, result, type, baseFreq, octaves, settings) |
filter element |
Add a turbulence filter.
parent (element or jQuery, optional) is the parent node
for the new filter or null or omitted for the SVG root.
result (string) is the ID of this filter.
type (string) is 'fractalNoise' or 'turbulence'.
baseFreq (number or 'number number') is the base frequency,
optionally separated into x- and y-components.
octaves (number, optional) is the amount of turbulence.
settings (object, optional) is additional settings for the filter.
svg.filters.turbulence(filter, '',
'turbulence', 0.05, 2);
Since 1.2.1 - parent may be omitted if null .
Since 1.4.3 - parent may be a jQuery object. |