Picture.Mask

From Xojo Documentation

Property (As Picture )
aPicture.Mask([Create as Boolean]) = newPictureValue
or
PictureValue = aPicture.Mask([Create as Boolean])

Supported for all project types and targets.

Allows you to access a mask that controls the transparency of the picture. By default, the optional Create parameter is True. When Create is True, the mask is created automatically; otherwise the mask is returned, whether or not one exists.

Notes

The Mask property returns Nil when you are using a Picture created with an alpha channel (this includes HiDPI images). You can get at masks by using the CopyMask and ApplyMask methods instead.

Example

This example opens a jpeg file and creates a mask.

Dim p2 As Picture
Dim pic As Picture
Dim f As FolderItem
f = GetOpenFolderItem("image/jpeg")
If f <> Nil Then
pic = Picture.Open(f)
p2 = pic.Mask(True)
End If