CopyParticleToRegion

Declaration: TParticles.CopyParticleToRegion (partix: integer; var Region: TInt2DArray): integer;
The function CopyParticleToRegion converts the particle specified by the parameter PartIx (valid range 1..NParticles) as a contiguous region into the two-dimensional array Region. All pixels of the specified particle show up as 1s in the region array, all other are set to zero:

Region is automatically resized to the size of the particle image data.

The function returns the following error codes:

 0 ... everything is OK
-1 ... the specified particle does not exist

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