Picture.Constructor(width as Integer, height as Integer)

From Xojo Documentation

Revision as of 15:58, 19 February 2021 by PLefebvre (talk | contribs) (Exceptions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Constructor

Picture.Constructor(width as Integer, height as Integer)

New in 2011r4

A Picture created with this constructor supports an alpha channel directly instead of requiring the use of masks.

Exceptions

Exception Reason
OutOfBoundsException Raised if Width and Height are outside the range 1 - 32767.
OutOfMemoryException Raised if there is not enough memory to create the picture.
UnsupportedOperationException Raised on Windows if the picture exceeds its maximum bitmap size. This can be lower than 32767 if a software D2D renderer is used.

Notes

This constructor creates a Picture instance with alpha channel support using the passed width and height parameters. Both Width and Height must be in the range 1 - 32767, otherwise an OutOfBoundsException is raised. Width and Height specify the size of the picture in pixels.

When this constructor is used, the Picture defaults to translucent and can be returned to that state using ClearRect.

A picture created with a bit depth defaults to having a white, opaque background. Calling ClearRect on it returns it to that state.

Pictures created with an alpha channel do not use a mask. The Mask property will be Nil. Use the CopyMask and ApplyMask methods if you need to work with masks.

Sample Code

This code creates a new Picture with an alpha channel:

Var pic As New Picture(2000, 2000)