CopyParticleToMask

Declaration: TParticles.CopyParticleToMask (PartList: TIntArray; var Mask: TBool2DArray): integer;
The function CopyParticleToMask converts the particle(s) specified in the open array PartList (valid range of the particle indexes: 1..NParticles) into the two-dimensional boolean array Mask, which can be used as image mask. Mask is automatically resized to match the size of the particle image data.

The function returns the following error codes:

 0 ... everything is OK
-1 ... the particle list is empty
-2 ... the particle list contains inexistent particles

Example: The following code snippet creates a new mask called "MyMask", then creates the mask array for the particles 10,12 and 28, inverts it and copies the boolean array to the pixel mask "MyMask":
var
  msk    : integer;
  mask   : TBool2DArray;

....
msk := DefineNewMask ('MyMask', true);
PEData.CopyParticleToMask ([10,12,28], mask);
InvertBoolMatrix (mask);
SetMask (msk, mask);
....

Hint: In order to access the particles currently loaded in the particle editor you can use the pre-declared global variable PEData.