ImageEn, unit iexLayers

TIELayer.MaskInverted

TIELayer.MaskInverted


Declaration

property MaskInverted: Boolean;


Description

If the layer is a mask then setting MaskInverted will invert the mask (transparent area will become solid and vice versa).

Default: False


Demo

Demo  Demos\LayerEditing\LayerMask\LayerMask.dpr


Examples

// Create a star shape mask
ImageEnView1.LayersInsert( ImageEnView1.LayersCurrent + 1, iesStar5 );
ImageEnView1.CurrentLayer.FillColor    := $00808080; // 50% masking, as 128 = 80 hex)
ImageEnView1.CurrentLayer.BorderWidth  := 0;
ImageEnView1.CurrentLayer.IsMask       := True;
ImageEnView1.CurrentLayer.MaskInverted := True;
ImageEnView1.CurrentLayer.Visible      := False;



// Create an explosion with a gradient mask that radiates out
ImageEnView1.LayersInsert( ImageEnView1.LayersCurrent + 1, iesExplosion );
ImageEnView1.CurrentLayer.FillGradient := gpgDiagCenter;
ImageEnView1.CurrentLayer.FillColor2   := clBlack;   // 100% masking
ImageEnView1.CurrentLayer.FillColor    := clWhite;   // 0% masking
ImageEnView1.CurrentLayer.BorderWidth  := 0;
ImageEnView1.CurrentLayer.IsMask       := True;
ImageEnView1.CurrentLayer.MaskInverted := True;
ImageEnView1.CurrentLayer.Visible      := False;

// Create a diamond with solid border
ImageEnView1.LayersInsert( ImageEnView1.LayersCurrent + 1, iesDiamond );
ImageEnView1.CurrentLayer.FillColor    := $00808080; // 50% masking, as 128 = 80 hex)
ImageEnView1.CurrentLayer.BorderWidth  := 30;
ImageEnView1.CurrentLayer.BorderColor  := clBlack;   // 100% masking
ImageEnView1.CurrentLayer.IsMask       := True;
ImageEnView1.CurrentLayer.MaskInverted := True;
ImageEnView1.CurrentLayer.Visible      := False;


// Add a mask layer (to the top-most image layer) which is transparent at the top and opaque at the bottom
ImageEnView1.LayersInsert( ImageEnView1.LayersCurrent + 1, 0, 255, gpgVertical );

// Which is the same as...

ImageEnView1.LayersInsert( ImageEnView1.LayersCurrent + 1, iesRectangle );
ImageEnView1.CurrentLayer.FillGradient := gpgVertical;
ImageEnView1.CurrentLayer.FillColor    := clWhite;   // 0% masking
ImageEnView1.CurrentLayer.FillColor2   := clBlack;   // 100% masking
ImageEnView1.CurrentLayer.BorderWidth  := 0;
ImageEnView1.CurrentLayer.MaskInverted := True;
ImageEnView1.CurrentLayer.IsMask       := True;
ImageEnView1.CurrentLayer.Visible      := False;

// Make it the cover the underlying image
prevLayer := ImageEnView1.Layers[ ImageEnView1.LayersCurrent - 1];
ImageEnView1.CurrentLayer.PosX   := prevLayer.PosX;
ImageEnView1.CurrentLayer.PosY   := prevLayer.PosY;
ImageEnView1.CurrentLayer.Width  := prevLayer.Width;
ImageEnView1.CurrentLayer.Height := prevLayer.Height;




// Add an elliptical mask to image layer 2 (i.e. to make the image circular)
ImageEnView1.LayersInsert( 3, iesEllipse );
ImageEnView1.CurrentLayer.FillColor := clBlack;
ImageEnView1.CurrentLayer.ClientAreaBox := ImageEnView1.Layers[2].ClientAreaBox;
ImageEnView1.CurrentLayer.IsMask := True;
ImageEnView1.CurrentLayer.MaskInverted := True;
ImageEnView1.CurrentLayer.Visible := False;
ImageEnView1.Update();