Termux:GUI C/C++ Bindings
Loading...
Searching...
No Matches
hardware_buffer.h File Reference

This file contains functions related to accelerated rendering using SurfaceViews. More...

#include "types.h"

Go to the source code of this file.

Functions

tgui_err tgui_hardware_buffer_create (tgui_connection c, tgui_hardware_buffer *buffer, tgui_hardware_buffer_format format, uint32_t width, uint32_t height, tgui_hardware_buffer_cpu_frequency read, tgui_hardware_buffer_cpu_frequency write)
 Create an AHardwareBuffer shared with the plugin. More...
 
tgui_err tgui_hardware_buffer_destroy (tgui_connection c, tgui_hardware_buffer *buffer)
 Destroys a shared AHardwareBuffer. You also have to destroy any EGLImages or other mappings. More...
 
tgui_err tgui_surface_view_set_buffer (tgui_connection c, tgui_activity a, tgui_view v, tgui_hardware_buffer *buffer)
 Sets the buffer displayed in a SurfaceView. More...
 
tgui_err tgui_surface_view_config (tgui_connection c, tgui_activity a, tgui_view v, tgui_color background_color, tgui_surface_view_dimension_mismatch x, tgui_surface_view_dimension_mismatch y, float framerate)
 Configures the behaviour of a SurfaceView. More...
 

Detailed Description

This file contains functions related to accelerated rendering using SurfaceViews.

Function Documentation

◆ tgui_hardware_buffer_create()

tgui_err tgui_hardware_buffer_create ( tgui_connection  c,
tgui_hardware_buffer buffer,
tgui_hardware_buffer_format  format,
uint32_t  width,
uint32_t  height,
tgui_hardware_buffer_cpu_frequency  read,
tgui_hardware_buffer_cpu_frequency  write 
)

Create an AHardwareBuffer shared with the plugin.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
  • TGUI_ERR_VIEW_INVALID: Invalid view type.
Parameters
cThe connection to use.
[out]bufferThe buffer to create.
formatThe pixel format for the buffer.
widthThe width of the buffer.
heightThe height of the buffer.
readHow often the CPU will read the buffer.
writeHow often the CPU will write to the buffer.
Returns
tgui_err The error code.

◆ tgui_hardware_buffer_destroy()

tgui_err tgui_hardware_buffer_destroy ( tgui_connection  c,
tgui_hardware_buffer buffer 
)

Destroys a shared AHardwareBuffer. You also have to destroy any EGLImages or other mappings.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
  • TGUI_ERR_VIEW_INVALID: Invalid view type.
Parameters
cThe connection to use.
[out]bufferThe buffer to destroy.
Returns
tgui_err The error code.

◆ tgui_surface_view_set_buffer()

tgui_err tgui_surface_view_set_buffer ( tgui_connection  c,
tgui_activity  a,
tgui_view  v,
tgui_hardware_buffer buffer 
)

Sets the buffer displayed in a SurfaceView.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
  • TGUI_ERR_VIEW_INVALID: Invalid view type.
Parameters
cThe connection to use.
aThe Activity the View is in.
vThe SurfaceView.
[in]bufferThe buffer to show.
Returns
tgui_err The error code.

◆ tgui_surface_view_config()

tgui_err tgui_surface_view_config ( tgui_connection  c,
tgui_activity  a,
tgui_view  v,
tgui_color  background_color,
tgui_surface_view_dimension_mismatch  x,
tgui_surface_view_dimension_mismatch  y,
float  framerate 
)

Configures the behaviour of a SurfaceView.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
  • TGUI_ERR_VIEW_INVALID: Invalid view type.
Parameters
cThe connection to use.
aThe Activity the View is in.
vThe SurfaceView.
background_colorThe color that fills the rest of the SurfaceView in case the buffer is too small.
xThe behaviour on x axis buffer size mismatch.
yThe behaviour on y axis buffer size mismatch.
framerateThe targeted framerate, for Android 11 and higher.
Returns
tgui_err The error code.