RemoveContigRegionFromParticles

Declaration: TParticles.RemoveContigRegionFromParticles (ClassIdx: integer; Region: TInt2DArray; var AffectedParts: TIntArray): integer;
The function RemoveContigRegionFromParticles removes a single specified region from the particles of class ClassIdx (valid range: 1 ... NClasses). Depending on the intersection of the region with existing particles of the same class, one or more particles may be affected. Please note that the region to be removed (parameter Region) has to be specified as a two-dimensional array of integer, where all cells (pixels) of the region has to be marked by non-zero numbers, and all background pixels have to be marked by zeros:

Note: the region array must not contain more than one region. If the array contains several regions the resulting particle list might be corrupted. The parameter AffectedParts contains a list of particle indices which have been changed.

The function returns the following error codes:

>0 ... number of particles which are affected by the processing
 0 ... nothing has changed
-1 ... invalid ClassIdx
-2 ... the size of the Region array does not match the size of the particle data

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