CombineLayers

Declaration: CombineLayers(TSlot, Lay1, Lay2, LayDest: integer; Par1, Par2: double; CMode: integer): integer;
Arithmetically combines the layers Lay1 and Lay2 of the data cube at time slot TSlot and writes the results into the layer LayDest. Each layer is multiplied by the corresponding parameter Par1 and Par2, respectively. The parameter CMode controls the kind of arithmetic combination:
1 ... add: LayDest := Par1*Lay1 + Par2*Lay2
2 ... subtract: LayDest := Par1*Lay1 - Par2*Lay2
3 ... multiply: LayDest := Par1*Lay1 * Par2*Lay2
4 ... divide: LayDest := Par1*Lay1 / Par2*Lay2
5 ... augmented divide: LayDest := (1+Par1*Lay1) / (1+Par2*Lay2)

The function returns the following error codes:

 0 ... everything is OK
-1 ... Lay1 or Lay2 out of range
-2 ... LDest out of range
-3 ... TimeSlot out of range
-4 ... Par2 must not be zero (for CMode = 4)
-5 ... invalid CMode parameter

Hint: This command is much faster than the combination of layers which may be calculated by using the functions GetCubeLayer and SetCubeLayer and the corresponding math for each pixel.