#include <stdlib.h>
#include <glad/gl.h>
#include "canvas.h"
canvas_t canvas_create(GLint w, GLint h) {
color_t* data = calloc(w * h, sizeof(color_t));
return (canvas_t){
.data = data,
.w = w,
.h = h
};
}
void canvas_clear(canvas_t* self, color_t clear) {
for (int i = 0; i < ( self->w * self->h ); i++) {
self->data[i] = clear;
}
}
void canvas_destroy(canvas_t* self) {
free(self->data);
}