Macros | |
#define | TANVASTOUCH_ERROR_TEXTURE (6u << 16u) |
#define | TANVASTOUCH_ERROR_TEXTURE_OFFSET_TOO_LARGE TANVASTOUCH_AS(int, (TANVASTOUCH_ERROR_TEXTURE | 1u)) |
#define | TANVASTOUCH_ERROR_TEXTURE_SIZE_MISMATCH TANVASTOUCH_AS(int, (TANVASTOUCH_ERROR_TEXTURE | 2u)) |
#define | TANVASTOUCH_ERROR_TEXTURE_NEGATIVE_WIDTH TANVASTOUCH_AS(int, (TANVASTOUCH_ERROR_TEXTURE | 3u)) |
#define | TANVASTOUCH_ERROR_TEXTURE_NEGATIVE_HEIGHT TANVASTOUCH_AS(int, (TANVASTOUCH_ERROR_TEXTURE | 4u)) |
Functions | |
TANVASTOUCH_API int | tanvastouch_create_texture (tanvastouch_ctx *ctx, tanvastouch_resource_id *p_texture_id) |
TANVASTOUCH_API int | tanvastouch_destroy_texture (tanvastouch_ctx *ctx, tanvastouch_resource_id texture_id) |
TANVASTOUCH_API int | tanvastouch_set_texture_data (tanvastouch_ctx *ctx, tanvastouch_resource_id texture_id, const unsigned char *p_data, int width, int height) |
TANVASTOUCH_API int | tanvastouch_get_texture_size (tanvastouch_ctx *ctx, tanvastouch_resource_id texture_id, int *p_width, int *p_height) |
TANVASTOUCH_API int | tanvastouch_set_texture_data_partial (tanvastouch_ctx *ctx, tanvastouch_resource_id texture_id, const unsigned char *p_data, uint32_t length, uint32_t offset) |
TANVASTOUCH_API int | tanvastouch_get_texture_data_size (tanvastouch_ctx *ctx, tanvastouch_resource_id texture_id, uint32_t *p_size) |
#define TANVASTOUCH_ERROR_TEXTURE (6u << 16u) |
Errors specific to textures.
#define TANVASTOUCH_ERROR_TEXTURE_NEGATIVE_HEIGHT TANVASTOUCH_AS(int, (TANVASTOUCH_ERROR_TEXTURE | 4u)) |
The texture has a negative height.
#define TANVASTOUCH_ERROR_TEXTURE_NEGATIVE_WIDTH TANVASTOUCH_AS(int, (TANVASTOUCH_ERROR_TEXTURE | 3u)) |
The texture has a negative width.
#define TANVASTOUCH_ERROR_TEXTURE_OFFSET_TOO_LARGE TANVASTOUCH_AS(int, (TANVASTOUCH_ERROR_TEXTURE | 1u)) |
An offset or length used in a set_texture_data_partial call would go out-of-bounds for the given texture.
set_texture_data_partial cannot append to or remove from a texture. To change a texture's size, set new data with set_texture_data.
#define TANVASTOUCH_ERROR_TEXTURE_SIZE_MISMATCH TANVASTOUCH_AS(int, (TANVASTOUCH_ERROR_TEXTURE | 2u)) |
A size mismatch was detected when sending texture data (i.e. width * height != length).
TANVASTOUCH_API int tanvastouch_create_texture | ( | tanvastouch_ctx * | ctx, |
tanvastouch_resource_id * | p_texture_id | ||
) |
Create a texture.
A texture has no initial data.
ctx | The context to use. |
p_texture_id | Texture ID storage. |
TANVASTOUCH_API int tanvastouch_destroy_texture | ( | tanvastouch_ctx * | ctx, |
tanvastouch_resource_id | texture_id | ||
) |
Destroy a texture.
ctx | The context to use. |
texture_id | The texture to destroy. |
TANVASTOUCH_API int tanvastouch_get_texture_data_size | ( | tanvastouch_ctx * | ctx, |
tanvastouch_resource_id | texture_id, | ||
uint32_t * | p_size | ||
) |
Get the size of the data inside a texture.
The size is returned in bytes.
ctx | The context to use. |
texture_id | The texture to modify. |
p_size | Size storage. |
TANVASTOUCH_API int tanvastouch_get_texture_size | ( | tanvastouch_ctx * | ctx, |
tanvastouch_resource_id | texture_id, | ||
int * | p_width, | ||
int * | p_height | ||
) |
Get a texture's dimensions.
Texture dimensions are reported in pixels.
ctx | The context to use. |
texture_id | The texture to query. |
p_width | Width storage. |
p_height | Height storage. |
TANVASTOUCH_API int tanvastouch_set_texture_data | ( | tanvastouch_ctx * | ctx, |
tanvastouch_resource_id | texture_id, | ||
const unsigned char * | p_data, | ||
int | width, | ||
int | height | ||
) |
Set a texture's data.
Texture data is an array of bytes. Each byte represents a friction value, with 0 being the natural friction of the touchscreen and 255 the highest friction achievable by the hardware. The width times the height must equal the data size.
ctx | The context to use. |
texture_id | The texture to modify. |
p_data | The data to set. |
width | Texture width; must be non-negative. |
height | Texture height; must be non-negative. |
TANVASTOUCH_API int tanvastouch_set_texture_data_partial | ( | tanvastouch_ctx * | ctx, |
tanvastouch_resource_id | texture_id, | ||
const unsigned char * | p_data, | ||
uint32_t | length, | ||
uint32_t | offset | ||
) |
Replace part of a texture's data with new data.
ctx | The context to use. |
texture_id | The texture to modify. |
p_data | The new data. |
length | The size of the new data. |
offset | The position in the existing texture data where replacement should start. |