diff options
author | pajoye <none@none> | 2008-03-14 21:39:13 +0000 |
---|---|---|
committer | pajoye <none@none> | 2008-03-14 21:39:13 +0000 |
commit | 67c1ccbd4d06900f361d30aa64188be4763b1132 (patch) | |
tree | a32e61796eebdf9a9bc949d8f2b1b036f8aaf133 | |
parent | a9b03ad5e4163cbbba2afd299c31bb190a1a55bb (diff) | |
download | libgd-67c1ccbd4d06900f361d30aa64188be4763b1132.tar.gz |
- add arc example
-rw-r--r-- | examples/arc.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/arc.c b/examples/arc.c new file mode 100644 index 0000000..fb0d507 --- /dev/null +++ b/examples/arc.c @@ -0,0 +1,29 @@ +/* $Id$ */ +#include "gd.h" +#include <stdio.h> +#include <stdlib.h> + +int main() +{ + gdImagePtr im, im2; + FILE *fp; + char path[2048]; + int i; + char dst[2048]; + int cor_rad = 60; + 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("b.png", "wb"); + if (!fp) { + fprintf(stderr, "Can't save png image.\n"); + gdImageDestroy(im); + return 1; + } + gdImagePng(im, fp); + fclose(fp); + + gdImageDestroy(im); +} |