fix examples build

master
Pierre Joye 2013-04-04 16:45:13 +02:00
parent 6007934aa4
commit 1aa7ad8d26
4 changed files with 23 additions and 4 deletions

View File

@ -19,7 +19,11 @@ int main()
gdImageDestroy(im);
return 1;
}
#ifdef HAVE_LIBPNG
gdImagePng(im, fp);
#else
printf("No PNG support. Cannot save image.\n");
#endif
fclose(fp);
gdImageDestroy(im);

View File

@ -12,7 +12,11 @@ void save_png(gdImagePtr im, const char *filename)
fprintf(stderr, "Can't save png image %s\n", filename);
return;
}
#ifdef HAVE_LIBPNG
gdImagePng(im, fp);
#else
printf("No PNG support. Cannot save image.\n");
#endif
fclose(fp);
}
@ -26,7 +30,11 @@ gdImagePtr read_png(const char *filename)
fprintf(stderr, "Can't read png image %s\n", filename);
return NULL;
}
#ifdef HAVE_LIBPNG
im = gdImageCreateFromPng(fp);
#else
printf("No PNG support. Cannot read image.\n");
#endif
fclose(fp);
return im;
}
@ -46,7 +54,7 @@ int main()
gdImageRectangle(im, 19, 29, 390, 390, 0xFF0000);
save_png(im, "a1.png");
im2 = gdImageAutoCrop(im, GD_CROP_SIDES);
im2 = gdImageCropAuto(im, GD_CROP_SIDES);
if (im2) {
save_png(im2, "a2.png");
gdImageDestroy(im2);
@ -58,7 +66,7 @@ int main()
return 1;
}
im2 = gdImageThresholdCrop(im, 0xFFFFFF, 0.6);
im2 = gdImageCropThreshold(im, 0xFFFFFF, 0.6);
if (im2) {
save_png(im2, "a4.png");
gdImageDestroy(im2);

View File

@ -12,7 +12,11 @@ void save_png(gdImagePtr im, const char *filename)
fprintf(stderr, "Can't save png image %s\n", filename);
return;
}
#ifdef HAVE_LIBPNG
gdImagePng(im, fp);
#else
printf("No PNG support. Cannot save image.\n");
#endif
fclose(fp);
}

View File

@ -44,8 +44,11 @@ int main()
gdImageDestroy(im);
return 1;
}
gdImagePng(im, fp);
#ifdef HAVE_LIBPNG
gdImagePng(im, fp);
#else
printf("No PNG support. Cannot save image.\n");
#endif
fclose(fp);
gdImageDestroy(im);
}