diff --git a/libvips/conversion/im_rot180.c b/libvips/conversion/im_rot180.c index 924e5361..ebd52218 100644 --- a/libvips/conversion/im_rot180.c +++ b/libvips/conversion/im_rot180.c @@ -1,10 +1,5 @@ -/* @(#) rotates an image 180 degrees - * @(#) Usage: - * @(#) im_rot180(in, out) - * @(#) IMAGE *in, *out; - * @(#) - * @(#) Returns 0 on sucess and -1 on error - * @(#) +/* im_rot180 + * * Copyright: 1991, N. Dessipris * Written on: 28/10/91 * Updated on: 2/4/92, J.Cupitt @@ -25,6 +20,9 @@ * - sets Xoffset / Yoffset * 24/3/09 * - added IM_CODING_RAD support + * 1/2/10 + * - cleanups + * - gtkdoc */ /* @@ -68,8 +66,6 @@ #include #endif /*WITH_DMALLOC*/ -/* Rotate a small piece. - */ static int rot180_gen( REGION *or, void *seq, void *a, void *b ) { @@ -130,30 +126,28 @@ rot180_gen( REGION *or, void *seq, void *a, void *b ) return( 0 ); } +/** + * im_rot180: + * @in: input image + * @out: output image + * + * Rotate an image 180 degrees. + * + * See also: im_rot90(), im_rot270(), im_affinei_all(). + * + * Returns: 0 on success, -1 on error + */ int im_rot180( IMAGE *in, IMAGE *out ) -{ - /* Make output image. - */ - if( im_piocheck( in, out ) ) - return( -1 ); - if( in->Coding != IM_CODING_NONE && - in->Coding != IM_CODING_LABQ && - in->Coding != IM_CODING_RAD ) { - im_error( "im_rot180", "%s", - _( "Coding should be NONE, LABQ or RAD" ) ); - return( -1 ); - } - if( im_cp_desc( out, in ) ) +{ + if( im_piocheck( in, out ) || + im_check_coding_known( "im_rot180", in ) ) return( -1 ); - /* We are fastest with thinstrip. - */ - if( im_demand_hint( out, IM_THINSTRIP, in, NULL ) ) + if( im_cp_desc( out, in ) || + im_demand_hint( out, IM_THINSTRIP, in, NULL ) ) return( -1 ); - /* Generate! - */ if( im_generate( out, im_start_one, rot180_gen, im_stop_one, in, NULL ) ) return( -1 ); diff --git a/libvips/conversion/im_rot270.c b/libvips/conversion/im_rot270.c index a1487748..2bc619db 100644 --- a/libvips/conversion/im_rot270.c +++ b/libvips/conversion/im_rot270.c @@ -1,10 +1,5 @@ -/* @(#) rotates an image 270 degrees - * @(#) Usage: - * @(#) im_rot270(in, out) - * @(#) IMAGE *in, *out; - * @(#) - * @(#) Returns 0 on sucess and -1 on error - * @(#) +/* im_rot270 + * * Copyright: 1991, N. Dessipris * Written on: 28/10/91 * Updated on: 2/4/92, J.Cupitt @@ -26,6 +21,9 @@ * - sets Xoffset / Yoffset * 24/3/09 * - added IM_CODING_RAD support + * 1/2/10 + * - cleanups + * - gtkdoc */ /* @@ -132,32 +130,30 @@ rot270_gen( REGION *or, void *seq, void *a, void *b ) return( 0 ); } +/** + * im_rot270: + * @in: input image + * @out: output image + * + * Rotate an image 270 degrees. + * + * See also: im_rot180(), im_rot90(), im_affinei_all(). + * + * Returns: 0 on success, -1 on error + */ int im_rot270( IMAGE *in, IMAGE *out ) { - /* Make output image. - */ - if( im_piocheck( in, out ) ) + if( im_piocheck( in, out ) || + im_check_coding_known( "im_rot270", in ) ) return( -1 ); - if( in->Coding != IM_CODING_NONE && - in->Coding != IM_CODING_LABQ && - in->Coding != IM_CODING_RAD ) { - im_error( "im_rot270", "%s", - _( "Coding should be NONE, LABQ or RAD" ) ); - return( -1 ); - } - if( im_cp_desc( out, in ) ) + + if( im_cp_desc( out, in ) || + im_demand_hint( out, IM_SMALLTILE, in, NULL ) ) return( -1 ); out->Xsize = in->Ysize; out->Ysize = in->Xsize; - /* We want smalltile if possible. - */ - if( im_demand_hint( out, IM_SMALLTILE, in, NULL ) ) - return( -1 ); - - /* Generate! - */ if( im_generate( out, im_start_one, rot270_gen, im_stop_one, in, NULL ) ) return( -1 ); diff --git a/libvips/conversion/im_rot90.c b/libvips/conversion/im_rot90.c index 0a441ba4..b9d94a7f 100644 --- a/libvips/conversion/im_rot90.c +++ b/libvips/conversion/im_rot90.c @@ -1,10 +1,5 @@ -/* @(#) rotates an image 90 degrees - * @(#) Usage: - * @(#) im_rot90(in, out) - * @(#) IMAGE *in, *out; - * @(#) - * @(#) Returns 0 on sucess and -1 on error - * @(#) +/* im_rot90 + * * Copyright: 1991, N. Dessipris * Written on: 28/10/91 * Updated on: 2/4/92, J.Cupitt @@ -26,6 +21,9 @@ * - sets Xoffset / Yoffset * 24/3/09 * - added IM_CODING_RAD support + * 1/2/10 + * - cleanups + * - gtkdoc */ /* @@ -132,32 +130,30 @@ rot90_gen( REGION *or, void *seq, void *a, void *b ) return( 0 ); } +/** + * im_rot90: + * @in: input image + * @out: output image + * + * Rotate an image 90 degrees. + * + * See also: im_rot180(), im_rot270(), im_affinei_all(). + * + * Returns: 0 on success, -1 on error + */ int im_rot90( IMAGE *in, IMAGE *out ) { - /* Make output image. - */ - if( im_piocheck( in, out ) ) + if( im_piocheck( in, out ) || + im_check_coding_known( "im_rot90", in ) ) return( -1 ); - if( in->Coding != IM_CODING_NONE && - in->Coding != IM_CODING_LABQ && - in->Coding != IM_CODING_RAD ) { - im_error( "im_rot90", "%s", - _( "Coding should be NONE, LABQ or RAD" ) ); - return( -1 ); - } - if( im_cp_desc( out, in ) ) + + if( im_cp_desc( out, in ) || + im_demand_hint( out, IM_SMALLTILE, in, NULL ) ) return( -1 ); out->Xsize = in->Ysize; out->Ysize = in->Xsize; - /* We want smalltile if possible. - */ - if( im_demand_hint( out, IM_SMALLTILE, in, NULL ) ) - return( -1 ); - - /* Generate! - */ if( im_generate( out, im_start_one, rot90_gen, im_stop_one, in, NULL ) ) return( -1 );