RGBSurface.Transform

From Xojo Documentation

Method

RGBSurface.Transform(Map() as Double)

New in 5.5

Supported for all project types and targets.



Method

RGBSurface.Transform(RedMap() as Double,GreenMap() as Double,BlueMap() as Double)

New in 5.5

Supported for all project types and targets.

Applies a one-to-one pixel transformation to all pixels of an RGBSurface.

Transform is overloaded. You can specify the transformation via either of three lookup tables, RedMap, GreenMap, and BlueMap, or one lookup table to apply to all three channels.

Each map parameter is an 256 element array of integers. 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 map(i)=255-i, then calling Transform(Map) will invert the image.

Example

The following example uses the Transform method to invert an image:

Const kMaxMapOffset = 255
Var map(MaxMapOffset) As Integer
For i As Integer = 0 To kMaxMapOffset
map(i) = kMaxMapOffset - i
Next
somePicture.RGBSurface.Transform(map)