Important notice: the development of WideImage 1.0 branch is discontinued.
Please visit
http://wideimage.sourceforge.net for the new version of library and documentation.
This web site will remain accessible to serve as documentation for the old versions of the library.
For help on migration, please refer
to the
migration
guide.
wiImage::applyMask()
See:
List of operations
Signature
wiImage::applyMask($mask, $x = 0, $y = 0)
Parameters
- $mask (wiImage): the mask image. This should be a greyscale image, like the ones created with [image_asMask wiImage::asMask()].
- $x (int): left position on the target image
- $y (int): top position on the target image
- result (wiTrueColorImage): masked image
Description
Returns a copy of the image with the mask applied. The mask is a greyscale image, which specifies the alpha channel of the newly created image. Black areas are completely transparent, white are completely opaque, colors between specify the value of alpha color component.
Notes
This method is slow, because it's implemented in pure PHP.
Examples
$img = wiImage::load('/path/to/an/image.png');
$mask = wiImage::load('/path/to/mask.png');
$masked = $img->applyMask($mask);
$masked->saveToFile(...);
CategoryDocApi
There are no comments on this page. [Add comment]