blob: 02d2aa2f8f828d53916c028a6cb49d7e79e43fee [file] [log] [blame]
#include "../api/draw.h"
#include "../api/pixel_formats.h"
#include "slides.h"
#include <algorithm>
#include <memory>
#include <stb_image_write.h>
using namespace eskia;
int main(int, char**) {
const int w = 400,
h = 400;
auto buf = std::make_unique<RGBA_8888[]>(w*h);
Frame frame{buf.get(),
w,h, sizeof(RGBA_8888), w,
src_RGBA_8888, srcover_RGBA_8888};
for (auto it = slides; *it; it++) {
auto slide = *it;
Paint paint;
paint.color = RGBA_8888{255,255,255,255};
frame.draw({0,0,w,h}, paint, single_color, frame.src);
const char* name = slide(&frame);
std::transform(buf.get(), buf.get() + w*h, buf.get(),
unpremultiply);
char path[128];
sprintf(path, "%s.png", name);
stbi_write_png(path, w,h, 4/*RGBA*/, buf.get(), sizeof(RGBA_8888)*w);
}
return 0;
}