Merge branch '8.1'

Conflicts:
	ChangeLog
	configure.ac
	doc/libvips-docs.xml
This commit is contained in:
John Cupitt 2015-10-13 14:47:37 +01:00
commit 4d95f4512c
10 changed files with 145 additions and 10 deletions

View File

@ -1,6 +1,9 @@
7/10/15 started 8.2.0
- added im_bufmagick2vips(), a vips7 wrapper for magick load from buffer
7/5/15 starteld 8.1.1
- oop, vips-8.0 should be vips-8.1, thanks Danilo
7/5/15 starteld 8.1.0
- add vips_premultiply(), vips_unpremultiply()
- change the alpha range rules for vips_flatten() to match vips_premultiply()

View File

@ -37,9 +37,9 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
# binary interface changes backwards compatible?: increment age
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=43
LIBRARY_CURRENT=44
LIBRARY_REVISION=0
LIBRARY_AGE=1
LIBRARY_AGE=2
# patched into include/vips/version.h
AC_SUBST(VIPS_VERSION)

View File

@ -9,7 +9,11 @@
<bookinfo>
<title>VIPS Reference Manual</title>
<releaseinfo>
<<<<<<< HEAD
For VIPS 8.2.0.
=======
For VIPS 8.1.1.
>>>>>>> 8.1
The latest version of this documentation can be found on the
<ulink role="online-location"
url="http://www.vips.ecs.soton.ac.uk/index.php?title=Documentation">VIPS website</ulink>.

View File

@ -55,11 +55,24 @@
* FILENAME_MAX chars.
*
* We look for the ':' splitting the name and mode by searching for the
* rightmost occurence of the regexp ".[A-Za-z0-9]+:". Example: consider the
* horror that is
* rightmost occurrence of the regexp "\.[A-Za-z0-9]+:". The initial dot can
* be missing if there's a dirsep or start of string, meaning this is a
* filename without an extension.
*
* Examples:
*
* c:\silly:dir:name\fr:ed.tif:jpeg:95,,,,c:\icc\srgb.icc
* -> c:\silly:dir:name\fr:ed.tif jpeg:95,,,,c:\icc\srgb.icc
* I180:
* -> I180 ""
* c:\silly:
* -> c:\silly ""
* c:\silly
* -> c:\silly ""
* C:\fixtures\2569067123_aca715a2ee_o.jpg
* -> C:\fixtures\2569067123_aca715a2ee_o.jpg ""
*
* vips8 handles this in a much better way :(
*/
void
im_filename_split( const char *path, char *name, char *mode )
@ -74,11 +87,15 @@ im_filename_split( const char *path, char *name, char *mode )
if( *p == ':' ) {
char *q;
/* We are skipping back over the file extension,
* isalnum() is probably sufficient.
*/
for( q = p - 1; isalnum( *q ) && q > name; q -= 1 )
;
if( *q == '.' )
if( *q == '.' ) {
break;
}
/* All the way back to the start? We probably have a
* filename with no extension, eg. "I180:"
@ -86,13 +103,19 @@ im_filename_split( const char *path, char *name, char *mode )
if( q == name )
break;
/* .. or we could hit a dirsep.
/* .. or we could hit a dirsep. Allow win or nix
* separators.
*/
if( *q == G_DIR_SEPARATOR )
if( *q == '/' ||
*q == '\\' )
break;
}
if( *p == ':' ) {
/* Ignore a ':' in column 1, it's probably a drive letter on a
* Windows path.
*/
if( *p == ':' &&
p - name != 1 ) {
vips_strncpy( mode, p + 1, FILENAME_MAX );
*p = '\0';
}
@ -100,6 +123,40 @@ im_filename_split( const char *path, char *name, char *mode )
strcpy( mode, "" );
}
/**
* vips_path_filename7:
* @path: path to split
*
* Return the filename part of a vips7 path. For testing only.
*/
char *
vips_path_filename7( const char *path )
{
char name[FILENAME_MAX];
char mode[FILENAME_MAX];
im_filename_split( path, name, mode );
return( g_strdup( name ) );
}
/**
* vips_path_mode7:
* @path: path to split
*
* Return the mode part of a vips7 path. For testing only.
*/
char *
vips_path_mode7( const char *path )
{
char name[FILENAME_MAX];
char mode[FILENAME_MAX];
im_filename_split( path, name, mode );
return( g_strdup( mode ) );
}
/* Skip any leading path stuff. Horrible: if this is a filename which came
* from win32 and we're a *nix machine, it'll have '\\' not '/' as the
* separator :-(

View File

@ -66,6 +66,11 @@ typedef enum {
VIPS_PRECISION_LAST
} VipsPrecision;
/* Just for testing.
*/
char *vips_path_filename7( const char *path );
char *vips_path_mode7( const char *path );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -13,6 +13,7 @@ EXTRA_DIST = \
test_colour.py \
test_conversion.py \
test_convolution.py \
test_iofuncs.py \
test_create.py \
test_foreign.py \
test_draw.py \

View File

@ -12,6 +12,7 @@ from test_foreign import *
from test_histogram import *
from test_morphology import *
from test_resample import *
from test_iofuncs import *
if __name__ == '__main__':
unittest.main()

64
test/test_iofuncs.py Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/python3
from __future__ import division
import unittest
import math
#import logging
#logging.basicConfig(level = logging.DEBUG)
from gi.repository import Vips
Vips.leak_set(True)
# an expanding zip ... if either of the args is not a list, duplicate it down
# the other
def zip_expand(x, y):
if isinstance(x, list) and isinstance(y, list):
return list(zip(x, y))
elif isinstance(x, list):
return [[i, y] for i in x]
elif isinstance(y, list):
return [[x, j] for j in y]
else:
return [[x, y]]
class TestIofuncs(unittest.TestCase):
# test a pair of things which can be lists for approx. equality
def assertEqualObjects(self, a, b, msg = ''):
#print('assertEqualObjects %s = %s' % (a, b))
for x, y in zip_expand(a, b):
self.assertEqual(x, y, msg = msg)
# test the vips7 filename splitter ... this is very fragile and annoying
# code with lots of cases
def test_split7(self):
def split(path):
filename7 = Vips.path_filename7(path)
mode7 = Vips.path_mode7(path)
return [filename7, mode7]
cases = [
["c:\\silly:dir:name\\fr:ed.tif:jpeg:95,,,,c:\\icc\\srgb.icc",
["c:\\silly:dir:name\\fr:ed.tif",
"jpeg:95,,,,c:\\icc\\srgb.icc"]],
["I180:",
["I180",
""]],
["c:\\silly:",
["c:\\silly",
""]],
["c:\\program files\\x:hello",
["c:\\program files\\x",
"hello"]],
["C:\\fixtures\\2569067123_aca715a2ee_o.jpg",
["C:\\fixtures\\2569067123_aca715a2ee_o.jpg",
""]]
]
for case in cases:
self.assertEqualObjects(split(case[0]), case[1])
if __name__ == '__main__':
unittest.main()

View File

@ -20,11 +20,11 @@ bin_SCRIPTS = \
batch_rubber_sheet \
batch_crop \
vipsprofile \
vips-8.0
vips-8.1
EXTRA_DIST = \
vipsprofile \
vips-8.0 \
vips-8.1 \
light_correct.in \
shrink_width.in \
batch_image_convert.in \