Merge branch 'master' into gargsms-text-autofit
This commit is contained in:
commit
8dbc48de8a
14
.travis.yml
14
.travis.yml
@ -9,17 +9,13 @@ before_script:
|
|||||||
script:
|
script:
|
||||||
- make -Ctest -j$JOBS -s V=0 VERBOSE=1 check
|
- make -Ctest -j$JOBS -s V=0 VERBOSE=1 check
|
||||||
|
|
||||||
# allow osx to fail since brew so often falls over
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
|
||||||
- os: osx
|
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
sudo: required
|
sudo: required
|
||||||
dist: precise
|
dist: precise
|
||||||
env:
|
env:
|
||||||
- PYTHON=/usr/bin/python
|
|
||||||
- JPEG=/usr
|
- JPEG=/usr
|
||||||
- JOBS=`nproc`
|
- JOBS=`nproc`
|
||||||
- LIBTOOLFLAGS=--quiet
|
- LIBTOOLFLAGS=--quiet
|
||||||
@ -36,13 +32,11 @@ matrix:
|
|||||||
liborc-0.4-dev liblcms2-dev libpoppler-glib-dev
|
liborc-0.4-dev liblcms2-dev libpoppler-glib-dev
|
||||||
librsvg2-dev libgif-dev
|
librsvg2-dev libgif-dev
|
||||||
libpango1.0-dev
|
libpango1.0-dev
|
||||||
python-dev
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
sudo: required
|
sudo: required
|
||||||
dist: trusty
|
dist: trusty
|
||||||
env:
|
env:
|
||||||
- PYTHON=/usr/bin/python
|
|
||||||
- JPEG=/usr
|
- JPEG=/usr
|
||||||
- JOBS=`nproc`
|
- JOBS=`nproc`
|
||||||
cache: ccache
|
cache: ccache
|
||||||
@ -58,12 +52,10 @@ matrix:
|
|||||||
liborc-0.4-dev liblcms2-dev libpoppler-glib-dev
|
liborc-0.4-dev liblcms2-dev libpoppler-glib-dev
|
||||||
librsvg2-dev libgif-dev
|
librsvg2-dev libgif-dev
|
||||||
libpango1.0-dev libgsf-1-dev libopenslide-dev
|
libpango1.0-dev libgsf-1-dev libopenslide-dev
|
||||||
python-dev python-gi-dev libgirepository1.0-dev
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode7.3
|
osx_image: xcode7.3
|
||||||
env:
|
env:
|
||||||
- PYTHON=/usr/local/bin/python
|
|
||||||
- JPEG=/usr/local/opt/mozjpeg
|
- JPEG=/usr/local/opt/mozjpeg
|
||||||
- JOBS="`sysctl -n hw.ncpu`"
|
- JOBS="`sysctl -n hw.ncpu`"
|
||||||
- PATH="/usr/local/opt/ccache/libexec:$PATH"
|
- PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||||
@ -71,7 +63,7 @@ matrix:
|
|||||||
before_install:
|
before_install:
|
||||||
- brew tap homebrew/science
|
- brew tap homebrew/science
|
||||||
- brew update
|
- brew update
|
||||||
- brew install ccache pkg-config automake
|
- brew install ccache
|
||||||
- brew install --ignore-dependencies gtk-doc
|
- brew install --ignore-dependencies gtk-doc
|
||||||
- brew install
|
- brew install
|
||||||
gobject-introspection
|
gobject-introspection
|
||||||
@ -81,5 +73,5 @@ matrix:
|
|||||||
cfitsio libmatio
|
cfitsio libmatio
|
||||||
orc little-cms2 poppler
|
orc little-cms2 poppler
|
||||||
pango libgsf openslide
|
pango libgsf openslide
|
||||||
librsvg giflib openexr
|
librsvg openexr
|
||||||
- brew install pygobject3
|
|
||||||
|
@ -225,9 +225,9 @@ vips_avg_init( VipsAvg *avg )
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vips_avg:
|
* vips_avg: (method)
|
||||||
* @in: input #VipsImage
|
* @in: input #VipsImage
|
||||||
* @out: output pixel average
|
* @out: (out): output pixel average
|
||||||
* @...: %NULL-terminated list of optional named arguments
|
* @...: %NULL-terminated list of optional named arguments
|
||||||
*
|
*
|
||||||
* This operation finds the average value in an image. It operates on all
|
* This operation finds the average value in an image. It operates on all
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
*
|
*
|
||||||
* 26/7/17
|
* 26/7/17
|
||||||
* - from a ruby example
|
* - from a ruby example
|
||||||
|
* 18/9/17 kleisauke
|
||||||
|
* - missing bandor
|
||||||
|
* - only flatten if there is an alpha
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -69,6 +72,7 @@ vips_find_trim_build( VipsObject *object )
|
|||||||
VipsFindTrim *find_trim = (VipsFindTrim *) object;
|
VipsFindTrim *find_trim = (VipsFindTrim *) object;
|
||||||
VipsImage **t = (VipsImage **) vips_object_local_array( object, 20 );
|
VipsImage **t = (VipsImage **) vips_object_local_array( object, 20 );
|
||||||
|
|
||||||
|
VipsImage *in;
|
||||||
double *background;
|
double *background;
|
||||||
int n;
|
int n;
|
||||||
double *neg_bg;
|
double *neg_bg;
|
||||||
@ -93,12 +97,16 @@ vips_find_trim_build( VipsObject *object )
|
|||||||
vips_array_double_newv( 1, 65535.0 );
|
vips_array_double_newv( 1, 65535.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flatten out any alpha.
|
/* Flatten out alpha, if any.
|
||||||
*/
|
*/
|
||||||
if( vips_flatten( find_trim->in, &t[0],
|
in = find_trim->in;
|
||||||
"background", find_trim->background,
|
if( vips_image_hasalpha( in ) ) {
|
||||||
NULL ) )
|
if( vips_flatten( in, &t[0],
|
||||||
return( -1 );
|
"background", find_trim->background,
|
||||||
|
NULL ) )
|
||||||
|
return( -1 );
|
||||||
|
in = t[0];
|
||||||
|
}
|
||||||
|
|
||||||
/* We want to subtract the bg.
|
/* We want to subtract the bg.
|
||||||
*/
|
*/
|
||||||
@ -113,42 +121,44 @@ vips_find_trim_build( VipsObject *object )
|
|||||||
|
|
||||||
/* Smooth, find difference from bg, abs, threshold.
|
/* Smooth, find difference from bg, abs, threshold.
|
||||||
*/
|
*/
|
||||||
if( vips_median( t[0], &t[1], 3, NULL ) ||
|
if( vips_median( in, &t[1], 3, NULL ) ||
|
||||||
vips_linear( t[1], &t[2], ones, neg_bg, n, NULL ) ||
|
vips_linear( t[1], &t[2], ones, neg_bg, n, NULL ) ||
|
||||||
vips_abs( t[2], &t[3], NULL ) ||
|
vips_abs( t[2], &t[3], NULL ) ||
|
||||||
vips_more_const1( t[3], &t[4], find_trim->threshold, NULL ) )
|
vips_more_const1( t[3], &t[4], find_trim->threshold, NULL ) ||
|
||||||
|
vips_bandor( t[4], &t[5], NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
in = t[5];
|
||||||
|
|
||||||
/* t[5] == column sums, t[6] == row sums.
|
/* t[6] == column sums, t[7] == row sums.
|
||||||
*/
|
*/
|
||||||
if( vips_project( t[4], &t[5], &t[6], NULL ) )
|
if( vips_project( in, &t[6], &t[7], NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* t[8] == search column sums in from left.
|
/* t[8] == search column sums in from left.
|
||||||
*/
|
*/
|
||||||
if( vips_profile( t[5], &t[7], &t[8], NULL ) ||
|
if( vips_profile( t[6], &t[8], &t[9], NULL ) ||
|
||||||
vips_avg( t[8], &left, NULL ) )
|
vips_avg( t[9], &left, NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( vips_flip( t[5], &t[9], VIPS_DIRECTION_HORIZONTAL, NULL ) ||
|
if( vips_flip( t[6], &t[10], VIPS_DIRECTION_HORIZONTAL, NULL ) ||
|
||||||
vips_profile( t[9], &t[10], &t[11], NULL ) ||
|
vips_profile( t[10], &t[11], &t[12], NULL ) ||
|
||||||
vips_avg( t[11], &right, NULL ) )
|
vips_avg( t[12], &right, NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* t[8] == search column sums in from left.
|
/* t[8] == search column sums in from left.
|
||||||
*/
|
*/
|
||||||
if( vips_profile( t[6], &t[12], &t[13], NULL ) ||
|
if( vips_profile( t[7], &t[13], &t[14], NULL ) ||
|
||||||
vips_avg( t[12], &top, NULL ) )
|
vips_avg( t[13], &top, NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( vips_flip( t[6], &t[14], VIPS_DIRECTION_VERTICAL, NULL ) ||
|
if( vips_flip( t[7], &t[15], VIPS_DIRECTION_VERTICAL, NULL ) ||
|
||||||
vips_profile( t[14], &t[15], &t[16], NULL ) ||
|
vips_profile( t[15], &t[16], &t[17], NULL ) ||
|
||||||
vips_avg( t[15], &bottom, NULL ) )
|
vips_avg( t[16], &bottom, NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
g_object_set( find_trim,
|
g_object_set( find_trim,
|
||||||
"left", (int) left,
|
"left", (int) left,
|
||||||
"top", (int) top,
|
"top", (int) top,
|
||||||
"width", (int) VIPS_MAX( 0, (t[5]->Xsize - right) - left ),
|
"width", (int) VIPS_MAX( 0, (t[6]->Xsize - right) - left ),
|
||||||
"height", (int) VIPS_MAX( 0, (t[6]->Ysize - bottom) - top ),
|
"height", (int) VIPS_MAX( 0, (t[7]->Ysize - bottom) - top ),
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
@ -253,7 +263,8 @@ vips_find_trim_init( VipsFindTrim *find_trim )
|
|||||||
* and @height == 0.
|
* and @height == 0.
|
||||||
*
|
*
|
||||||
* @background defaults to 255, or 65535 for 16-bit images. Set another value,
|
* @background defaults to 255, or 65535 for 16-bit images. Set another value,
|
||||||
* or use vips_getpoint() to pick a value from an edge.
|
* or use vips_getpoint() to pick a value from an edge. You'll need to flatten
|
||||||
|
* before vips_getpoint() to get a correct background value.
|
||||||
*
|
*
|
||||||
* @threshold defaults to 10.
|
* @threshold defaults to 10.
|
||||||
*
|
*
|
||||||
|
@ -453,6 +453,8 @@ vips__cache_once_init( void )
|
|||||||
vips_cache_table = g_hash_table_new(
|
vips_cache_table = g_hash_table_new(
|
||||||
(GHashFunc) vips_operation_hash,
|
(GHashFunc) vips_operation_hash,
|
||||||
(GEqualFunc) vips_operation_equal );
|
(GEqualFunc) vips_operation_equal );
|
||||||
|
|
||||||
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user