You probably can do this by giving each MaskLayer a LayerName when the layer is created and then iterate though the layers backwards to identify the mask layers.
Add Mask Layer
iLayer := ImageEnView.LayersAdd;
ImageEnView.Layers[iLayer].Name := AnsiString('Mask Layer');
Remove all Mask Layers
for i := ImageEnView.LayersCount - 1 downto 1 do
begin
ImageEnView.LayersCurrent := i;
if ImageEnView.CurrentLayer.Name := AnsiString('Mask Layer') then
ImageEnView.LayersRemove(i);
end;
ImageEnView.Update;
You must iterate backwards because you are removing layers. If you iterate forwards then the loop becomes corrupted which will cause an exception. Do not include layer 0 because that is not a mask layer.
I can not comment more because you did not show any code at all.
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development