natiny_resource_from_data

C
NatinyResource natiny_resource_from_data(const uint8_t* data, uint32_t data_len);

Creates a resource from bytes already in memory.

Parameters

Name Type Description
data const uint8_t* Raw byte buffer
data_len uint32_t Buffer length in bytes

Returns

Type Description
NatinyResource Resource handle

Example

C
const uint8_t embedded[] = { 0x89, 0x50, 0x4E, 0x47 }; /* PNG signature bytes */
NatinyResource res = natiny_resource_from_data(embedded, sizeof(embedded));

natiny_resource_destroy(res);

Notes

  • The bytes are copied. The caller may release or reuse the input buffer after this function returns.