Marblecore Imaging Library Documentation

Documentation Introduction
Documentation / Marblecore Imaging / Methods / FilterLens

FilterLens method

Applies a lens distortion effect to the image.

Syntax

Boolean FilterLens(nRefraction As Number, bAntiAliasing As Boolean, bBackgroundClear As Boolean, nBackgroundColor As Number, nBackgroundOpacity As Number, nLeft As Number, nTop As Number, nWidth As Number, nHeight As Number)

Return value

Returns true if the function succeeded.

Parameters

ParameterTypeRequiredDescription
nRefractionNumberNoSpecifies the refraction of the distortion ranging from 0%...100%.
bAntiAliasingBooleanNoOptional parameter which enables or disables anti-aliasing.
bBackgroundClearBooleanNoOptional parameter which specifies if the background should be cleared or the original image should remain in the background. If this value is true the background is cleared using the current background color and opacity.
nBackgroundColorNumberNoOptional parameter containing the background color. If no color is specified the current background color will be used.
nBackgroundOpacityNumberNoOptional parameter containing the background opacity (only available for 32 bits images).
nLeftNumberNoOptional parameter which can be used to specify a clipping rectangle. This parameter specifies the left coordinate of the rectangle.
nTopNumberNoOptional parameter which can be used to specify a clipping rectangle. This parameter specifies the top coordinate of the rectangle.
nWidthNumberNoOptional parameter which can be used to specify a clipping rectangle. This parameter specifies the width of the rectangle.
nHeightNumberNoOptional parameter which can be used to specify a clipping rectangle. This parameter specifies the height of the rectangle.

Example

The example below shows the effect of this method and how to use it. You can slide the marker in the before/after picture to see the difference. If you take a look at the example code, assume there is a reference to the Marblecore Imaging object with the name 'MarblecoreImaging'. Transparent parts of the image are displayed using a checkerboard pattern.
 
before
after
 
1 // Load the specified image in memory
2 MarblecoreImaging.LoadFromFile("example-filterlens-before.jpg");
3 
4 // Execute the operation
5 MarblecoreImaging.FilterLens();
6 
7 // Save the modified image to the specified file
8 MarblecoreImaging.SaveToFile("example-filterlens-after.jpg");

Category

Filters, Distortion

See also

FilterCylinder | FilterFractalTrace | FilterIllusion | FilterPinch | FilterPixelate | FilterRipple | FilterShift | FilterStripe | FilterWave | FilterWhirl | FilterWhirlPinch