summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2013-04-04 16:45:13 +0200
committerPierre Joye <pierre.php@gmail.com>2013-04-04 16:45:13 +0200
commit1aa7ad8d2698f0978f83d70c1882a6d548edb41d (patch)
tree4e742ecd3d01a7e1909e302469d1971dba98ed27 /examples
parent6007934aa4328933a6702d9e3584eeb6c6e613a3 (diff)
downloadlibgd-1aa7ad8d2698f0978f83d70c1882a6d548edb41d.tar.gz
fix examples build
Diffstat (limited to 'examples')
-rw-r--r--examples/arc.c4
-rw-r--r--examples/crop.c12
-rw-r--r--examples/nnquant.c4
-rw-r--r--examples/tgaread.c7
4 files changed, 23 insertions, 4 deletions
diff --git a/examples/arc.c b/examples/arc.c
index ae3fcfd..8e86283 100644
--- a/examples/arc.c
+++ b/examples/arc.c
@@ -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);
diff --git a/examples/crop.c b/examples/crop.c
index e12ea1f..0eb4182 100644
--- a/examples/crop.c
+++ b/examples/crop.c
@@ -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);
diff --git a/examples/nnquant.c b/examples/nnquant.c
index c5f452d..33ed523 100644
--- a/examples/nnquant.c
+++ b/examples/nnquant.c
@@ -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);
}
diff --git a/examples/tgaread.c b/examples/tgaread.c
index 018a3d4..a8e0807 100644
--- a/examples/tgaread.c
+++ b/examples/tgaread.c
@@ -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);
}