2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-12-01 22:16:27 +00:00
rules_foreign_cc/examples/configure_gnuplot/arc.c
irengrig 29f66a98cd
Correct bugs and make configure-make work on MacOS (#108)
* correct shell utilities: params differ on mac, remove debug print,

+ correct a bug on windows

* Simplify the example, libz is also needed by libgd

* Framework function: simplify code gathering deps, collect_libs public

* Correct configure-make: get all lib files, also built with bazel

and pass them in LDFLAGS; correct the linking paths (add prefix)

* Make maximum line length for shell = 80

* Improve comments to the _InputFiles provider
2018-09-20 20:19:38 +02:00

30 lines
627 B
C

/* Copied from https://github.com/libgd/libgd/blob/master/examples/arc.c for test */
/* $Id$ */
#include "gd.h"
#include <stdio.h>
#include <stdlib.h>
int main()
{
gdImagePtr im;
FILE *fp;
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);
fprintf(stdout, "Success.\n");
return 0;
}