LayerFuncs

Overview

Related Modules:

Display

Description:

Defines pointers to the layer driver functions.

Summary

Data Fields

Variable Name

Description

InitDisplay )(uint32_t devId)

int32_t( 

Initializes a display device.

DeinitDisplay )(uint32_t devId)

int32_t( 

Deinitializes a display device.

GetDisplayInfo )(uint32_t devId, DisplayInfo dispInfo)

int32_t( 

Obtains information about a display device.

OpenLayer )(uint32_t devId, const LayerInfo layerInfo, uint32_t layerId)

int32_t( 

Opens a layer on a specified display device.

CloseLayer )(uint32_t devId, uint32_t layerId)

int32_t( 

Closes a layer that is no longer required on a specified display device.

SetLayerVisible )(uint32_t devId, uint32_t layerId, bool visible)

int32_t( 

Sets whether a layer is visible.

GetLayerVisibleState )(uint32_t devId, uint32_t layerId, bool visible)

int32_t( 

Checks whether a layer is visible.

SetLayerSize )(uint32_t devId, uint32_t layerId, IRect rect)

int32_t( 

Sets the size of a layer.

GetLayerSize )(uint32_t devId, uint32_t layerId, IRect rect)

int32_t( 

Obtains the size of a layer.

SetLayerCrop )(uint32_t devId, uint32_t layerId, IRect rect)

int32_t( 

Sets the rectangular area to crop for a layer.

SetLayerZorder )(uint32_t devId, uint32_t layerId, uint32_t zorder)

int32_t( 

Sets the z-order for a layer.

GetLayerZorder )(uint32_t devId, uint32_t layerId, uint32_t zorder)

int32_t( 

Obtains the z-order of a layer.

SetLayerPreMulti )(uint32_t devId, uint32_t layerId, bool preMul)

int32_t( 

Sets layer premultiplication.

GetLayerPreMulti )(uint32_t devId, uint32_t layerId, bool preMul)

int32_t( 

Obtains the premultiplication flag of a layer.

SetLayerAlpha )(uint32_t devId, uint32_t layerid, LayerAlpha alpha)

int32_t( 

Sets the alpha value for a layer.

GetLayerAlpha )(uint32_t devId, uint32_t layerId, LayerAlpha alpha)

int32_t( 

Obtains the alpha value of a layer.

SetLayerColorKey )(uint32_t devId, uint32_t layerId, bool enable, uint32_t key)

int32_t( 

Sets the color key for a layer.

GetLayerColorKey )(uint32_t devId, uint32_t layerId, bool enable, uint32_t key)

int32_t( 

Obtains the color key of a layer.

SetLayerPalette )(uint32_t devId, uint32_t layerId, uint32_t palette, uint32_t len)

int32_t( 

Sets the palette for a layer.

GetLayerPalette )(uint32_t devId, uint32_t layerId, uint32_t palette, uint32_t len)

int32_t( 

Obtains the palette of a layer.

SetTransformMode )(uint32_t devId, uint32_t layerId, TransformType type)

int32_t( 

Sets the transform mode for a layer.

SetLayerCompression )(uint32_t devId, uint32_t layerId, int32_t compType)

int32_t( 

Sets the compression feature for a layer.

GetLayerCompression )(uint32_t devId, uint32_t layerId, int32_t compType)

int32_t( 

Checks whether the compression feature is enabled for a layer.

SetLayerDirtyRegion )(uint32_t devId, uint32_t layerId, IRect region)

int32_t( 

Sets the flushing area for a layer.

GetLayerBuffer )(uint32_t devId, uint32_t layerId, LayerBuffer buffer)

int32_t( 

Obtains the buffer of a layer.

Flush )(uint32_t devId, uint32_t layerId, LayerBuffer buffer)

int32_t( 

Flushes a layer.

WaitForVBlank )(uint32_t devId, uint32_t layerId)

int32_t( 

Waits for the arrival of vertical blanking.

SnapShot )(uint32_t devId, LayerBuffer buffer)

int32_t( 

Implements the snapshot feature.

Details

Field Documentation

CloseLayer

  1. int32_t(* LayerFuncs::CloseLayer) (uint32_t devId, uint32_t layerId)

Description:

Closes a layer that is no longer required on a specified display device.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

OpenLayer

DeinitDisplay

  1. int32_t(* LayerFuncs::DeinitDisplay) (uint32_t devId)

Description:

Deinitializes a display device.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

InitDisplay

Flush

  1. int32_t(* LayerFuncs::Flush) (uint32_t devId, uint32_t layerId, [LayerBuffer]($api-api-SmartVision-Devices-LayerBuffer.md) *buffer)

Description:

Flushes a layer.

Display data in the buffer is flushed to a specified layer so that the image data is displayed on the screen.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
buffer Indicates the pointer to the buffer in which the display data is to flush.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

GetDisplayInfo

  1. int32_t(* LayerFuncs::GetDisplayInfo) (uint32_t devId, [DisplayInfo]($api-api-SmartVision-Devices-DisplayInfo.md) *dispInfo)

Description:

Obtains information about a display device.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
dispInfo Indicates the pointer to the display device information obtained.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

GetLayerAlpha

  1. int32_t(* LayerFuncs::GetLayerAlpha) (uint32_t devId, uint32_t layerId, [LayerAlpha]($api-api-SmartVision-Devices-LayerAlpha.md) *alpha)

Description:

Obtains the alpha value of a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
alpha Indicates the pointer to the obtained alpha value.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

SetLayerAlpha

GetLayerBuffer

  1. int32_t(* LayerFuncs::GetLayerBuffer) (uint32_t devId, uint32_t layerId, [LayerBuffer]($api-api-SmartVision-Devices-LayerBuffer.md) *buffer)

Description:

Obtains the buffer of a layer.

After drawing a picture in the buffer, the application calls the Flush function to display the picture on the screen.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
buffer Indicates the pointer to the obtained buffer.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

Flush

GetLayerColorKey

  1. int32_t(* LayerFuncs::GetLayerColorKey) (uint32_t devId, uint32_t layerId, bool *enable, uint32_t *key)

Description:

Obtains the color key of a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
enable Indicates the pointer to the color key enable bit.
key Indicates the pointer to the color key.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

SetLayerColorKey

GetLayerCompression

  1. int32_t(* LayerFuncs::GetLayerCompression) (uint32_t devId, uint32_t layerId, int32_t *compType)

Description:

Checks whether the compression feature is enabled for a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
compType Indicates the pointer to the variable specifying whether the compression feature is enabled.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

SetLayerCompression

GetLayerPalette

  1. int32_t(* LayerFuncs::GetLayerPalette) (uint32_t devId, uint32_t layerId, uint32_t *palette, uint32_t len)

Description:

Obtains the palette of a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
palette Indicates the pointer to the obtained palette.
len Indicates the length of the palette.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

SetLayerPalette

GetLayerPreMulti

  1. int32_t(* LayerFuncs::GetLayerPreMulti) (uint32_t devId, uint32_t layerId, bool *preMul)

Description:

Obtains the premultiplication flag of a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
preMul Indicates the pointer to the obtained layer premultiplication flag.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

SetLayerPreMulti

GetLayerSize

  1. int32_t(* LayerFuncs::GetLayerSize) (uint32_t devId, uint32_t layerId, [IRect]($api-api-SmartVision-Devices-IRect.md) *rect)

Description:

Obtains the size of a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
rect Indicates the pointer to the obtained layer size.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

SetLayerSize

GetLayerVisibleState

  1. int32_t(* LayerFuncs::GetLayerVisibleState) (uint32_t devId, uint32_t layerId, bool *visible)

Description:

Checks whether a layer is visible.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
visible Indicates the pointer to the obtained layer visibility. The value true indicates that the layer is visible, and false indicates that the layer is invisible.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

SetLayerVisible

GetLayerZorder

  1. int32_t(* LayerFuncs::GetLayerZorder) (uint32_t devId, uint32_t layerId, uint32_t *zorder)

Description:

Obtains the z-order of a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
zorder Indicates the pointer to the obtained z-order. The value is an integer ranging from 0 to 255. A larger z-order value indicates a higher layer.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

SetLayerZorder

InitDisplay

  1. int32_t(* LayerFuncs::InitDisplay) (uint32_t devId)

Description:

Initializes a display device.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

DeinitDisplay

OpenLayer

  1. int32_t(* LayerFuncs::OpenLayer) (uint32_t devId, const [LayerInfo]($api-api-SmartVision-Devices-LayerInfo.md) *layerInfo, uint32_t *layerId)

Description:

Opens a layer on a specified display device.

Before using a layer on the GUI, you must open the layer based on the layer information. After the layer is opened, you can obtain the layer ID and then use other functions based on the layer ID.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerInfo Indicates the pointer to the layer information passed to open a layer, including the layer type, layer size, and pixel format.
layerId Indicates the pointer to the layer ID, which identifies a unique layer. The layer ID is returned to the GUI after the layer is successfully opened.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

CloseLayer

SetLayerAlpha

  1. int32_t(* LayerFuncs::SetLayerAlpha) (uint32_t devId, uint32_t layerid, [LayerAlpha]($api-api-SmartVision-Devices-LayerAlpha.md) *alpha)

Description:

Sets the alpha value for a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
alpha Indicates the pointer to the alpha value to set.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

GetLayerAlpha

SetLayerColorKey

  1. int32_t(* LayerFuncs::SetLayerColorKey) (uint32_t devId, uint32_t layerId, bool enable, uint32_t key)

Description:

Sets the color key for a layer.

The color key is used during layer overlay.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
enable Specify whether to enable the color key.
key Indicates the color key.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

GetLayerColorKey

SetLayerCompression

  1. int32_t(* LayerFuncs::SetLayerCompression) (uint32_t devId, uint32_t layerId, int32_t compType)

Description:

Sets the compression feature for a layer.

In specific scenarios, images need to be compressed. You can set whether to enable layer compression.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
compType Specifies whether to enable the compression feature. The value true>/b> means to enable compression, and false> means the opposite.

Returns:

** Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise. **

See also:

GetLayerCompression

SetLayerCrop

  1. int32_t(* LayerFuncs::SetLayerCrop) (uint32_t devId, uint32_t layerId, [IRect]($api-api-SmartVision-Devices-IRect.md) *rect)

Description:

Sets the rectangular area to crop for a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
rect Indicates the pointer to the rectangular area to crop.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

SetLayerDirtyRegion

  1. int32_t(* LayerFuncs::SetLayerDirtyRegion) (uint32_t devId, uint32_t layerId, [IRect]($api-api-SmartVision-Devices-IRect.md) *region)

Description:

Sets the flushing area for a layer.

After the GUI draws an image, you must set the layer flushing area before calling the Flush function to flush the screen.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
region Indicates the pointer to the flushing area to set.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

SetLayerPalette

  1. int32_t(* LayerFuncs::SetLayerPalette) (uint32_t devId, uint32_t layerId, uint32_t *palette, uint32_t len)

Description:

Sets the palette for a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
palette Indicates the pointer to the palette to set.
len Indicates the length of the palette.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

GetLayerPalette

SetLayerPreMulti

  1. int32_t(* LayerFuncs::SetLayerPreMulti) (uint32_t devId, uint32_t layerId, bool preMul)

Description:

Sets layer premultiplication.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
preMul Specifies whether to enable layer premultiplication. The value 1 means to enable layer premultiplication, and 0 means the opposite.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

GetLayerPreMulti

SetLayerSize

  1. int32_t(* LayerFuncs::SetLayerSize) (uint32_t devId, uint32_t layerId, [IRect]($api-api-SmartVision-Devices-IRect.md) *rect)

Description:

Sets the size of a layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
rect Indicates the pointer to the layer size to set, in pixels.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

GetLayerSize

SetLayerVisible

  1. int32_t(* LayerFuncs::SetLayerVisible) (uint32_t devId, uint32_t layerId, bool visible)

Description:

Sets whether a layer is visible.

A visible layer is displayed on the screen, whereas an invisible layer is not displayed on the screen.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
visible Indicates the visibility to set for the layer. The value true means to set the layer to be visible, and false means the opposite.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

GetLayerVisibleState

SetLayerZorder

  1. int32_t(* LayerFuncs::SetLayerZorder) (uint32_t devId, uint32_t layerId, uint32_t zorder)

Description:

Sets the z-order for a layer.

A larger z-order value indicates a higher layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
zorder Indicates the z-order to set. The value is an integer ranging from 0 to 255.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

See also:

GetLayerZorder

SetTransformMode

  1. int32_t(* LayerFuncs::SetTransformMode) (uint32_t devId, uint32_t layerId, [TransformType]($api-api-SmartVision-Devices-Display.md#gaa65f3b21a9a92ff022e435a7304126d2) type)

Description:

Sets the transform mode for a layer.

Using this function, you can rotate, scale, and move the layer.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
type Indicates the transformation mode to set.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

SnapShot

  1. int32_t(* LayerFuncs::SnapShot) (uint32_t devId, [LayerBuffer]($api-api-SmartVision-Devices-LayerBuffer.md) *buffer)

Description:

Implements the snapshot feature.

This function saves the screenshot of image data on the display device to the buffer for debugging or as requested by applications.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
buffer Indicates the pointer to the buffer for saving screenshots.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.

WaitForVBlank

  1. int32_t(* LayerFuncs::WaitForVBlank) (uint32_t devId, uint32_t layerId)

Description:

Waits for the arrival of vertical blanking.

This function blocks the process until vertical blanking arrives, implementing the synchronization between software and hardware.

Parameters:

Name

Description

devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates the first display device and 4 indicates the last display device.
layerId Indicates the layer ID, which identifies a unique layer. You can perform operations on the layer with the specified layer ID.
timeOut Indicates the maximum duration that the process waits for the arrival of vertical blanking.

Returns:

Returns 0 if the operation is successful; returns an error code defined in DispErrCode otherwise.