aboutsummaryrefslogtreecommitdiff
path: root/include/image_writer.h
blob: 79f549e0fd5dcb5da56359b6c18713f7236d9557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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;

typedef struct {
    gsr_image_writer_source source;
    gsr_egl *egl;
    int width;
    int height;
    unsigned int texture;
} gsr_image_writer;

bool gsr_image_writer_init(gsr_image_writer *self, gsr_image_writer_source source, gsr_egl *egl, 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 */