From 154796a8dc091ad545b6d56896b47e324c1471ab Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 29 Sep 2014 13:56:55 +0100 Subject: [PATCH] rename VIPS_ANGLE_0 as VIPS_ANGLE_D0 and other similar cases VIPS_ANGLE_0 becomes Vips.Angle.0 in Python, which is very inconvenient, so we rename ... the D stands for degrees, I think --- ChangeLog | 1 + libvips/conversion/conversion.c | 26 ++++++-- libvips/conversion/rot.c | 12 ++-- libvips/conversion/rot45.c | 20 +++--- libvips/convolution/compass.c | 4 +- libvips/convolution/convsep.c | 2 +- libvips/deprecated/im_vips2dz.c | 2 +- libvips/deprecated/vips7compat.c | 12 ++-- libvips/foreign/dzsave.c | 4 +- libvips/include/vips/conversion.h | 25 ++++--- libvips/iofuncs/enumtypes.c | 24 +++---- python/test_conversion.py | 107 ++++++++++++++++++++++++++++++ python/x.v | Bin 0 -> 125080 bytes tools/vipsthumbnail.c | 12 ++-- 14 files changed, 188 insertions(+), 63 deletions(-) create mode 100644 python/x.v diff --git a/ChangeLog b/ChangeLog index bc236cb7..8843590b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ test_conversion.py - better extra band handling by colour, again - move zoomify ImageProperties file, now a better match to the offical tool +- rename VIPS_ANGLE_180 as VIPS_ANGLE_D180 etc. to help python 8/9/14 started 7.40.10 - icc_import and icc_transform checks the input profile for compatibility diff --git a/libvips/conversion/conversion.c b/libvips/conversion/conversion.c index a4623ae7..99777271 100644 --- a/libvips/conversion/conversion.c +++ b/libvips/conversion/conversion.c @@ -85,10 +85,10 @@ /** * VipsAngle: - * @VIPS_ANGLE_0: no rotate - * @VIPS_ANGLE_90: 90 degrees anti-clockwise - * @VIPS_ANGLE_180: 180 degree rotate - * @VIPS_ANGLE_270: 90 degrees clockwise + * @VIPS_ANGLE_D0: no rotate + * @VIPS_ANGLE_D90: 90 degrees anti-clockwise + * @VIPS_ANGLE_D180: 180 degree rotate + * @VIPS_ANGLE_D270: 90 degrees clockwise * * See vips_rot() and so on. * @@ -97,6 +97,24 @@ * See also: vips_rot(). */ +/** + * VipsAngle45: + * @VIPS_ANGLE45_D0: no rotate + * @VIPS_ANGLE45_D45: 45 degrees anti-clockwise + * @VIPS_ANGLE45_D90: 90 degrees anti-clockwise + * @VIPS_ANGLE45_D135: 135 degrees anti-clockwise + * @VIPS_ANGLE45_D180: 180 degrees + * @VIPS_ANGLE45_D225: 135 degrees clockwise + * @VIPS_ANGLE45_D270: 90 degrees clockwise + * @VIPS_ANGLE45_D315: 45 degrees clockwise + * + * See vips_rot45() and so on. + * + * Fixed rotate angles. + * + * See also: vips_rot45(). + */ + /** * VipsExtend: * @VIPS_EXTEND_BLACK: extend with black (all 0) pixels diff --git a/libvips/conversion/rot.c b/libvips/conversion/rot.c index 49848c50..bb81897f 100644 --- a/libvips/conversion/rot.c +++ b/libvips/conversion/rot.c @@ -288,13 +288,13 @@ vips_rot_build( VipsObject *object ) if( VIPS_OBJECT_CLASS( vips_rot_parent_class )->build( object ) ) return( -1 ); - if( rot->angle == VIPS_ANGLE_0 ) + if( rot->angle == VIPS_ANGLE_D0 ) return( vips_image_write( rot->in, conversion->out ) ); if( vips_image_pio_input( rot->in ) ) return( -1 ); - hint = rot->angle == VIPS_ANGLE_180 ? + hint = rot->angle == VIPS_ANGLE_D180 ? VIPS_DEMAND_STYLE_THINSTRIP : VIPS_DEMAND_STYLE_SMALLTILE; @@ -302,7 +302,7 @@ vips_rot_build( VipsObject *object ) return( -1 ); switch( rot->angle ) { - case VIPS_ANGLE_90: + case VIPS_ANGLE_D90: generate_fn = vips_rot90_gen; conversion->out->Xsize = rot->in->Ysize; conversion->out->Ysize = rot->in->Xsize; @@ -310,13 +310,13 @@ vips_rot_build( VipsObject *object ) conversion->out->Yoffset = 0; break; - case VIPS_ANGLE_180: + case VIPS_ANGLE_D180: generate_fn = vips_rot180_gen; conversion->out->Xoffset = rot->in->Xsize; conversion->out->Yoffset = rot->in->Ysize; break; - case VIPS_ANGLE_270: + case VIPS_ANGLE_D270: generate_fn = vips_rot270_gen; conversion->out->Xsize = rot->in->Ysize; conversion->out->Ysize = rot->in->Xsize; @@ -366,7 +366,7 @@ vips_rot_class_init( VipsRotClass *class ) _( "Angle to rotate image" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsRot, angle ), - VIPS_TYPE_ANGLE, VIPS_ANGLE_90 ); + VIPS_TYPE_ANGLE, VIPS_ANGLE_D90 ); } static void diff --git a/libvips/conversion/rot45.c b/libvips/conversion/rot45.c index 2ac312f6..f3a7bc7e 100644 --- a/libvips/conversion/rot45.c +++ b/libvips/conversion/rot45.c @@ -194,7 +194,7 @@ vips_rot45_build( VipsObject *object ) if( vips_check_oddsquare( class->nickname, rot45->in ) ) return( -1 ); - if( rot45->angle == VIPS_ANGLE45_0 ) + if( rot45->angle == VIPS_ANGLE45_D0 ) return( vips_image_write( rot45->in, conversion->out ) ); if( vips_image_wio_input( rot45->in ) ) @@ -210,31 +210,31 @@ vips_rot45_build( VipsObject *object ) from = rot45->in; switch( rot45->angle ) { - case VIPS_ANGLE45_315: + case VIPS_ANGLE45_D315: vips_rot45_rot45( t[0], from ); from = t[0]; - case VIPS_ANGLE45_270: + case VIPS_ANGLE45_D270: vips_rot45_rot45( t[0], from ); from = t[0]; - case VIPS_ANGLE45_225: + case VIPS_ANGLE45_D225: vips_rot45_rot45( t[0], from ); from = t[0]; - case VIPS_ANGLE45_180: + case VIPS_ANGLE45_D180: vips_rot45_rot45( t[0], from ); from = t[0]; - case VIPS_ANGLE45_135: + case VIPS_ANGLE45_D135: vips_rot45_rot45( t[0], from ); from = t[0]; - case VIPS_ANGLE45_90: + case VIPS_ANGLE45_D90: vips_rot45_rot45( t[0], from ); from = t[0]; - case VIPS_ANGLE45_45: + case VIPS_ANGLE45_D45: vips_rot45_rot45( t[0], from ); break; @@ -278,13 +278,13 @@ vips_rot45_class_init( VipsRot45Class *class ) _( "Angle to rotate image" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsRot45, angle ), - VIPS_TYPE_ANGLE45, VIPS_ANGLE45_45 ); + VIPS_TYPE_ANGLE45, VIPS_ANGLE45_D45 ); } static void vips_rot45_init( VipsRot45 *rot45 ) { - rot45->angle = VIPS_ANGLE45_45; + rot45->angle = VIPS_ANGLE45_D45; } /** diff --git a/libvips/convolution/compass.c b/libvips/convolution/compass.c index 15857f00..938d8815 100644 --- a/libvips/convolution/compass.c +++ b/libvips/convolution/compass.c @@ -160,7 +160,7 @@ vips_compass_class_init( VipsCompassClass *class ) _( "Rotate mask by this much between convolutions" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsCompass, angle ), - VIPS_TYPE_ANGLE45, VIPS_ANGLE45_90 ); + VIPS_TYPE_ANGLE45, VIPS_ANGLE45_D90 ); VIPS_ARG_ENUM( class, "combine", 104, _( "Combine" ), @@ -196,7 +196,7 @@ static void vips_compass_init( VipsCompass *compass ) { compass->times = 2; - compass->angle = VIPS_ANGLE45_90; + compass->angle = VIPS_ANGLE45_D90; compass->combine = VIPS_COMBINE_MAX; compass->precision = VIPS_PRECISION_INTEGER; compass->layers = 5; diff --git a/libvips/convolution/convsep.c b/libvips/convolution/convsep.c index 24317352..dc3ceea2 100644 --- a/libvips/convolution/convsep.c +++ b/libvips/convolution/convsep.c @@ -71,7 +71,7 @@ vips_convsep_build( VipsObject *object ) if( vips_check_separable( class->nickname, convolution->M ) ) return( -1 ); - if( vips_rot( convolution->M, &t[0], VIPS_ANGLE_90, NULL ) || + if( vips_rot( convolution->M, &t[0], VIPS_ANGLE_D90, NULL ) || vips_conv( convolution->in, &t[1], convolution->M, "precision", convsep->precision, "layers", convsep->layers, diff --git a/libvips/deprecated/im_vips2dz.c b/libvips/deprecated/im_vips2dz.c index 15f8b31e..19fbe319 100644 --- a/libvips/deprecated/im_vips2dz.c +++ b/libvips/deprecated/im_vips2dz.c @@ -61,7 +61,7 @@ im_vips2dz( IMAGE *in, const char *filename ) int tile_size = 256; VipsForeignDzDepth depth = VIPS_FOREIGN_DZ_DEPTH_1PIXEL; gboolean centre = FALSE; - VipsAngle angle = VIPS_ANGLE_0; + VipsAngle angle = VIPS_ANGLE_D0; /* We can't use im_filename_split() --- it assumes that we have a * filename with an extension before the ':', and filename here is diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index b686da57..c0442c37 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -1303,7 +1303,7 @@ im_rot90( IMAGE *in, IMAGE *out ) { VipsImage *t; - if( vips_rot( in, &t, VIPS_ANGLE_90, NULL ) ) + if( vips_rot( in, &t, VIPS_ANGLE_D90, NULL ) ) return( -1 ); if( vips_image_write( t, out ) ) { g_object_unref( t ); @@ -1319,7 +1319,7 @@ im_rot180( IMAGE *in, IMAGE *out ) { VipsImage *t; - if( vips_rot( in, &t, VIPS_ANGLE_180, NULL ) ) + if( vips_rot( in, &t, VIPS_ANGLE_D180, NULL ) ) return( -1 ); if( vips_image_write( t, out ) ) { g_object_unref( t ); @@ -1335,7 +1335,7 @@ im_rot270( IMAGE *in, IMAGE *out ) { VipsImage *t; - if( vips_rot( in, &t, VIPS_ANGLE_270, NULL ) ) + if( vips_rot( in, &t, VIPS_ANGLE_D270, NULL ) ) return( -1 ); if( vips_image_write( t, out ) ) { g_object_unref( t ); @@ -2311,7 +2311,7 @@ im_compass( VipsImage *in, VipsImage *out, INTMASK *mask ) return( -1 ); if( vips_compass( in, &t2, t1, "times", 8, - "angle", VIPS_ANGLE45_45, + "angle", VIPS_ANGLE45_D45, NULL ) ) { g_object_unref( t1 ); return( -1 ); @@ -2336,7 +2336,7 @@ im_lindetect( IMAGE *in, IMAGE *out, INTMASK *mask ) return( -1 ); if( vips_compass( in, &t2, t1, "times", 4, - "angle", VIPS_ANGLE45_45, + "angle", VIPS_ANGLE45_D45, NULL ) ) { g_object_unref( t1 ); return( -1 ); @@ -2361,7 +2361,7 @@ im_gradient( IMAGE *in, IMAGE *out, INTMASK *mask ) return( -1 ); if( vips_compass( in, &t2, t1, "times", 2, - "angle", VIPS_ANGLE45_90, + "angle", VIPS_ANGLE45_D90, "combine", VIPS_COMBINE_SUM, NULL ) ) { g_object_unref( t1 ); diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index 7d505602..66504187 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -1961,7 +1961,7 @@ vips_foreign_save_dz_class_init( VipsForeignSaveDzClass *class ) _( "Rotate image during save" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSaveDz, angle ), - VIPS_TYPE_ANGLE, VIPS_ANGLE_0 ); + VIPS_TYPE_ANGLE, VIPS_ANGLE_D0 ); VIPS_ARG_ENUM( class, "container", 15, _( "Container" ), @@ -2020,7 +2020,7 @@ vips_foreign_save_dz_init( VipsForeignSaveDz *dz ) dz->tile_size = 256; dz->tile_count = 0; dz->depth = VIPS_FOREIGN_DZ_DEPTH_1PIXEL; - dz->angle = VIPS_ANGLE_0; + dz->angle = VIPS_ANGLE_D0; dz->container = VIPS_FOREIGN_DZ_CONTAINER_FS; } diff --git a/libvips/include/vips/conversion.h b/libvips/include/vips/conversion.h index bdab50b2..a5a09f65 100644 --- a/libvips/include/vips/conversion.h +++ b/libvips/include/vips/conversion.h @@ -62,22 +62,22 @@ typedef enum { } VipsAlign; typedef enum { - VIPS_ANGLE_0, - VIPS_ANGLE_90, - VIPS_ANGLE_180, - VIPS_ANGLE_270, + VIPS_ANGLE_D0, + VIPS_ANGLE_D90, + VIPS_ANGLE_D180, + VIPS_ANGLE_D270, VIPS_ANGLE_LAST } VipsAngle; typedef enum { - VIPS_ANGLE45_0, - VIPS_ANGLE45_45, - VIPS_ANGLE45_90, - VIPS_ANGLE45_135, - VIPS_ANGLE45_180, - VIPS_ANGLE45_225, - VIPS_ANGLE45_270, - VIPS_ANGLE45_315, + VIPS_ANGLE45_D0, + VIPS_ANGLE45_D45, + VIPS_ANGLE45_D90, + VIPS_ANGLE45_D135, + VIPS_ANGLE45_D180, + VIPS_ANGLE45_D225, + VIPS_ANGLE45_D270, + VIPS_ANGLE45_D315, VIPS_ANGLE45_LAST } VipsAngle45; @@ -189,7 +189,6 @@ int vips_falsecolour( VipsImage *in, VipsImage **out, ... ) int vips_gamma( VipsImage *in, VipsImage **out, ... ) __attribute__((sentinel)); - #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/iofuncs/enumtypes.c b/libvips/iofuncs/enumtypes.c index 69066f76..5e091590 100644 --- a/libvips/iofuncs/enumtypes.c +++ b/libvips/iofuncs/enumtypes.c @@ -228,10 +228,10 @@ vips_angle_get_type( void ) if( etype == 0 ) { static const GEnumValue values[] = { - {VIPS_ANGLE_0, "VIPS_ANGLE_0", "0"}, - {VIPS_ANGLE_90, "VIPS_ANGLE_90", "90"}, - {VIPS_ANGLE_180, "VIPS_ANGLE_180", "180"}, - {VIPS_ANGLE_270, "VIPS_ANGLE_270", "270"}, + {VIPS_ANGLE_D0, "VIPS_ANGLE_D0", "d0"}, + {VIPS_ANGLE_D90, "VIPS_ANGLE_D90", "d90"}, + {VIPS_ANGLE_D180, "VIPS_ANGLE_D180", "d180"}, + {VIPS_ANGLE_D270, "VIPS_ANGLE_D270", "d270"}, {VIPS_ANGLE_LAST, "VIPS_ANGLE_LAST", "last"}, {0, NULL, NULL} }; @@ -248,14 +248,14 @@ vips_angle45_get_type( void ) if( etype == 0 ) { static const GEnumValue values[] = { - {VIPS_ANGLE45_0, "VIPS_ANGLE45_0", "0"}, - {VIPS_ANGLE45_45, "VIPS_ANGLE45_45", "45"}, - {VIPS_ANGLE45_90, "VIPS_ANGLE45_90", "90"}, - {VIPS_ANGLE45_135, "VIPS_ANGLE45_135", "135"}, - {VIPS_ANGLE45_180, "VIPS_ANGLE45_180", "180"}, - {VIPS_ANGLE45_225, "VIPS_ANGLE45_225", "225"}, - {VIPS_ANGLE45_270, "VIPS_ANGLE45_270", "270"}, - {VIPS_ANGLE45_315, "VIPS_ANGLE45_315", "315"}, + {VIPS_ANGLE45_D0, "VIPS_ANGLE45_D0", "d0"}, + {VIPS_ANGLE45_D45, "VIPS_ANGLE45_D45", "d45"}, + {VIPS_ANGLE45_D90, "VIPS_ANGLE45_D90", "d90"}, + {VIPS_ANGLE45_D135, "VIPS_ANGLE45_D135", "d135"}, + {VIPS_ANGLE45_D180, "VIPS_ANGLE45_D180", "d180"}, + {VIPS_ANGLE45_D225, "VIPS_ANGLE45_D225", "d225"}, + {VIPS_ANGLE45_D270, "VIPS_ANGLE45_D270", "d270"}, + {VIPS_ANGLE45_D315, "VIPS_ANGLE45_D315", "d315"}, {VIPS_ANGLE45_LAST, "VIPS_ANGLE45_LAST", "last"}, {0, NULL, NULL} }; diff --git a/python/test_conversion.py b/python/test_conversion.py index c2ea1072..d60cdaa8 100755 --- a/python/test_conversion.py +++ b/python/test_conversion.py @@ -34,6 +34,26 @@ max_value = {Vips.BandFormat.UCHAR: 0xff, Vips.BandFormat.COMPLEX: 1.0, Vips.BandFormat.DPCOMPLEX: 1.0} +sizeof_format = {Vips.BandFormat.UCHAR: 1, + Vips.BandFormat.USHORT: 2, + Vips.BandFormat.UINT: 4, + Vips.BandFormat.CHAR: 1, + Vips.BandFormat.SHORT: 2, + Vips.BandFormat.INT: 4, + Vips.BandFormat.FLOAT: 4, + Vips.BandFormat.DOUBLE: 8, + Vips.BandFormat.COMPLEX: 8, + Vips.BandFormat.DPCOMPLEX: 16} + +rot45_angles = [Vips.Angle45.D0, + Vips.Angle45.D45, + Vips.Angle45.D90, + Vips.Angle45.D135, + Vips.Angle45.D180, + Vips.Angle45.D225, + Vips.Angle45.D270, + Vips.Angle45.D315] + # an expanding zip ... if either of the args is not a list, duplicate it down # the other def zip_expand(x, y): @@ -476,5 +496,92 @@ class TestConversion(unittest.TestCase): a = r.getpoint(r.width - 5, 5) self.assertAlmostEqualObjects(a, [128, 128, 128]) + def test_msb(self): + for fmt in unsigned_formats: + mx = max_value[fmt] + size = sizeof_format[fmt] + test = (self.colour + mx / 8).cast(fmt) + im = test.msb() + + before = test.getpoint(10, 10) + predict = [int(x) >> ((size - 1) * 8) for x in before] + result = im.getpoint(10, 10) + self.assertAlmostEqualObjects(result, predict) + + before = test.getpoint(50, 50) + predict = [int(x) >> ((size - 1) * 8) for x in before] + result = im.getpoint(50, 50) + self.assertAlmostEqualObjects(result, predict) + + for fmt in signed_formats: + mx = max_value[fmt] + size = sizeof_format[fmt] + test = (self.colour + mx / 8).cast(fmt) + im = test.msb() + + before = test.getpoint(10, 10) + predict = [128 + (int(x) >> ((size - 1) * 8)) for x in before] + result = im.getpoint(10, 10) + self.assertAlmostEqualObjects(result, predict) + + before = test.getpoint(50, 50) + predict = [128 + (int(x) >> ((size - 1) * 8)) for x in before] + result = im.getpoint(50, 50) + self.assertAlmostEqualObjects(result, predict) + + for fmt in unsigned_formats: + mx = max_value[fmt] + size = sizeof_format[fmt] + test = (self.colour + mx / 8).cast(fmt) + im = test.msb(band = 1) + + before = [test.getpoint(10, 10)[1]] + predict = [int(x) >> ((size - 1) * 8) for x in before] + result = im.getpoint(10, 10) + self.assertAlmostEqualObjects(result, predict) + + before = [test.getpoint(50, 50)[1]] + predict = [int(x) >> ((size - 1) * 8) for x in before] + result = im.getpoint(50, 50) + self.assertAlmostEqualObjects(result, predict) + + def test_recomb(self): + array = [[0.2, 0.5, 0.3]] + mask = Vips.Image.new_from_array(array) + + def recomb(x): + if isinstance(x, Vips.Image): + return x.recomb(mask) + else: + sum = 0 + for i, c in zip(array[0], x): + sum += i * c + return [sum] + + self.run_unary([self.colour], recomb, fmt = noncomplex_formats) + + def test_replicate(self): + for fmt in all_formats: + im = self.colour.cast(fmt) + + test = im.replicate(10, 10) + self.assertEqual(test.width, self.colour.width * 10) + self.assertEqual(test.height, self.colour.height * 10) + + before = im.getpoint(10, 10) + after = test.getpoint(10 + im.width * 2, 10 + im.width * 2) + self.assertAlmostEqualObjects(before, after) + + before = im.getpoint(50, 50) + after = test.getpoint(50 + im.width * 2, 50 + im.width * 2) + self.assertAlmostEqualObjects(before, after) + + def test_rot45(self): + test = self.colour.crop(0, 0, 51, 51) + for fmt in all_formats: + im = test.cast(fmt) + + im.write_to_file("x.v") + if __name__ == '__main__': unittest.main() diff --git a/python/x.v b/python/x.v new file mode 100644 index 0000000000000000000000000000000000000000..eeaf7cc71ea326f410026eff85796bb3f29efeb4 GIT binary patch literal 125080 zcmeI)!ERJ#7=YnP+$bv-E?l^1dI7CQ6BAS5EM05jzJWm+p(Skv-ElQuf*0l$IA!B` z|0Xq)re&t{kkojfkl{Js`=74^`uAV|eERKTvAFv9WcBfW_3_#2FRq| zA2)uR`lFu?*Pjp9i{aYm*N;y<%uhY^QV+exw6j;9(w6~IDhIf?jM`(Grrz!+XuY< z&fjg{?^@T>d078V@7?`!zalW@%Dy*v=%w?q>*w3L&qtr%`MK}?WY_$iSDm+AKd;P# zd5FN2EBoHyp_k6bZO_kLd;a?Uc7Aq!-*cXH9&US{@Z=eRDOdKH!9y>dkB4^t*f)BA zcYWV54>!+)^RPY-?L2gU-QNgIxw0P)9(w6~jOU@}X?^Th_3-!Q>alJw&Y${?=MNt~ z5twpipBX&#()rl*^JLxUh0pK(wU5=qK30!)dvSi&Z`03D_sji?z?3Wd;oz}ry{vow z`~3D}zp97*svdXU%dVYQe!rbB`)57I-uUpD3*7fSjPvOEIKLZwJo_qhsdA1MK$MdcpV?TWO%mvKD zT;uxtHKWhiljrHpeth`M1s?i5*vIB~+xuhY!8}A@%9Z!)29I@nv5$40#`g#K@R?9 zJ?wAw*tA}@{rvR$J74z6dW^mC;WHN)=V6=|&#$@G_5WUh51+Y!d6;Xg--~^we&hMf zhff5iTzP+N@Yu9o>{p#v?-$j>{!kCS)Z@N;*|hW1>*+k$59=|W7kv241;%+8=f(4P zuC@Nx?>y^w-_L9Q58L1V)B8J~=Y04?V9J&E#|Dp0>&5e{^J;&nhyA=Bda1{K_p)i{ zr`OYYupicAJTLh0nG1~bFwTqT?_A6KW9Gp;%mqI7JlKEccfob0R&4*6}rd(~^ezI%x?ELS%j^{rgK63%{FxR-g zFWt4zuAR?*znwSxXFbN=_-wb&ct1b(pGSB-ohSQYJR(qEFHV-Pp6^}$`DXce|CiNg{96~Hr^l~X-}&Ro#pV9t Zho5-(-_JaHy}UeLeecoX)k}Hu=wASC4J7~o literal 0 HcmV?d00001 diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index 4ed8507e..754c63cd 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -157,16 +157,16 @@ get_angle( VipsImage *im ) VipsAngle angle; const char *orientation; - angle = VIPS_ANGLE_0; + angle = VIPS_ANGLE_D0; if( vips_image_get_typeof( im, ORIENTATION ) && !vips_image_get_string( im, ORIENTATION, &orientation ) ) { if( vips_isprefix( "6", orientation ) ) - angle = VIPS_ANGLE_90; + angle = VIPS_ANGLE_D90; else if( vips_isprefix( "8", orientation ) ) - angle = VIPS_ANGLE_270; + angle = VIPS_ANGLE_D270; else if( vips_isprefix( "3", orientation ) ) - angle = VIPS_ANGLE_180; + angle = VIPS_ANGLE_D180; /* Other values do rotate + mirror, don't bother handling them * though, how common can mirroring be. @@ -194,7 +194,7 @@ calculate_shrink( VipsImage *im, double *residual, VipsInterpolate *interp ) { VipsAngle angle = get_angle( im ); - gboolean rotate = angle == VIPS_ANGLE_90 || angle == VIPS_ANGLE_270; + gboolean rotate = angle == VIPS_ANGLE_D90 || angle == VIPS_ANGLE_D270; int width = rotate_image && rotate ? im->Ysize : im->Xsize; int height = rotate_image && rotate ? im->Xsize : im->Ysize; const int window_size = @@ -667,7 +667,7 @@ thumbnail_rotate( VipsObject *process, VipsImage *im ) VipsAngle angle = get_angle( im ); if( rotate_image && - angle != VIPS_ANGLE_0 ) { + angle != VIPS_ANGLE_D0 ) { /* Need to copy to memory, we have to stay seq. */ t[0] = vips_image_new_memory();