blend does sizealike

added sizealike to im_blend()
This commit is contained in:
John Cupitt 2011-06-27 12:28:10 +01:00
parent 53492613bd
commit 180fa919e2
4 changed files with 27 additions and 43 deletions

View File

@ -67,6 +67,7 @@
- bumped smalltile to 512x512 for testing
- added VipsPool, got rid of floating refs again, argh
- VIPS_EXEEXT is now part of the exported API
- im_blend() also does sizealike, oops
30/11/10 started 7.24.0
- bump for new stable

30
TODO
View File

@ -266,51 +266,21 @@ g++ -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crti.o
also a mail from Martin Breidt has links to several fast free C
implementations
- try making vips_add(), an operator as a class
- need a section for vipsobject in the tutorial
also a manpage?
not really stable yet :( don't document
- how to expose things like snohalo1's "blur" parameter to
C++/Python?
can we write a find-by-nickname function? eg.
GType vips_get_type (const char *base, const char *nickname)
then
vips_get_type ("VipsInterpolator", "bicubic")
would get us the GType for VipsInterpolatorBicubic
- we shouldn't need to call im_invalidate() in gtkdisp4 :( how can we fix
this?
- we should wrap the format API, also im_render*(), see gtkdisp.cc for sample
code
- have a base VObject class and put the ref stuff in there ... share between
VMask, VDisplay, VImage
- need an im_init_world() for C++ which does cmd-line args too, so C++ progs
can get --vips-progress and stuff automatically
- more cleanups to the handling of vips format images, esp. we have vips write
spread across many files atm
- could remove a lot of crappy old API
- try
libsrc/convolution$ grep -l offsets *.c
could we do the don't calc offsets thing unless bpl; changes thing in more
places?
- unsharp should work on GREY16? should be easy to add GREY16->LABS
no, labs is signed short, ranges are all differrent, and the scaling will be

View File

@ -10,6 +10,8 @@
* - use im_check*()
* - allow many-band conditional and single-band a/b
* - allow a/b to differ in format and bands
* 27/6/11
* - sizealike as well
*/
/*
@ -295,6 +297,8 @@ blend( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out )
im_check_format_same( "im_blend", a, b ) ||
im_check_bands_same( "im_blend", a, b ) ||
im_check_bands_1orn( "im_blend", c, a ) ||
im_check_size_same( "im_blend", a, b ) ||
im_check_size_same( "im_blend", a, c ) ||
im_piocheck( c, out ) ||
im_pincheck( a ) ||
im_pincheck( b ) )
@ -328,13 +332,14 @@ blend( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out )
* image @b. 255 means @a only, 0 means @b only, and intermediate values are a
* mixture.
*
* Any image can have either 1 band or n bands, where n is the same for all
* Any image may have either 1 band or n bands, where n is the same for all
* the non-1-band images. Single band images are then effectively copied to
* make n-band images.
*
* Images @a and @b are cast up to the smallest common format.
*
* Images @a and @b must match exactly in size.
* If the images differ in size, the smaller images are enlarged to match the
* largest by adding zero pixels along the bottom and right.
*
* See also: im_ifthenelse(), im_equal().
*
@ -348,9 +353,9 @@ im_blend( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out )
const int repack = a->Coding == IM_CODING_LABQ &&
b->Coding == IM_CODING_LABQ;
IMAGE *t[8];
IMAGE *t[12];
if( im_open_local_array( out, t, 8, "im_blend", "p" ) )
if( im_open_local_array( out, t, 12, "im_blend", "p" ) )
return( -1 );
/* Unpack LABPACK as a courtesy.
@ -369,27 +374,33 @@ im_blend( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out )
/* c must be uchar.
*/
if( c->BandFmt != IM_BANDFMT_UCHAR ) {
if( im_clip2fmt( c, t[7], IM_BANDFMT_UCHAR ) )
if( im_clip2fmt( c, t[2], IM_BANDFMT_UCHAR ) )
return( -1 );
c = t[7];
c = t[2];
}
/* Make a and b match in bands and format.
*/
if( im__formatalike( a, b, t[2], t[3] ) ||
im__bandalike( "im_blend", t[2], t[3], t[4], t[5] ) )
if( im__formatalike( a, b, t[3], t[4] ) ||
im__bandalike( "im_blend", t[3], t[4], t[6], t[7] ) )
return( -1 );
if( blend( c, t[4], t[5], t[6] ) )
/* Make a, b and c match in size.
*/
t[5] = c;
if( im__sizealike_vec( t + 5, t + 8, 3 ) )
return( -1 );
if( blend( t[8], t[9], t[10], t[11] ) )
return( -1 );
if( repack ) {
if( im_Lab2LabQ( t[6], out ) )
if( im_Lab2LabQ( t[11], out ) )
return( -1 );
}
else {
if( im_copy( t[6], out ) )
if( im_copy( t[11], out ) )
return( -1 );
}

View File

@ -165,6 +165,8 @@ ifthenelse( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out )
im_check_format_same( "ifthenelse", a, b ) ||
im_check_bands_same( "ifthenelse", a, b ) ||
im_check_bands_1orn( "im_ifthenelse", c, a ) ||
im_check_size_same( "ifthenelse", a, b ) ||
im_check_size_same( "ifthenelse", a, c ) ||
im_piocheck( c, out ) ||
im_pincheck( a ) ||
im_pincheck( b ) )
@ -200,8 +202,8 @@ ifthenelse( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out )
*
* Images @a and @b are cast up to the smallest common format.
*
* If the images differ in size, the smaller image is enlarged to match the
* larger by adding zero pixels along the bottom and right.
* If the images differ in size, the smaller images are enlarged to match the
* largest by adding zero pixels along the bottom and right.
*
* See also: im_blend(), im_equal().
*