PictureEffects Xojo Plugin |

# MapEffect.Apply Method

Applies the effect on a given source image with a given mask.

Apply(
source as Picture,
red() as UInt8,
green() as UInt8,
blue() as UInt8,
mask as Picture) as Picture

#### Parameters

source
  The source image.
red()
  The red channel mapping, defined as: Dim red(255) as UInt8, where array elements 0 - 255 contain the mapping for the red channel.
green()
  The green channel mapping, defined as: Dim green(255) as UInt8, where array elements 0 - 255 contain the mapping for the green channel.
blue()
  The blue channel mapping, defined as: Dim blue(255) as UInt8, where array elements 0 - 255 contain the mapping for the blue channel.
mask
  To limit the filtering to certain pixels then set a picture defining the mask to this parameter. Pass nil to this parameter if the filtering should not be limited to certain pixels.
  The mask picture must be a 32 bit picture and must be same size as the src picture. If the mask picture is not 32 bits and same size as the src picture then the function will fail and leave the result picture unchanged.

#### Returns

Picture
  The result image or nil if failure.

#### Remarks

Specify the transformation via either of three lookup tables, red, green, and blue, or one lookup table to apply to all three channels.
Each map parameter is an 256 element array of UInt8. The transformation works as follows: For each pixel, the pixel’s RGB value is used as an index into the map arrays and the value found becomes the new R, G, or B value for the pixel.
For example, if you set up a map such that red(i)=255-i, then using this function will invert the image.

#### See Also

MapEffect Class