Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / png / contrib / libtests / fakepng.c
blobba360d15a2021dea673050207734ebf61d8db085
1 /* Fake a PNG - just write it out directly. */
2 #include <stdio.h>
3 #include <zlib.h> /* for crc32 */
5 void
6 put_uLong(uLong val)
8 putchar(val >> 24);
9 putchar(val >> 16);
10 putchar(val >> 8);
11 putchar(val >> 0);
14 void
15 put_chunk(const unsigned char *chunk, uInt length)
17 uLong crc;
19 put_uLong(length-4); /* Exclude the tag */
21 fwrite(chunk, length, 1, stdout);
23 crc = crc32(0, Z_NULL, 0);
24 put_uLong(crc32(crc, chunk, length));
27 const unsigned char signature[] =
29 137, 80, 78, 71, 13, 10, 26, 10
32 const unsigned char IHDR[] =
34 73, 72, 68, 82, /* IHDR */
35 0, 0, 0, 1, /* width */
36 0, 0, 0, 1, /* height */
37 1, /* bit depth */
38 0, /* color type: greyscale */
39 0, /* compression method */
40 0, /* filter method */
41 0 /* interlace method: none */
44 const unsigned char unknown[] =
46 'u', 'n', 'K', 'n' /* "unKn" - private safe to copy */
49 int
50 main(void)
52 fwrite(signature, sizeof signature, 1, stdout);
53 put_chunk(IHDR, sizeof IHDR);
55 for(;;)
56 put_chunk(unknown, sizeof unknown);