summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gd-test.c32
-rw-r--r--src/gd.mk6
2 files changed, 38 insertions, 0 deletions
diff --git a/src/gd-test.c b/src/gd-test.c
new file mode 100644
index 0000000..2d6be72
--- /dev/null
+++ b/src/gd-test.c
@@ -0,0 +1,32 @@
+/* This file is part of mingw-cross-env. */
+/* See doc/index.html for further information. */
+
+/* modified from /examples/arc.c */
+
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ int cor_rad = 400;
+ im = gdImageCreateTrueColor(400, 400);
+ gdImageFilledRectangle(im, 0, 0, 399, 399, 0x00FFFFFF);
+
+ gdImageFilledArc(im, cor_rad, 399 - cor_rad, cor_rad * 2, cor_rad * 2, 90, 180, 0x0, gdPie);
+
+ fp = fopen("test-gd.png", "wb");
+ if (!fp) {
+ fprintf(stderr, "Can't save png image.\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImagePng(im, fp);
+ fclose(fp);
+
+ fprintf(stdout, "test-gd.png created\n");
+ gdImageDestroy(im);
+ return 0;
+}
diff --git a/src/gd.mk b/src/gd.mk
index ffb474a..4095973 100644
--- a/src/gd.mk
+++ b/src/gd.mk
@@ -36,4 +36,10 @@ define $(PKG)_BUILD
CFLAGS='-DNONDLL -DXMD_H -L$(PREFIX)/$(TARGET)/lib' \
LIBS="`$(PREFIX)/$(TARGET)/bin/xml2-config --libs`"
$(MAKE) -C '$(1)' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS=
+
+ '$(TARGET)-gcc' \
+ -W -Wall -Werror -ansi -pedantic \
+ '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-gd.exe' \
+ `'$(PREFIX)/$(TARGET)/bin/gdlib-config' --cflags` \
+ -lgd `'$(PREFIX)/$(TARGET)/bin/gdlib-config' --libs`
endef