| 1 |
#include "gd.h" |
| 2 |
#include <stdio.h> |
| 3 |
#include <stdlib.h> |
| 4 |
|
| 5 |
int main() |
| 6 |
{ |
| 7 |
gdImagePtr im; |
| 8 |
FILE *fp; |
| 9 |
int cor_rad = 60; |
| 10 |
im = gdImageCreateTrueColor(400, 400); |
| 11 |
gdImageFilledRectangle(im, 0, 0, 399, 399, 0x00FFFFFF); |
| 12 |
|
| 13 |
gdImageFilledArc (im, cor_rad, 399 - cor_rad, cor_rad *2, cor_rad *2, 90, 180, 0x0, gdPie); |
| 14 |
|
| 15 |
fp = fopen("b.png", "wb"); |
| 16 |
if (!fp) { |
| 17 |
fprintf(stderr, "Can't save png image.\n"); |
| 18 |
gdImageDestroy(im); |
| 19 |
return 1; |
| 20 |
} |
| 21 |
gdImagePng(im, fp); |
| 22 |
fclose(fp); |
| 23 |
|
| 24 |
gdImageDestroy(im); |
| 25 |
return 0; |
| 26 |
} |