Files
fluxengine/tests/agg.cc
dg 466c3c34e5 Replace the Error() object with an error() function which takes fmt
formatspecs, making for much cleaner code. Reformatted everything.

This actually happened in multiple steps but then I corrupted my local
repository and I had to recover from the working tree.
2023-05-09 20:59:44 +00:00

28 lines
596 B
C++

#include "globals.h"
#include "bytes.h"
#include "dep/agg/include/agg2d.h"
#include "dep/stb/stb_image_write.h"
#include <assert.h>
static void test_agg(void)
{
const int WIDTH = 640;
const int HEIGHT = 480;
const int DEPTH = 4;
const int STRIDE = WIDTH * DEPTH;
std::vector<uint8_t> data(STRIDE * HEIGHT, 255);
Agg2D painter;
painter.attach(&data[0], WIDTH, HEIGHT, STRIDE);
painter.line(0, 0, WIDTH, HEIGHT);
stbi_write_png("/tmp/test.png", WIDTH, HEIGHT, 4, &data[0], STRIDE);
}
int main(int argc, const char* argv[])
{
test_agg();
return 0;
}