Create initial demo writing an image
This commit is contained in:
27
demo.c
Normal file
27
demo.c
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include "ff.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define W 800
|
||||||
|
#define H 600
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
pix_t pix[W * H] = {};
|
||||||
|
img_t img = { .w = W, .h = H, .pix = pix };
|
||||||
|
|
||||||
|
for (unsigned y = 0; y < H; ++y) {
|
||||||
|
for (unsigned x = 0; x < W; ++x) {
|
||||||
|
pix_t *out = pix + (W * y + x);
|
||||||
|
out->r = 0xffff * x / W;
|
||||||
|
out->g = 0;
|
||||||
|
out->b = 0xffff * y / H;
|
||||||
|
out->a = 0xffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ff_write(STDOUT_FILENO, img);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user