Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IOpacityLayer

interface IOpacityLayer
Extends ILayer Interface for a ILayer that supports opacity and overlapping drawing settings.

Methods

setOpacity()

void setOpacity(float opacity)
This method sets the opacity of the ILayer to the specified value. Opacity values range from 0.0 (fully transparent) to 1.0 (fully opaque). Memory and performance note: a layer with opacity 1.0f is treated as no-op. However, if the layer previously allocated a texture (i.e., IOpacityLayer::setHasOverlappingDraw to true), setting the opacity to 1.0f does not free the texture memory

Parameters

opacity
float — Required The opacity value to set, specified as a floating-point number between 0.0 and 1.0.

getOpacity()

float getOpacity()
This method retrieves the opacity of the ILayer, which determines how transparent or opaque the ILayer is when rendered. Opacity values range from 0.0 (fully transparent) to 1.0 (fully opaque).

Returns

float The opacity value of the ILayer, specified as a floating-point number between 0.0 and 1.0.

setHasOverlappingDraw()

void setHasOverlappingDraw(bool hasOverlappingDraw, Size? dimension)
This method sets whether the ILayer allows overlapping drawing. If enabled, overlapping drawing is allowed; if disabled, overlapping drawing is prevented. This may be due to overlapping child ILayer or due a single drawable child applying ICanvas draw operations with overlap. Memory and performance note: when set to true (and opacity!=1.0f), texture will be allocated for this ILayer. If dimensions are not explicitly specified, parent ILayer bounds will be used. It is therefore always recommended to explicitly set the dimensions when bounds are known to be smaller than parent bounds. Setting hasOverlappingDraw to false will free any previously allocated texture memory.

Parameters

hasOverlappingDraw
bool — Required A boolean value indicating whether overlapping draw is enabled (true) or disabled (false).
dimension
Size? — Optional the dimensions of this layer. It will internally call ILayer::setSize.

hasOverlappingDraw()

bool hasOverlappingDraw()
This method checks whether the ILayer has overlapping draw enabled.

Returns

bool True if overlapping draw is enabled, false otherwise.
Last modified on October 29, 2026