mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 17:17:16 +09:00
36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
#ifndef GSR_IMAGE_WRITER_H
|
|
#define GSR_IMAGE_WRITER_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
typedef struct gsr_egl gsr_egl;
|
|
|
|
typedef enum {
|
|
GSR_IMAGE_FORMAT_JPEG,
|
|
GSR_IMAGE_FORMAT_PNG
|
|
} gsr_image_format;
|
|
|
|
typedef enum {
|
|
GSR_IMAGE_WRITER_SOURCE_OPENGL,
|
|
GSR_IMAGE_WRITER_SOURCE_MEMORY
|
|
} gsr_image_writer_source;
|
|
|
|
typedef struct {
|
|
gsr_image_writer_source source;
|
|
gsr_egl *egl;
|
|
int width;
|
|
int height;
|
|
unsigned int texture;
|
|
const void *memory; /* Reference */
|
|
} gsr_image_writer;
|
|
|
|
bool gsr_image_writer_init_opengl(gsr_image_writer *self, gsr_egl *egl, int width, int height);
|
|
/* |memory| is taken as a reference. The data is expected to be in rgba8 format (8 bit rgba) */
|
|
bool gsr_image_writer_init_memory(gsr_image_writer *self, const void *memory, int width, int height);
|
|
void gsr_image_writer_deinit(gsr_image_writer *self);
|
|
|
|
/* Quality is between 1 and 100 where 100 is the max quality. Quality doesn't apply to lossless formats */
|
|
bool gsr_image_writer_write_to_file(gsr_image_writer *self, const char *filepath, gsr_image_format image_format, int quality);
|
|
|
|
#endif /* GSR_IMAGE_WRITER_H */
|