LOW and NONE mean the same
small code simplification and cleanup, add docs
This commit is contained in:
parent
9ac5a449f2
commit
ff8a1a2c6f
@ -212,11 +212,17 @@
|
||||
* @VIPS_INTERESTING_CENTRE: just take the centre
|
||||
* @VIPS_INTERESTING_ENTROPY: use an entropy measure
|
||||
* @VIPS_INTERESTING_ATTENTION: look for features likely to draw human attention
|
||||
* @VIPS_INTERESTING_LOW: position the crop towards the low coordinate
|
||||
* @VIPS_INTERESTING_HIGH: position the crop towards the high coordinate
|
||||
*
|
||||
* Pick the algorithm vips uses to decide image "interestingness". This is used
|
||||
* by vips_smartcrop(), for example, to decide what parts of the image to
|
||||
* keep.
|
||||
*
|
||||
* #VIPS_INTERESTING_NONE and #VIPS_INTERESTING_LOW mean the same -- the
|
||||
* crop is positioned at the top or left. #VIPS_INTERESTING_HIGH positions at
|
||||
* the bottom or right.
|
||||
*
|
||||
* See also: vips_smartcrop().
|
||||
*/
|
||||
|
||||
|
@ -128,7 +128,8 @@ vips_smartcrop_entropy( VipsSmartcrop *smartcrop,
|
||||
double right_score;
|
||||
|
||||
if( vips_smartcrop_score( smartcrop, in,
|
||||
*left, *top, slice_width, height, &left_score ) )
|
||||
*left, *top,
|
||||
slice_width, height, &left_score ) )
|
||||
return( -1 );
|
||||
|
||||
if( vips_smartcrop_score( smartcrop, in,
|
||||
@ -146,7 +147,8 @@ vips_smartcrop_entropy( VipsSmartcrop *smartcrop,
|
||||
double bottom_score;
|
||||
|
||||
if( vips_smartcrop_score( smartcrop, in,
|
||||
*left, *top, width, slice_height, &top_score ) )
|
||||
*left, *top,
|
||||
width, slice_height, &top_score ) )
|
||||
return( -1 );
|
||||
|
||||
if( vips_smartcrop_score( smartcrop, in,
|
||||
@ -337,6 +339,7 @@ vips_smartcrop_build( VipsObject *object )
|
||||
|
||||
switch( smartcrop->interesting ) {
|
||||
case VIPS_INTERESTING_NONE:
|
||||
case VIPS_INTERESTING_LOW:
|
||||
left = 0;
|
||||
top = 0;
|
||||
break;
|
||||
@ -356,11 +359,6 @@ vips_smartcrop_build( VipsObject *object )
|
||||
return( -1 );
|
||||
break;
|
||||
|
||||
case VIPS_INTERESTING_LOW:
|
||||
left = 0;
|
||||
top = 0;
|
||||
break;
|
||||
|
||||
case VIPS_INTERESTING_HIGH:
|
||||
left = smartcrop->in->Xsize - smartcrop->width;
|
||||
top = smartcrop->in->Ysize - smartcrop->height;
|
||||
@ -377,7 +375,8 @@ vips_smartcrop_build( VipsObject *object )
|
||||
}
|
||||
|
||||
if( vips_extract_area( smartcrop->in, &t[1],
|
||||
left, top, smartcrop->width, smartcrop->height, NULL ) ||
|
||||
left, top,
|
||||
smartcrop->width, smartcrop->height, NULL ) ||
|
||||
vips_image_write( t[1], conversion->out ) )
|
||||
return( -1 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user