Applies the displacement map filter effect.
This filter effect uses the pixel values from the image from Mix to spatially displace the image from Input. This is the transformation to be performed:
P'(x,y) <- P(x + Scale * (XC(x,y) - 0.5), y + Scale * (YC(x,y) - 0.5))
where P(x,y) is the Input image, and P'(x,y) is the Target. XC(x,y) and YC(x,y) are the component values of the channel designated by the XChannel and YChannel. For example, to use the red component of Mix to control displacement in X and the green component to control displacement in Y, set XChannel to CMP::RED and YChannel to CMP::GREEN.
The displacement map defines the inverse of the mapping performed.
The Input image is to remain premultiplied for this filter effect. The calculations using the pixel values from Mix are performed using non-premultiplied colour values. If the image from Mix consists of premultiplied colour values, those values are automatically converted into non-premultiplied colour values before performing this operation.
The DisplacementFX class consists of the following fields:
Access | Name | Type | Comment | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ResampleMethod | VSM | The resample algorithm to use for transforming the source image. | |||||||||||||||||||||||||||||
Currently
| |||||||||||||||||||||||||||||||
| Scale | DOUBLE | Displacement scale factor. | |||||||||||||||||||||||||||||
The amount is expressed in the coordinate system established by VectorFilter⇒PrimitiveUnits on the parent VectorFilter. When the value of this field is 0, this operation has no effect on the source image. | |||||||||||||||||||||||||||||||
| XChannel | CMP | X axis channel selection. | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| XMLDef | STRING | Returns an SVG compliant XML string that describes the effect. | |||||||||||||||||||||||||||||
| YChannel | CMP | Y axis channel selection. | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
The following actions are currently supported:
| Draw | Render the effect to the target bitmap. | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
ERR acDraw(*Object, DOUBLE X, DOUBLE Y, DOUBLE Width, DOUBLE Height)
| ||||||||||||
Component selection for RemapFX methods.
| Name | Description |
|---|---|
| CMP::ALL | All colour channels. |
| CMP::ALPHA | The alpha channel. |
| CMP::BLUE | The blue colour channel. |
| CMP::GREEN | The green colour channel. |
| CMP::RED | The red colour channel. |
| Name | Description |
|---|---|
| VSM::AUTO | The default option is chosen by the system. This will typically be BILINEAR, but slow machines may switch to nearest neighbour and high speed machines could use more advanced methods. |
| VSM::BESSEL | Uses a broad Bessel filter that can preserve detail during resampling, but is slower than the smaller-kernel methods. |
| VSM::BICUBIC | Produces a similar result to BILINEAR at a slightly higher CPU cost and a marginally sharper after-effect. |
| VSM::BILINEAR | Bilinear is a common algorithm that produces a reasonable quality image quickly. |
| VSM::BLACKMAN | Five times slower than BILINEAR, the final result will be less sharp than SINC. |
| VSM::GAUSSIAN | Uses a Gaussian filter that softens the result, reducing aliasing at the cost of sharp edge detail. |
| VSM::KAISER | Uses a Kaiser-windowed filter, giving smooth interpolation with low ringing and a cost close to BILINEAR. |
| VSM::LANCZOS | This well known algorithm may serve as a point of comparison for evaluating the results of other methods. It shares characteristics with SINC and BLACKMAN. |
| VSM::MITCHELL | Uses a Mitchell-Netravali filter, balancing sharpness and smoothness at a cost similar to BICUBIC. |
| VSM::NEIGHBOUR | Nearest neighbour is the fastest sampler at the cost of poor quality. |
| VSM::QUADRIC | Uses a quadratic filter with a modest kernel, giving smoother results than BILINEAR with limited extra cost. |
| VSM::SINC | Five times slower than BILINEAR, the final result is of very good quality. |
| VSM::SPLINE16 | About twice as slow as BILINEAR, this method samples a 4x4 area and produces a considerably better result, and is a good choice for enlarging images without producing artifacts when contrasting colours are present. |