Mercurial > mxe-octave
changeset 1092:5e21272e05c9
test program for package gd (by Tony Theodore)
author | Volker Grabsch <vog@notjusthosting.com> |
---|---|
date | Fri, 16 Jul 2010 18:33:15 +0200 |
parents | e9bb636f650d |
children | 882e5ce487fb |
files | src/gd-test.c src/gd.mk |
diffstat | 2 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gd-test.c Fri Jul 16 18:33:15 2010 +0200 @@ -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; +}
--- a/src/gd.mk Fri Jul 16 18:21:50 2010 +0200 +++ b/src/gd.mk Fri Jul 16 18:33:15 2010 +0200 @@ -36,4 +36,10 @@ 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