From 70ae9f77510548253927e4e57127c8181db2c580 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 21 Sep 2009 16:19:23 +0000 Subject: [PATCH] move affine/similarity to deprecated --- TODO | 2 +- libvips/deprecated/rename.c | 20 ++++++ libvips/resample/Makefile.am | 1 - libvips/resample/similarity.c | 122 ---------------------------------- 4 files changed, 21 insertions(+), 124 deletions(-) delete mode 100644 libvips/resample/similarity.c diff --git a/TODO b/TODO index cafc6c5f..de78259f 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,7 @@ im_remainderconst_vec -- move resample / im_affine, im_similarity, im_similarity_area to deprecated +- have a -DIM_ENABLE_DEPRECATED option which includes deprecated.h for you - we have tools/ and contrib/ argh diff --git a/libvips/deprecated/rename.c b/libvips/deprecated/rename.c index 5c6a786d..760954db 100644 --- a/libvips/deprecated/rename.c +++ b/libvips/deprecated/rename.c @@ -139,3 +139,23 @@ im_affine( IMAGE *in, IMAGE *out, a, b, c, d, dx, dy, ox, oy, ow, oh ) ); } + +int +im_similarity_area( IMAGE *in, IMAGE *out, + double a, double b, double dx, double dy, + int ox, int oy, int ow, int oh ) +{ + return( im_affinei( in, out, + vips_interpolate_bilinear_static(), + a, -b, b, a, dx, dy, + ox, oy, ow, oh ) ); +} + +int +im_similarity( IMAGE *in, IMAGE *out, + double a, double b, double dx, double dy ) +{ + return( im_affinei_all( in, out, + vips_interpolate_bilinear_static(), + a, -b, b, a, dx, dy ) ); +} diff --git a/libvips/resample/Makefile.am b/libvips/resample/Makefile.am index e041942c..3190354e 100644 --- a/libvips/resample/Makefile.am +++ b/libvips/resample/Makefile.am @@ -3,7 +3,6 @@ noinst_LTLIBRARIES = libresample.la libresample_la_SOURCES = \ im_affine.c \ bicubic.cpp \ - similarity.c \ interpolate.c \ yafrsmooth.cpp \ nohalo1.cpp \ diff --git a/libvips/resample/similarity.c b/libvips/resample/similarity.c deleted file mode 100644 index f50d1bd0..00000000 --- a/libvips/resample/similarity.c +++ /dev/null @@ -1,122 +0,0 @@ -/* @(#) im_similarity_area() ... similarity transform. Like affine, but - * @(#) rotate/scale only. - * @(#) - * @(#) int im_similarity_area(in, out, a, b, dx, dy, w, h, x, y) - * @(#) IMAGE *in, *out; - * @(#) double a, b, dx, dy; - * @(#) int w, h, x, y; - * @(#) - * @(#) Forward transform - * @(#) X = a * x - b * y + dx - * @(#) Y = b * x + a * y + dy - * @(#) - * @(#) x and y are the coordinates in input image. - * @(#) X and Y are the coordinates in output image. - * @(#) (0,0) is the upper left corner. - * @(#) - * @(#) a and b DO NOT correspond to scale and angle directly - * @(#) - * @(#) scale = sqrt(a*a + b*b) , angle = arctan(a/b) - * @(#) - * @(#) im_similarity_area() returns 0 on success and -1 on error - * @(#) - * - * 3/3/98 JC - * - redone as wrapper for im_affine(), compatibility only - * 8/4/04 - * - transform rounding redone as part of the new im_embed thing - */ - -/* - - This file is part of VIPS. - - VIPS is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - */ - -/* - - These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk - - */ - -#ifdef HAVE_CONFIG_H -#include -#endif /*HAVE_CONFIG_H*/ -#include - -#include -#include -#include -#include - -#include -#include - -#ifdef WITH_DMALLOC -#include -#endif /*WITH_DMALLOC*/ - -int -im_similarity_area( IMAGE *in, IMAGE *out, - double a, double b, double dx, double dy, - int ox, int oy, int ow, int oh ) -{ - Transformation trn; - - trn.oarea.left = ox; - trn.oarea.top = oy; - trn.oarea.width = ow; - trn.oarea.height = oh; - trn.iarea.left = 0; - trn.iarea.top = 0; - trn.iarea.width = in->Xsize; - trn.iarea.height = in->Ysize; - trn.a = a; - trn.b = -b; - trn.c = b; - trn.d = a; - trn.dx = dx; - trn.dy = dy; - - return( im__affine( in, out, &trn ) ); -} - -/* Output the rect holding all our input PELs. - */ -int -im_similarity( IMAGE *in, IMAGE *out, - double a, double b, double dx, double dy ) -{ - Transformation trn; - - trn.iarea.left = 0; - trn.iarea.top = 0; - trn.iarea.width = in->Xsize; - trn.iarea.height = in->Ysize; - trn.a = a; - trn.b = -b; - trn.c = b; - trn.d = a; - trn.dx = dx; - trn.dy = dy; - im__transform_set_area( &trn ); - - if( im__affine( in, out, &trn ) ) - return( -1 ); - - return( 0 ); -}