From 60dea0643da9e423ba3f1e29a7e8492bfde32996 Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 28 Jul 2008 23:01:25 +0000 Subject: [PATCH] * Add a blur example. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2604 92316355-f0b4-4df1-b90c-862c8a59935f --- .gitignore | 1 + examples/Makefile.am | 5 ++++- examples/blur.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 examples/blur.c diff --git a/.gitignore b/.gitignore index a16877a..7164dd3 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ Makefile libtool pipi/pipi.pc genethumb/genethumb +examples/blur examples/img2rubik stamp-h1 .auto diff --git a/examples/Makefile.am b/examples/Makefile.am index 8ccef3d..e9737d3 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -2,7 +2,10 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/pipi -bin_PROGRAMS = img2rubik +bin_PROGRAMS = img2rubik blur + +blur_SOURCES = blur.c +blur_LDADD = ../pipi/libpipi.la img2rubik_SOURCES = img2rubik.c img2rubik_LDADD = ../pipi/libpipi.la diff --git a/examples/blur.c b/examples/blur.c new file mode 100644 index 0000000..d90d355 --- /dev/null +++ b/examples/blur.c @@ -0,0 +1,34 @@ +#include "config.h" +#include "common.h" + +#include +#include +#include + +#include + +int main(int argc, char *argv[]) +{ + char *srcname = NULL, *dstname = NULL; + pipi_image_t *img, *newimg; + + if(argc < 3) + { + fprintf(stderr, "%s: too few arguments\n", argv[0]); + fprintf(stderr, "Usage: %s \n", argv[0]); + return EXIT_FAILURE; + } + + srcname = argv[1]; + dstname = argv[3]; + + img = pipi_load(srcname); + newimg = pipi_gaussian_blur(img, atof(argv[2])); + pipi_free(img); + + pipi_save(newimg, dstname); + pipi_free(newimg); + + return 0; +} +