annotate src/gd-test.c @ 5534:372ea4c0afb2

Move of-ocs PKG_XXXX to inst dir and add break patch * src/of-ocs-3-break-fixes.patch, src/of-ocs-4-pkgadd-fixes.patch: new files * dist-files.mk: add ref to files
author John Donoghue <john.donoghue@ieee.org>
date Sun, 13 Sep 2020 08:15:14 -0400
parents 99516e73b368
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2351
8a6c466753e2 Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents: 2333
diff changeset
1 /*
8a6c466753e2 Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents: 2333
diff changeset
2 * This file is part of MXE.
2353
99516e73b368 Move doc/index.html -> index.html
Volker Grabsch <vog@notjusthosting.com>
parents: 2351
diff changeset
3 * See index.html for further information.
2351
8a6c466753e2 Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents: 2333
diff changeset
4 *
8a6c466753e2 Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents: 2333
diff changeset
5 * This is a slightly modified version of:
8a6c466753e2 Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents: 2333
diff changeset
6 * examples/arc.c
8a6c466753e2 Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents: 2333
diff changeset
7 */
1092
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
8
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
9 #include "gd.h"
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
10 #include <stdio.h>
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
11 #include <stdlib.h>
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
12
1280
fef4b120bc3a improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents: 1092
diff changeset
13 int main(int argc, char *argv[])
1092
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
14 {
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
15 gdImagePtr im;
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
16 FILE *fp;
1280
fef4b120bc3a improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents: 1092
diff changeset
17 int cor_rad;
fef4b120bc3a improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents: 1092
diff changeset
18
fef4b120bc3a improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents: 1092
diff changeset
19 (void)argc;
fef4b120bc3a improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents: 1092
diff changeset
20 (void)argv;
fef4b120bc3a improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents: 1092
diff changeset
21
fef4b120bc3a improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents: 1092
diff changeset
22 cor_rad = 400;
1092
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
23 im = gdImageCreateTrueColor(400, 400);
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
24 gdImageFilledRectangle(im, 0, 0, 399, 399, 0x00FFFFFF);
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
25 gdImageFilledArc(im, cor_rad, 399 - cor_rad, cor_rad * 2, cor_rad * 2, 90, 180, 0x0, gdPie);
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
26
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
27 fp = fopen("test-gd.png", "wb");
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
28 if (!fp) {
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
29 fprintf(stderr, "Can't save png image.\n");
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
30 gdImageDestroy(im);
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
31 return 1;
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
32 }
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
33 gdImagePng(im, fp);
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
34 fclose(fp);
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
35
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
36 fprintf(stdout, "test-gd.png created\n");
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
37 gdImageDestroy(im);
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
38 return 0;
5e21272e05c9 test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
39 }