Mercurial > mxe-octave
annotate src/gd-test.c @ 2333:f653602a0500
Rebrand to new project name MXE
author | Volker Grabsch <vog@notjusthosting.com> |
---|---|
date | Wed, 28 Mar 2012 15:46:58 +0200 |
parents | fef4b120bc3a |
children | 8a6c466753e2 |
rev | line source |
---|---|
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
1280
diff
changeset
|
1 /* This file is part of MXE. */ |
1092
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
2 /* See doc/index.html for further information. */ |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
3 |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
4 /* modified from /examples/arc.c */ |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
5 |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
6 #include "gd.h" |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
7 #include <stdio.h> |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
8 #include <stdlib.h> |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
9 |
1280
fef4b120bc3a
improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents:
1092
diff
changeset
|
10 int main(int argc, char *argv[]) |
1092
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
11 { |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
12 gdImagePtr im; |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
13 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
|
14 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
|
15 |
fef4b120bc3a
improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents:
1092
diff
changeset
|
16 (void)argc; |
fef4b120bc3a
improved coding style of the examples of packages gd and sdl_sound
Volker Grabsch <vog@notjusthosting.com>
parents:
1092
diff
changeset
|
17 (void)argv; |
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 cor_rad = 400; |
1092
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
20 im = gdImageCreateTrueColor(400, 400); |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
21 gdImageFilledRectangle(im, 0, 0, 399, 399, 0x00FFFFFF); |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
22 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
|
23 |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
24 fp = fopen("test-gd.png", "wb"); |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
25 if (!fp) { |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
26 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
|
27 gdImageDestroy(im); |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
28 return 1; |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
29 } |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
30 gdImagePng(im, fp); |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
31 fclose(fp); |
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 fprintf(stdout, "test-gd.png created\n"); |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
34 gdImageDestroy(im); |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
35 return 0; |
5e21272e05c9
test program for package gd (by Tony Theodore)
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
36 } |