summaryrefslogtreecommitdiff
path: root/tests/test_stroke.c
blob: 1bcafd1cf585027d0c19dc127d70676e246d2310 (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
32
33
#include "common_linux.h"

int main(int argc, char *argv[]) {
  RGL_Context ctx;
  RGL_Buffer buf;

  buf.width = 800;
  buf.height = 600;

  ArenaInit(&ctx.queue.arena, 0);
  ctx.queue.commands = (RGL_Command *)ctx.queue.arena.data;

  BufferAlloc(&buf);

  ctx.color = RGL_COLOR(255, 255, 255, 255);

  RGL_BeginPath(&ctx, PathStroke);
  RGL_PathMoveTo(&ctx, 0, 0);
  RGL_PathMoveTo(&ctx, 799, 599);
  RGL_PathMoveTo(&ctx, 799, 0);
  RGL_PathMoveTo(&ctx, 0, 599);
  RGL_EndPath(&ctx);

  RGL_Draw(&ctx, &buf);

  if (WritePPM(buf, "output.ppm"))
    return 1;

  ArenaDestroy(&ctx.queue.arena);
  BufferDestroy(&buf);

  return 0;
}