40 unsigned char* imageio_load_image(
const char* filename,
int *width,
int *height);
45 bool imageio_save_image(
const char* filename,
unsigned char* buffer,
int width,
int height);
48 void imageio_gen_name(
char* filename,
size_t len);
51 inline void floats_to_bytes(
unsigned char *arr,
float *rgba,
int width,
int height)
53 for (
int j = 0; j < height; j++) {
54 for (
int i = 0; i < width; i++) {
55 int offset = (j * width + i) * 4;
56 int inv_offset = ((height - 1 - j) * width + i) * 4;
59 arr[offset] =
static_cast<unsigned char>(rgba[inv_offset] * 0xff);
60 arr[offset + 1] =
static_cast<unsigned char>(rgba[inv_offset + 1] * 0xff);
61 arr[offset + 2] =
static_cast<unsigned char>(rgba[inv_offset + 2] * 0xff);
62 arr[offset + 3] =
static_cast<unsigned char>(rgba[inv_offset + 3] * 0xff);
68 inline void bytes_to_floats(
float *rgba,
unsigned char *arr,
int width,
int height)
70 for (
int j = 0; j < height; j++) {
71 for (
int i = 0; i < width; i++) {
72 int offset = (j * width + i) * 4;
73 int inv_offset = ((height - 1 - j) * width + i) * 4;
76 rgba[offset] =
static_cast<float>(arr[inv_offset]) / 0xff;
77 rgba[offset + 1] =
static_cast<float>(arr[inv_offset + 1]) / 0xff;
78 rgba[offset + 2] =
static_cast<float>(arr[inv_offset + 2]) / 0xff;
79 rgba[offset + 3] =
static_cast<float>(arr[inv_offset + 3]) / 0xff;
Contains all core Lumiverse functions and variables.
Definition: Device.cpp:2