ImageEn, unit imageenview




procedure SetSelectedAreaAlpha(Alpha: Integer);


Sets the Alpha value (transparency) for all pixels inside current selection.
Pixels set to 0 will be fully transparent, pixels of 255 will be fully opaque, and values from 1 - 254 will be partially transparent.

If Alpha is specified as -1 then the level of alpha will be based on the selection intensity, i.e. if the SelectionMaskDepth is 8, then fully selected pixels (255) will be made fully transparent (0). Partially selected pixels (1-254) will be made partially alpha (254-1), and unselected pixels will not be modified.
If the SelectionMaskDepth is 1, then selected pixels (1) will be made fully transparent (0). Unselected pixels will not be modified.

To activate the alpha channel (transparency), set EnableAlphaChannel to True.


// Set transparency to 180 inside 10,10,100,100 rectangle
ImageEnView1.Select(10, 10, 100, 100);
ImageEnView1.SetSelectedAreaAlpha(180);'C:\image.png'); // save with alpha channel

// Select a 10,10,100,100 rectangle, feather it (soft edges) and remove outside the selection
ImageEnView1.Select(100, 100, 900, 900);
ImageEnView1.MakeSelectionFeather( 5 );

See Also

- AlphaFill