Picture.HasAlphaChannel

From Xojo Documentation

Revision as of 22:44, 7 January 2022 by Gperlman (talk | contribs) (Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Read-Only Property (As Boolean )
BooleanValue = aPicture.HasAlphaChannel

New in 2011r4

Supported for all project types and targets.

True if the Picture has an alpha channel.

Sample Code

A Picture that is created with the constructor that omits the Depth parameter has an alpha channel and old pictures can be converted to this format with the following code:

Function ConvertToAlphaPicture(input As Picture) As Picture
If input.HasAlphaChannel Then Return input

Var result As New Picture(input.Width, input.Height)
result.Graphics.DrawPicture(input, 0, 0)
Return result
End Function

For pictures using masks, HasAlphaChannel returns False.