test program for package gd (by Tony Theodore)

This commit is contained in:
Volker Grabsch 2010-07-16 18:33:15 +02:00
parent 3b6d4a1d38
commit 418bbeb8b9
2 changed files with 38 additions and 0 deletions

32
src/gd-test.c Normal file
View File

@ -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;
}

View File

@ -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