im_*join() gtkdoc

This commit is contained in:
John Cupitt 2010-02-01 10:58:18 +00:00
parent d0e2867674
commit f753f66e9c
3 changed files with 66 additions and 36 deletions

View File

@ -31,6 +31,7 @@
- im_check*() name rationalisation
- finally removed old flood stuff
- im_insert*() bandalike and formatalike
- im_*join() bandalike and formatalike
26/11/09 started 7.20.3
- updated en_GB.po translation

View File

@ -1,12 +1,4 @@
/* @(#) To join two images left right. The resultant image has
* @(#) Xsize = im1.Xsize + im2.Xsize and Ysize the min of im1.Ysize, im2.Ysize
* @(#) Input images should have the same number of Bands and BandFmt
* @(#)
* @(#) Usage:
* @(#) int im_lrjoin( IMAGE *left, IMAGE *right, IMAGE *out)
* @(#) IMAGE *left, *right, *out;
* @(#)
* @(#)
/* im_lrjoin
*
* Copyright 1990, 1991: Kirk Martinez, N. Dessipris
* Author: Kirk Martinez, N. Dessipris
@ -24,6 +16,9 @@
* - rewritten in terms of im_insert()
* 14/4/04
* - sets Xoffset / Yoffset
* 1/2/10
* - gtkdoc
* - cleanups
*/
/*
@ -66,20 +61,40 @@
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
/**
* im_lrjoin:
* @left: image to go on left
* @right: image to go on right
* @out: output image
*
* Join @left and @right together, left-right. If one is taller than the
* other, @out will be has high as the smaller.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>).
*
* See also: im_insert(), im_tbjoin().
*
* Returns: 0 on success, -1 on error
*/
int
im_lrjoin( IMAGE *left, IMAGE *right, IMAGE *out )
{
IMAGE *t1 = im_open_local( out, "im_lrjoin:1", "p" );
IMAGE *t1;
/* Paste right and left together.
/* Paste right and left together, trim the bottom edge.
*/
if( !t1 || im_insert( left, right, t1, left->Xsize, 0 ) )
return( -1 );
/* Extract the part which the old im_lrjoin() would have made.
*/
if( im_extract_area( t1, out,
0, 0, t1->Xsize, IM_MIN( left->Ysize, right->Ysize ) ) )
if( !(t1 = im_open_local( out, "im_lrjoin:1", "p" )) ||
im_insert( left, right, t1, left->Xsize, 0 ) ||
im_extract_area( t1, out,
0, 0, t1->Xsize, IM_MIN( left->Ysize, right->Ysize ) ) )
return( -1 );
out->Xoffset = left->Xsize;

View File

@ -1,12 +1,4 @@
/* @(#) To join two images top bottom. The resultant image has
* @(#) Ysize = im1.Ysize + im2.Ysize and Xsize the min of im1.Xsize, im2.Xsize
* @(#) Input images should have the same number of Bands and BandFmt
* @(#)
* @(#) Usage:
* @(#) int im_tbjoin(top, bottom, out)
* @(#) IMAGE *top, *bottom, *out;
* @(#)
* @(#)
/* im_tbjoin
*
* Copyright: 1990, 1991 Kirk Martinez, N. Dessipris
* Author: Kirk Martinez, N. Dessipris
@ -24,6 +16,9 @@
* - rewritten in terms of im_insert()
* 14/4/04
* - sets Xoffset / Yoffset
* 1/2/10
* - gtkdoc
* - cleanups
*/
/*
@ -66,20 +61,39 @@
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
/**
* im_tbjoin:
* @top: image to go on top
* @bottom: image to go on bottom
* @out: output image
*
* Join @top and @bottom together, up-down. If one is wider than the
* other, @out will be has wide as the smaller.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>).
*
* See also: im_insert(), im_tbjoin().
*
* Returns: 0 on success, -1 on error
*/
int
im_tbjoin( IMAGE *top, IMAGE *bottom, IMAGE *out )
{
IMAGE *t1 = im_open_local( out, "im_tbjoin:1", "p" );
IMAGE *t1;
/* Paste top and bottom together.
/* Paste top and bottom together, cut off any leftovers.
*/
if( !t1 || im_insert( top, bottom, t1, 0, top->Ysize ) )
return( -1 );
/* Extract the part which the old im_tbjoin() would have made.
*/
if( im_extract_area( t1, out,
0, 0, IM_MIN( top->Xsize, bottom->Xsize ), t1->Ysize ) )
if( !(t1 = im_open_local( out, "im_tbjoin:1", "p" )) ||
im_insert( top, bottom, t1, 0, top->Ysize ) ||
im_extract_area( t1, out,
0, 0, IM_MIN( top->Xsize, bottom->Xsize ), t1->Ysize ) )
return( -1 );
out->Xoffset = 0;