10 static bool sFrameBufferActive =
false;
15 if (sFrameBufferActive) {
21 if (sFrameBufferActive) {
27 if (sFrameBufferActive) {
43 sFrameBufferActive = enabled;
53 FILE * file = fopen(filename,
"wb");
56 png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
NULL,
NULL,
NULL);
59 png_infop info = png_create_info_struct(png);
62 png_init_io(png, file);
64 png_set_IHDR(png, info,
69 PNG_COMPRESSION_TYPE_DEFAULT,
70 PNG_FILTER_TYPE_DEFAULT);
72 png_write_info(png, info);
74 static_assert(
sizeof(
pixel_t) == 3,
"pixel_t shall be 3 bytes long (RGB888 format)");
81 row[i].
blue =
c.blue();
83 png_write_row(png, (png_bytep)row);
87 png_write_end(png,
NULL);
89 png_free_data(png, info, PNG_FREE_ALL, -1);
90 png_destroy_write_struct(&png, (png_infopp)
NULL);
void pushRectUniform(KDRect rect, KDColor color)
void Display(const char *input)
void pullRect(KDRect r, KDColor *pixels)
LIBA_BEGIN_DECLS void free(void *ptr)
void pushRect(KDRect r, const KDColor *pixels)
void pushRect(KDRect rect, const KDColor *pixels)
void pullRect(KDRect rect, KDColor *pixels)
void setFrameBufferActive(bool enabled)
void writeFrameBufferToFile(const char *filename)
void * malloc(size_t size)
void pushRectUniform(KDRect r, KDColor c)