im_blend() can take non-uchar conditions
This commit is contained in:
parent
05b92ea6e5
commit
08ebc9e535
@ -31,6 +31,7 @@
|
||||
- added im_read_point(), now partial, moved im_readpoint() to deprecated
|
||||
- added im_draw_smudge(), moved im_smudge() / im_smear() to deprecated
|
||||
- convolution functions support complex images
|
||||
- im_blend() can have any format condition image and it's converted to uchar
|
||||
|
||||
12/5/10 started 7.22.2
|
||||
- the conditional image of ifthenelse can be any format, a (!=0) is added if
|
||||
|
8
TODO
8
TODO
@ -5,14 +5,6 @@
|
||||
|
||||
make a region, prepare to that, copy back over the image?
|
||||
|
||||
- smudge is too strong ... tone it down a bit
|
||||
|
||||
- can we make more use of im__draw_pel()? eg. im_draw_rect() etc.
|
||||
|
||||
- im_blend() is rather fussy about formats, argh
|
||||
|
||||
cf. im_ifthenelse() and the extra !=0 it adds?
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -100,8 +100,8 @@ im_draw_smudge( VipsImage *im, int left, int top, int width, int height )
|
||||
return( 0 );
|
||||
|
||||
if( !blur ) {
|
||||
blur = im_create_imaskv( "im_draw_smudge", 3, 1, 1, 2, 1 );
|
||||
blur->scale = 4;
|
||||
blur = im_create_imaskv( "im_draw_smudge", 3, 1, 1, 4, 1 );
|
||||
blur->scale = 6;
|
||||
}
|
||||
|
||||
if( !(t[0] = im_open( "im_draw_smudge", "p" )) )
|
||||
|
@ -323,7 +323,7 @@ blend( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out )
|
||||
* @b: else #IMAGE
|
||||
* @out: output #IMAGE
|
||||
*
|
||||
* This operation scans the condition image @c (which must be unsigned char)
|
||||
* This operation scans the condition image @c
|
||||
* and uses it to blend pixels from either the then image @a or the else
|
||||
* image @b. 255 means @a only, 0 means @b only, and intermediate values are a
|
||||
* mixture.
|
||||
@ -348,9 +348,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[7];
|
||||
IMAGE *t[8];
|
||||
|
||||
if( im_open_local_array( out, t, 7, "im_blend", "p" ) )
|
||||
if( im_open_local_array( out, t, 8, "im_blend", "p" ) )
|
||||
return( -1 );
|
||||
|
||||
/* Unpack LABPACK as a courtesy.
|
||||
@ -366,6 +366,15 @@ im_blend( IMAGE *c, IMAGE *a, IMAGE *b, IMAGE *out )
|
||||
b = t[1];
|
||||
}
|
||||
|
||||
/* c must be uchar.
|
||||
*/
|
||||
if( c->BandFmt != IM_BANDFMT_UCHAR ) {
|
||||
if( im_clip2fmt( c, t[7], IM_BANDFMT_UCHAR ) )
|
||||
return( -1 );
|
||||
|
||||
c = t[7];
|
||||
}
|
||||
|
||||
/* Make a and b match in bands and format.
|
||||
*/
|
||||
if( im__formatalike( a, b, t[2], t[3] ) ||
|
||||
|
Loading…
Reference in New Issue
Block a user