Update C++ binding and function list
The generators use the new Introspect class of pyvips.
This commit is contained in:
parent
d88ce970b7
commit
2499b38403
@ -596,20 +596,20 @@ VImage::new_from_buffer( const std::string &buf, const char *option_string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
VImage
|
VImage
|
||||||
VImage::new_from_stream( const VStreamI &input, const char *option_string,
|
VImage::new_from_stream( VStreamI streami, const char *option_string,
|
||||||
VOption *options )
|
VOption *options )
|
||||||
{
|
{
|
||||||
const char *operation_name;
|
const char *operation_name;
|
||||||
VImage out;
|
VImage out;
|
||||||
|
|
||||||
if( !(operation_name = vips_foreign_find_load_stream(
|
if( !(operation_name = vips_foreign_find_load_stream(
|
||||||
input.get_stream() )) ) {
|
streami.get_stream() )) ) {
|
||||||
delete options;
|
delete options;
|
||||||
throw( VError() );
|
throw( VError() );
|
||||||
}
|
}
|
||||||
|
|
||||||
options = (options ? options : VImage::option())->
|
options = (options ? options : VImage::option())->
|
||||||
set( "input", input )->
|
set( "streami", streami )->
|
||||||
set( "out", &out );
|
set( "out", &out );
|
||||||
|
|
||||||
call_option_string( operation_name, option_string, options );
|
call_option_string( operation_name, option_string, options );
|
||||||
@ -702,7 +702,7 @@ VImage::write_to_buffer( const char *suffix, void **buf, size_t *size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VImage::write_to_stream( const char *suffix, const VStreamO &output,
|
VImage::write_to_stream( const char *suffix, VStreamO streamo,
|
||||||
VOption *options ) const
|
VOption *options ) const
|
||||||
{
|
{
|
||||||
char filename[VIPS_PATH_MAX];
|
char filename[VIPS_PATH_MAX];
|
||||||
@ -718,7 +718,7 @@ VImage::write_to_stream( const char *suffix, const VStreamO &output,
|
|||||||
call_option_string( operation_name, option_string,
|
call_option_string( operation_name, option_string,
|
||||||
(options ? options : VImage::option())->
|
(options ? options : VImage::option())->
|
||||||
set( "in", *this )->
|
set( "in", *this )->
|
||||||
set( "output", output ) );
|
set( "streamo", streamo ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "vips-operators.cpp"
|
#include "vips-operators.cpp"
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from pyvips import Operation, GValue, Error, \
|
from pyvips import Introspect, Operation, GValue, Error, \
|
||||||
ffi, gobject_lib, type_map, type_from_name, nickname_find, type_name
|
ffi, gobject_lib, type_map, type_from_name, nickname_find, type_name
|
||||||
|
|
||||||
# TODO Move to pyvips.GValue
|
# TODO Move to pyvips.GValue
|
||||||
@ -41,8 +41,8 @@ gtype_to_cpp = {
|
|||||||
GValue.refstr_type: 'char *',
|
GValue.refstr_type: 'char *',
|
||||||
GValue.gflags_type: 'int',
|
GValue.gflags_type: 'int',
|
||||||
GValue.image_type: 'VImage',
|
GValue.image_type: 'VImage',
|
||||||
stream_input_type: 'const VStreamI &',
|
stream_input_type: 'VStreamI',
|
||||||
stream_output_type: 'const VStreamO &',
|
stream_output_type: 'VStreamO',
|
||||||
GValue.array_int_type: 'std::vector<int>',
|
GValue.array_int_type: 'std::vector<int>',
|
||||||
GValue.array_double_type: 'std::vector<double>',
|
GValue.array_double_type: 'std::vector<double>',
|
||||||
GValue.array_image_type: 'std::vector<VImage>',
|
GValue.array_image_type: 'std::vector<VImage>',
|
||||||
@ -87,66 +87,42 @@ def cppize(name):
|
|||||||
|
|
||||||
|
|
||||||
def generate_operation(operation_name, declaration_only=False):
|
def generate_operation(operation_name, declaration_only=False):
|
||||||
op = Operation.new_from_name(operation_name)
|
intro = Introspect.get(operation_name)
|
||||||
|
|
||||||
# we are only interested in non-deprecated args
|
required_output = [name for name in intro.required_output if name != intro.member_x]
|
||||||
args = [[name, flags] for name, flags in op.get_args()
|
|
||||||
if not flags & _DEPRECATED]
|
|
||||||
|
|
||||||
# find the first required input image arg, if any ... that will be self
|
|
||||||
member_x = None
|
|
||||||
for name, flags in args:
|
|
||||||
if ((flags & _INPUT) != 0 and
|
|
||||||
(flags & _REQUIRED) != 0 and
|
|
||||||
op.get_typeof(name) == GValue.image_type):
|
|
||||||
member_x = name
|
|
||||||
break
|
|
||||||
|
|
||||||
required_input = [name for name, flags in args
|
|
||||||
if (flags & _INPUT) != 0 and
|
|
||||||
(flags & _REQUIRED) != 0 and
|
|
||||||
name != member_x]
|
|
||||||
|
|
||||||
required_output = [name for name, flags in args
|
|
||||||
if ((flags & _OUTPUT) != 0 and
|
|
||||||
(flags & _REQUIRED) != 0) or
|
|
||||||
((flags & _INPUT) != 0 and
|
|
||||||
(flags & _REQUIRED) != 0 and
|
|
||||||
(flags & _MODIFY) != 0) and
|
|
||||||
name != member_x]
|
|
||||||
|
|
||||||
has_output = len(required_output) >= 1
|
has_output = len(required_output) >= 1
|
||||||
|
|
||||||
# Add a C++ style comment block with some additional markings (@param,
|
# Add a C++ style comment block with some additional markings (@param,
|
||||||
# @return)
|
# @return)
|
||||||
if declaration_only:
|
if declaration_only:
|
||||||
result = '\n/**\n * {}.'.format(op.get_description().capitalize())
|
result = '\n/**\n * {}.'.format(intro.description.capitalize())
|
||||||
|
|
||||||
for name in required_input:
|
for name in intro.method_args:
|
||||||
result += '\n * @param {} {}.' \
|
result += '\n * @param {} {}.' \
|
||||||
.format(cppize(name), op.get_blurb(name))
|
.format(cppize(name), intro.details[name]['blurb'])
|
||||||
|
|
||||||
if has_output:
|
if has_output:
|
||||||
# skip the first element
|
# skip the first element
|
||||||
for name in required_output[1:]:
|
for name in required_output[1:]:
|
||||||
result += '\n * @param {} {}.' \
|
result += '\n * @param {} {}.' \
|
||||||
.format(cppize(name), op.get_blurb(name))
|
.format(cppize(name), intro.details[name]['blurb'])
|
||||||
|
|
||||||
result += '\n * @param options Optional options.'
|
result += '\n * @param options Optional options.'
|
||||||
|
|
||||||
if has_output:
|
if has_output:
|
||||||
result += '\n * @return {}.' \
|
result += '\n * @return {}.' \
|
||||||
.format(op.get_blurb(required_output[0]))
|
.format(intro.details[required_output[0]]['blurb'])
|
||||||
|
|
||||||
result += '\n */\n'
|
result += '\n */\n'
|
||||||
else:
|
else:
|
||||||
result = '\n'
|
result = '\n'
|
||||||
|
|
||||||
if member_x is None and declaration_only:
|
if intro.member_x is None and declaration_only:
|
||||||
result += 'static '
|
result += 'static '
|
||||||
if has_output:
|
if has_output:
|
||||||
# the first output arg will be used as the result
|
# the first output arg will be used as the result
|
||||||
cpp_type = get_cpp_type(op.get_typeof(required_output[0]))
|
cpp_type = get_cpp_type(intro.details[required_output[0]]['type'])
|
||||||
spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' '
|
spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' '
|
||||||
result += '{0}{1}'.format(cpp_type, spacing)
|
result += '{0}{1}'.format(cpp_type, spacing)
|
||||||
else:
|
else:
|
||||||
@ -160,8 +136,9 @@ def generate_operation(operation_name, declaration_only=False):
|
|||||||
cplusplus_operation += '_image'
|
cplusplus_operation += '_image'
|
||||||
|
|
||||||
result += '{0}( '.format(cplusplus_operation)
|
result += '{0}( '.format(cplusplus_operation)
|
||||||
for name in required_input:
|
for name in intro.method_args:
|
||||||
gtype = op.get_typeof(name)
|
details = intro.details[name]
|
||||||
|
gtype = details['type']
|
||||||
cpp_type = get_cpp_type(gtype)
|
cpp_type = get_cpp_type(gtype)
|
||||||
spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' '
|
spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' '
|
||||||
result += '{0}{1}{2}, '.format(cpp_type, spacing, cppize(name))
|
result += '{0}{1}{2}, '.format(cpp_type, spacing, cppize(name))
|
||||||
@ -170,7 +147,8 @@ def generate_operation(operation_name, declaration_only=False):
|
|||||||
if has_output:
|
if has_output:
|
||||||
# skip the first element
|
# skip the first element
|
||||||
for name in required_output[1:]:
|
for name in required_output[1:]:
|
||||||
gtype = op.get_typeof(name)
|
details = intro.details[name]
|
||||||
|
gtype = details['type']
|
||||||
cpp_type = get_cpp_type(gtype)
|
cpp_type = get_cpp_type(gtype)
|
||||||
spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' '
|
spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' '
|
||||||
result += '{0}{1}*{2}, '.format(cpp_type, spacing, cppize(name))
|
result += '{0}{1}*{2}, '.format(cpp_type, spacing, cppize(name))
|
||||||
@ -178,7 +156,7 @@ def generate_operation(operation_name, declaration_only=False):
|
|||||||
result += 'VOption *options {0})'.format('= 0 ' if declaration_only else '')
|
result += 'VOption *options {0})'.format('= 0 ' if declaration_only else '')
|
||||||
|
|
||||||
# if no 'this' available, it's a class method and they are all const
|
# if no 'this' available, it's a class method and they are all const
|
||||||
if member_x is not None:
|
if intro.member_x is not None:
|
||||||
result += ' const'
|
result += ' const'
|
||||||
|
|
||||||
if declaration_only:
|
if declaration_only:
|
||||||
@ -191,17 +169,17 @@ def generate_operation(operation_name, declaration_only=False):
|
|||||||
if has_output:
|
if has_output:
|
||||||
# the first output arg will be used as the result
|
# the first output arg will be used as the result
|
||||||
name = required_output[0]
|
name = required_output[0]
|
||||||
cpp_type = get_cpp_type(op.get_typeof(name))
|
cpp_type = get_cpp_type(intro.details[name]['type'])
|
||||||
spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' '
|
spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' '
|
||||||
result += ' {0}{1}{2};\n\n'.format(cpp_type, spacing, cppize(name))
|
result += ' {0}{1}{2};\n\n'.format(cpp_type, spacing, cppize(name))
|
||||||
|
|
||||||
result += ' call( "{0}",\n'.format(operation_name)
|
result += ' call( "{0}",\n'.format(operation_name)
|
||||||
result += ' (options ? options : VImage::option())'
|
result += ' (options ? options : VImage::option())'
|
||||||
if member_x is not None:
|
if intro.member_x is not None:
|
||||||
result += '->\n'
|
result += '->\n'
|
||||||
result += ' set( "{0}", *this )'.format(member_x)
|
result += ' set( "{0}", *this )'.format(intro.member_x)
|
||||||
|
|
||||||
all_required = required_input
|
all_required = intro.method_args
|
||||||
|
|
||||||
if has_output:
|
if has_output:
|
||||||
# first element needs to be passed by reference
|
# first element needs to be passed by reference
|
||||||
@ -236,10 +214,10 @@ def generate_operators(declarations_only=False):
|
|||||||
nickname = nickname_find(gtype)
|
nickname = nickname_find(gtype)
|
||||||
try:
|
try:
|
||||||
# can fail for abstract types
|
# can fail for abstract types
|
||||||
op = Operation.new_from_name(nickname)
|
intro = Introspect.get(nickname)
|
||||||
|
|
||||||
# we are only interested in non-deprecated operations
|
# we are only interested in non-deprecated operations
|
||||||
if (op.get_flags() & _OPERATION_DEPRECATED) == 0:
|
if (intro.flags & _OPERATION_DEPRECATED) == 0:
|
||||||
all_nicknames.append(nickname)
|
all_nicknames.append(nickname)
|
||||||
except Error:
|
except Error:
|
||||||
pass
|
pass
|
||||||
|
@ -514,7 +514,7 @@ public:
|
|||||||
static VImage new_from_buffer( const std::string &buf,
|
static VImage new_from_buffer( const std::string &buf,
|
||||||
const char *option_string, VOption *options = 0 );
|
const char *option_string, VOption *options = 0 );
|
||||||
|
|
||||||
static VImage new_from_stream( const VStreamI &input,
|
static VImage new_from_stream( VStreamI streami,
|
||||||
const char *option_string, VOption *options = 0 );
|
const char *option_string, VOption *options = 0 );
|
||||||
|
|
||||||
static VImage new_matrix( int width, int height );
|
static VImage new_matrix( int width, int height );
|
||||||
@ -569,8 +569,8 @@ public:
|
|||||||
void write_to_buffer( const char *suffix, void **buf, size_t *size,
|
void write_to_buffer( const char *suffix, void **buf, size_t *size,
|
||||||
VOption *options = 0 ) const;
|
VOption *options = 0 ) const;
|
||||||
|
|
||||||
void write_to_stream( const char *suffix,
|
void write_to_stream( const char *suffix, VStreamO streamo,
|
||||||
const VStreamO &output, VOption *options = 0 ) const;
|
VOption *options = 0 ) const;
|
||||||
|
|
||||||
void *
|
void *
|
||||||
write_to_memory( size_t *size ) const
|
write_to_memory( size_t *size ) const
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// headers for vips operations
|
// headers for vips operations
|
||||||
// Mon 11 Nov 09:21:14 GMT 2019
|
// Fri 29 Nov 2019 02:46:41 PM CET
|
||||||
// this file is generated automatically, do not edit!
|
// this file is generated automatically, do not edit!
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1039,11 +1039,11 @@ static VImage jpegload_buffer( VipsBlob *buffer, VOption *options = 0 );
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load image from jpeg stream.
|
* Load image from jpeg stream.
|
||||||
* @param input Stream to load from.
|
* @param streami Stream to load from.
|
||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
* @return Output image.
|
* @return Output image.
|
||||||
*/
|
*/
|
||||||
static VImage jpegload_stream( const VStreamI &input, VOption *options = 0 );
|
static VImage jpegload_stream( VStreamI streami, VOption *options = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save image to jpeg file.
|
* Save image to jpeg file.
|
||||||
@ -1070,7 +1070,7 @@ void jpegsave_mime( VOption *options = 0 ) const;
|
|||||||
* @param streamo Stream to save to.
|
* @param streamo Stream to save to.
|
||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
*/
|
*/
|
||||||
void jpegsave_stream( const VStreamO &streamo, VOption *options = 0 ) const;
|
void jpegsave_stream( VStreamO streamo, VOption *options = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label regions in an image.
|
* Label regions in an image.
|
||||||
@ -1521,7 +1521,7 @@ static VImage pngload_buffer( VipsBlob *buffer, VOption *options = 0 );
|
|||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
* @return Output image.
|
* @return Output image.
|
||||||
*/
|
*/
|
||||||
static VImage pngload_stream( const VStreamI &streami, VOption *options = 0 );
|
static VImage pngload_stream( VStreamI streami, VOption *options = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save image to png file.
|
* Save image to png file.
|
||||||
@ -1542,7 +1542,7 @@ VipsBlob *pngsave_buffer( VOption *options = 0 ) const;
|
|||||||
* @param streamo Stream to save to.
|
* @param streamo Stream to save to.
|
||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
*/
|
*/
|
||||||
void pngsave_stream( const VStreamO &streamo, VOption *options = 0 ) const;
|
void pngsave_stream( VStreamO streamo, VOption *options = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load ppm from file.
|
* Load ppm from file.
|
||||||
@ -1627,7 +1627,7 @@ static VImage radload_buffer( VipsBlob *buffer, VOption *options = 0 );
|
|||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
* @return Output image.
|
* @return Output image.
|
||||||
*/
|
*/
|
||||||
static VImage radload_stream( const VStreamI &streami, VOption *options = 0 );
|
static VImage radload_stream( VStreamI streami, VOption *options = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save image to radiance file.
|
* Save image to radiance file.
|
||||||
@ -1648,7 +1648,7 @@ VipsBlob *radsave_buffer( VOption *options = 0 ) const;
|
|||||||
* @param streamo Stream to save to.
|
* @param streamo Stream to save to.
|
||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
*/
|
*/
|
||||||
void radsave_stream( const VStreamO &streamo, VOption *options = 0 ) const;
|
void radsave_stream( VStreamO streamo, VOption *options = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rank filter.
|
* Rank filter.
|
||||||
@ -1998,7 +1998,7 @@ static VImage svgload_buffer( VipsBlob *buffer, VOption *options = 0 );
|
|||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
* @return Output image.
|
* @return Output image.
|
||||||
*/
|
*/
|
||||||
static VImage svgload_stream( const VStreamI &streami, VOption *options = 0 );
|
static VImage svgload_stream( VStreamI streami, VOption *options = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the index of the first non-zero pixel in tests.
|
* Find the index of the first non-zero pixel in tests.
|
||||||
@ -2056,7 +2056,7 @@ VImage thumbnail_image( int width, VOption *options = 0 ) const;
|
|||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
* @return Output image.
|
* @return Output image.
|
||||||
*/
|
*/
|
||||||
static VImage thumbnail_stream( const VStreamI &streami, int width, VOption *options = 0 );
|
static VImage thumbnail_stream( VStreamI streami, int width, VOption *options = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load tiff from file.
|
* Load tiff from file.
|
||||||
@ -2080,7 +2080,7 @@ static VImage tiffload_buffer( VipsBlob *buffer, VOption *options = 0 );
|
|||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
* @return Output image.
|
* @return Output image.
|
||||||
*/
|
*/
|
||||||
static VImage tiffload_stream( const VStreamI &streami, VOption *options = 0 );
|
static VImage tiffload_stream( VStreamI streami, VOption *options = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save image to tiff file.
|
* Save image to tiff file.
|
||||||
@ -2161,7 +2161,7 @@ static VImage webpload_buffer( VipsBlob *buffer, VOption *options = 0 );
|
|||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
* @return Output image.
|
* @return Output image.
|
||||||
*/
|
*/
|
||||||
static VImage webpload_stream( const VStreamI &streami, VOption *options = 0 );
|
static VImage webpload_stream( VStreamI streami, VOption *options = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save image to webp file.
|
* Save image to webp file.
|
||||||
@ -2182,7 +2182,7 @@ VipsBlob *webpsave_buffer( VOption *options = 0 ) const;
|
|||||||
* @param streamo Stream to save to.
|
* @param streamo Stream to save to.
|
||||||
* @param options Optional options.
|
* @param options Optional options.
|
||||||
*/
|
*/
|
||||||
void webpsave_stream( const VStreamO &streamo, VOption *options = 0 ) const;
|
void webpsave_stream( VStreamO streamo, VOption *options = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a worley noise image.
|
* Make a worley noise image.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// bodies for vips operations
|
// bodies for vips operations
|
||||||
// Mon 11 Nov 09:21:02 GMT 2019
|
// Fri 29 Nov 2019 02:46:41 PM CET
|
||||||
// this file is generated automatically, do not edit!
|
// this file is generated automatically, do not edit!
|
||||||
|
|
||||||
VImage VImage::CMC2LCh( VOption *options ) const
|
VImage VImage::CMC2LCh( VOption *options ) const
|
||||||
@ -1628,14 +1628,14 @@ VImage VImage::jpegload_buffer( VipsBlob *buffer, VOption *options )
|
|||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::jpegload_stream( const VStreamI &input, VOption *options )
|
VImage VImage::jpegload_stream( VStreamI streami, VOption *options )
|
||||||
{
|
{
|
||||||
VImage out;
|
VImage out;
|
||||||
|
|
||||||
call( "jpegload_stream",
|
call( "jpegload_stream",
|
||||||
(options ? options : VImage::option())->
|
(options ? options : VImage::option())->
|
||||||
set( "out", &out )->
|
set( "out", &out )->
|
||||||
set( "input", input ) );
|
set( "streami", streami ) );
|
||||||
|
|
||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
@ -1667,7 +1667,7 @@ void VImage::jpegsave_mime( VOption *options ) const
|
|||||||
set( "in", *this ) );
|
set( "in", *this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void VImage::jpegsave_stream( const VStreamO &streamo, VOption *options ) const
|
void VImage::jpegsave_stream( VStreamO streamo, VOption *options ) const
|
||||||
{
|
{
|
||||||
call( "jpegsave_stream",
|
call( "jpegsave_stream",
|
||||||
(options ? options : VImage::option())->
|
(options ? options : VImage::option())->
|
||||||
@ -2319,7 +2319,7 @@ VImage VImage::pngload_buffer( VipsBlob *buffer, VOption *options )
|
|||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::pngload_stream( const VStreamI &streami, VOption *options )
|
VImage VImage::pngload_stream( VStreamI streami, VOption *options )
|
||||||
{
|
{
|
||||||
VImage out;
|
VImage out;
|
||||||
|
|
||||||
@ -2351,7 +2351,7 @@ VipsBlob *VImage::pngsave_buffer( VOption *options ) const
|
|||||||
return( buffer );
|
return( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
void VImage::pngsave_stream( const VStreamO &streamo, VOption *options ) const
|
void VImage::pngsave_stream( VStreamO streamo, VOption *options ) const
|
||||||
{
|
{
|
||||||
call( "pngsave_stream",
|
call( "pngsave_stream",
|
||||||
(options ? options : VImage::option())->
|
(options ? options : VImage::option())->
|
||||||
@ -2478,7 +2478,7 @@ VImage VImage::radload_buffer( VipsBlob *buffer, VOption *options )
|
|||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::radload_stream( const VStreamI &streami, VOption *options )
|
VImage VImage::radload_stream( VStreamI streami, VOption *options )
|
||||||
{
|
{
|
||||||
VImage out;
|
VImage out;
|
||||||
|
|
||||||
@ -2510,7 +2510,7 @@ VipsBlob *VImage::radsave_buffer( VOption *options ) const
|
|||||||
return( buffer );
|
return( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
void VImage::radsave_stream( const VStreamO &streamo, VOption *options ) const
|
void VImage::radsave_stream( VStreamO streamo, VOption *options ) const
|
||||||
{
|
{
|
||||||
call( "radsave_stream",
|
call( "radsave_stream",
|
||||||
(options ? options : VImage::option())->
|
(options ? options : VImage::option())->
|
||||||
@ -3062,7 +3062,7 @@ VImage VImage::svgload_buffer( VipsBlob *buffer, VOption *options )
|
|||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::svgload_stream( const VStreamI &streami, VOption *options )
|
VImage VImage::svgload_stream( VStreamI streami, VOption *options )
|
||||||
{
|
{
|
||||||
VImage out;
|
VImage out;
|
||||||
|
|
||||||
@ -3144,7 +3144,7 @@ VImage VImage::thumbnail_image( int width, VOption *options ) const
|
|||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::thumbnail_stream( const VStreamI &streami, int width, VOption *options )
|
VImage VImage::thumbnail_stream( VStreamI streami, int width, VOption *options )
|
||||||
{
|
{
|
||||||
VImage out;
|
VImage out;
|
||||||
|
|
||||||
@ -3181,7 +3181,7 @@ VImage VImage::tiffload_buffer( VipsBlob *buffer, VOption *options )
|
|||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::tiffload_stream( const VStreamI &streami, VOption *options )
|
VImage VImage::tiffload_stream( VStreamI streami, VOption *options )
|
||||||
{
|
{
|
||||||
VImage out;
|
VImage out;
|
||||||
|
|
||||||
@ -3304,7 +3304,7 @@ VImage VImage::webpload_buffer( VipsBlob *buffer, VOption *options )
|
|||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::webpload_stream( const VStreamI &streami, VOption *options )
|
VImage VImage::webpload_stream( VStreamI streami, VOption *options )
|
||||||
{
|
{
|
||||||
VImage out;
|
VImage out;
|
||||||
|
|
||||||
@ -3336,7 +3336,7 @@ VipsBlob *VImage::webpsave_buffer( VOption *options ) const
|
|||||||
return( buffer );
|
return( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
void VImage::webpsave_stream( const VStreamO &streamo, VOption *options ) const
|
void VImage::webpsave_stream( VStreamO streamo, VOption *options ) const
|
||||||
{
|
{
|
||||||
call( "webpsave_stream",
|
call( "webpsave_stream",
|
||||||
(options ? options : VImage::option())->
|
(options ? options : VImage::option())->
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@
|
|||||||
# <entry>vips_gamma()</entry>
|
# <entry>vips_gamma()</entry>
|
||||||
# </row>
|
# </row>
|
||||||
|
|
||||||
from pyvips import Operation, Error, \
|
from pyvips import Introspect, Operation, Error, \
|
||||||
ffi, type_map, type_from_name, nickname_find
|
ffi, type_map, type_from_name, nickname_find
|
||||||
|
|
||||||
# for VipsOperationFlags
|
# for VipsOperationFlags
|
||||||
@ -23,13 +23,15 @@ _OPERATION_DEPRECATED = 8
|
|||||||
|
|
||||||
|
|
||||||
def gen_function(operation_name):
|
def gen_function(operation_name):
|
||||||
op = Operation.new_from_name(operation_name)
|
intro = Introspect.get(operation_name)
|
||||||
|
|
||||||
print('<row>')
|
result = '<row>\n'
|
||||||
print(' <entry>{}</entry>'.format(operation_name))
|
result += ' <entry>{}</entry>\n'.format(operation_name)
|
||||||
print(' <entry>{}</entry>'.format(op.get_description().capitalize()))
|
result += ' <entry>{}</entry>\n'.format(intro.description.capitalize())
|
||||||
print(' <entry>vips_{}()</entry>'.format(operation_name))
|
result += ' <entry>vips_{}()</entry>\n'.format(operation_name)
|
||||||
print('</row>')
|
result += '</row>'
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def gen_function_list():
|
def gen_function_list():
|
||||||
@ -39,10 +41,10 @@ def gen_function_list():
|
|||||||
nickname = nickname_find(gtype)
|
nickname = nickname_find(gtype)
|
||||||
try:
|
try:
|
||||||
# can fail for abstract types
|
# can fail for abstract types
|
||||||
op = Operation.new_from_name(nickname)
|
intro = Introspect.get(nickname)
|
||||||
|
|
||||||
# we are only interested in non-deprecated operations
|
# we are only interested in non-deprecated operations
|
||||||
if (op.get_flags() & _OPERATION_DEPRECATED) == 0:
|
if (intro.flags & _OPERATION_DEPRECATED) == 0:
|
||||||
all_nicknames.append(nickname)
|
all_nicknames.append(nickname)
|
||||||
except Error:
|
except Error:
|
||||||
pass
|
pass
|
||||||
@ -53,15 +55,50 @@ def gen_function_list():
|
|||||||
|
|
||||||
type_map(type_from_name('VipsOperation'), add_nickname)
|
type_map(type_from_name('VipsOperation'), add_nickname)
|
||||||
|
|
||||||
# add 'missing' synonyms by hand
|
|
||||||
all_nicknames.append('crop')
|
|
||||||
|
|
||||||
# make list unique and sort
|
# make list unique and sort
|
||||||
all_nicknames = list(set(all_nicknames))
|
all_nicknames = list(set(all_nicknames))
|
||||||
all_nicknames.sort()
|
all_nicknames.sort()
|
||||||
|
|
||||||
|
# make dict with overloads
|
||||||
|
overloads = {
|
||||||
|
'bandbool': ['bandand', 'bandor', 'bandeor', 'bandmean'],
|
||||||
|
'bandjoin': ['bandjoin2'],
|
||||||
|
'bandjoin_const': ['bandjoin_const1'],
|
||||||
|
'boolean': ['andimage', 'orimage', 'eorimage', 'lshift', 'rshift'],
|
||||||
|
'cast': ['cast_uchar', 'cast_char', 'cast_ushort', 'cast_short' 'cast_uint', 'cast_int', 'cast_float',
|
||||||
|
'cast_double', 'cast_complex', 'cast_dpcomplex'],
|
||||||
|
'complex': ['polar', 'rect', 'conj'],
|
||||||
|
'complex2': ['cross_phase'],
|
||||||
|
'complexget': ['real', 'imag'],
|
||||||
|
'draw_circle': ['draw_circle1'],
|
||||||
|
'draw_flood': ['draw_flood'],
|
||||||
|
'draw_line': ['draw_line1'],
|
||||||
|
'draw_mask': ['draw_mask1'],
|
||||||
|
'draw_rect': ['rect', 'draw_rect1', 'draw_point', 'draw_point1'],
|
||||||
|
'extract_area': ['crop'],
|
||||||
|
'linear': ['linear1'],
|
||||||
|
'math': ['sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'exp', 'exp10', 'log', 'log10'],
|
||||||
|
'math2': ['pow', 'wop'],
|
||||||
|
'rank': ['median'],
|
||||||
|
'relational': ['equal', 'notequal', 'less', 'lesseq', 'more', 'moreeq'],
|
||||||
|
'remainder_const': ['remainder_const1'],
|
||||||
|
'round': ['floor', 'ceil', 'rint'],
|
||||||
|
}
|
||||||
|
|
||||||
|
overloads['boolean_const'] = [o + '_const' for o in overloads['boolean']] + ['boolean_const1'] + \
|
||||||
|
[o + '_const1' for o in overloads['boolean']]
|
||||||
|
|
||||||
|
overloads['math2_const'] = [o + '_const' for o in overloads['boolean']] + ['math2_const1'] + \
|
||||||
|
[o + '_const1' for o in overloads['boolean']]
|
||||||
|
|
||||||
|
overloads['relational_const'] = [o + '_const' for o in overloads['relational']] + ['relational_const1'] + \
|
||||||
|
[o + '_const1' for o in overloads['relational']]
|
||||||
|
|
||||||
for nickname in all_nicknames:
|
for nickname in all_nicknames:
|
||||||
gen_function(nickname)
|
result = gen_function(nickname)
|
||||||
|
if nickname in overloads:
|
||||||
|
result = result.replace('()', '(), ' + (', '.join('vips_{}()'.format(n) for n in overloads[nickname])))
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
1
test/.gitignore
vendored
1
test/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
test_descriptors
|
test_descriptors
|
||||||
|
test_streams
|
||||||
|
@ -1,210 +0,0 @@
|
|||||||
#! /bin/bash
|
|
||||||
|
|
||||||
# test_streams - temporary wrapper script for .libs/test_streams
|
|
||||||
# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-11
|
|
||||||
#
|
|
||||||
# The test_streams program cannot be directly executed until all the libtool
|
|
||||||
# libraries that it depends on are installed.
|
|
||||||
#
|
|
||||||
# This wrapper script should never be moved out of the build directory.
|
|
||||||
# If it is, it will not operate correctly.
|
|
||||||
|
|
||||||
# Sed substitution that helps us do robust quoting. It backslashifies
|
|
||||||
# metacharacters that are still active within double-quoted strings.
|
|
||||||
sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
|
|
||||||
|
|
||||||
# Be Bourne compatible
|
|
||||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
|
||||||
emulate sh
|
|
||||||
NULLCMD=:
|
|
||||||
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
|
||||||
# is contrary to our usage. Disable this feature.
|
|
||||||
alias -g '${1+"$@"}'='"$@"'
|
|
||||||
setopt NO_GLOB_SUBST
|
|
||||||
else
|
|
||||||
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
|
||||||
fi
|
|
||||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
|
||||||
DUALCASE=1; export DUALCASE # for MKS sh
|
|
||||||
|
|
||||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
|
||||||
# if CDPATH is set.
|
|
||||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
|
||||||
|
|
||||||
relink_command=""
|
|
||||||
|
|
||||||
# This environment variable determines our operation mode.
|
|
||||||
if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
|
|
||||||
# install mode needs the following variables:
|
|
||||||
generated_by_libtool_version='2.4.6'
|
|
||||||
notinst_deplibs=' ../libvips/libvips.la'
|
|
||||||
else
|
|
||||||
# When we are sourced in execute mode, $file and $ECHO are already set.
|
|
||||||
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
|
|
||||||
file="$0"
|
|
||||||
|
|
||||||
# A function that is used when there is no print builtin or printf.
|
|
||||||
func_fallback_echo ()
|
|
||||||
{
|
|
||||||
eval 'cat <<_LTECHO_EOF
|
|
||||||
$1
|
|
||||||
_LTECHO_EOF'
|
|
||||||
}
|
|
||||||
ECHO="printf %s\\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Very basic option parsing. These options are (a) specific to
|
|
||||||
# the libtool wrapper, (b) are identical between the wrapper
|
|
||||||
# /script/ and the wrapper /executable/ that is used only on
|
|
||||||
# windows platforms, and (c) all begin with the string --lt-
|
|
||||||
# (application programs are unlikely to have options that match
|
|
||||||
# this pattern).
|
|
||||||
#
|
|
||||||
# There are only two supported options: --lt-debug and
|
|
||||||
# --lt-dump-script. There is, deliberately, no --lt-help.
|
|
||||||
#
|
|
||||||
# The first argument to this parsing function should be the
|
|
||||||
# script's ../libtool value, followed by no.
|
|
||||||
lt_option_debug=
|
|
||||||
func_parse_lt_options ()
|
|
||||||
{
|
|
||||||
lt_script_arg0=$0
|
|
||||||
shift
|
|
||||||
for lt_opt
|
|
||||||
do
|
|
||||||
case "$lt_opt" in
|
|
||||||
--lt-debug) lt_option_debug=1 ;;
|
|
||||||
--lt-dump-script)
|
|
||||||
lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'`
|
|
||||||
test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=.
|
|
||||||
lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'`
|
|
||||||
cat "$lt_dump_D/$lt_dump_F"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
--lt-*)
|
|
||||||
$ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Print the debug banner immediately:
|
|
||||||
if test -n "$lt_option_debug"; then
|
|
||||||
echo "test_streams:test_streams:$LINENO: libtool wrapper (GNU libtool) 2.4.6 Debian-2.4.6-11" 1>&2
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Used when --lt-debug. Prints its arguments to stdout
|
|
||||||
# (redirection is the responsibility of the caller)
|
|
||||||
func_lt_dump_args ()
|
|
||||||
{
|
|
||||||
lt_dump_args_N=1;
|
|
||||||
for lt_arg
|
|
||||||
do
|
|
||||||
$ECHO "test_streams:test_streams:$LINENO: newargv[$lt_dump_args_N]: $lt_arg"
|
|
||||||
lt_dump_args_N=`expr $lt_dump_args_N + 1`
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Core function for launching the target application
|
|
||||||
func_exec_program_core ()
|
|
||||||
{
|
|
||||||
|
|
||||||
if test -n "$lt_option_debug"; then
|
|
||||||
$ECHO "test_streams:test_streams:$LINENO: newargv[0]: $progdir/$program" 1>&2
|
|
||||||
func_lt_dump_args ${1+"$@"} 1>&2
|
|
||||||
fi
|
|
||||||
exec "$progdir/$program" ${1+"$@"}
|
|
||||||
|
|
||||||
$ECHO "$0: cannot exec $program $*" 1>&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# A function to encapsulate launching the target application
|
|
||||||
# Strips options in the --lt-* namespace from $@ and
|
|
||||||
# launches target application with the remaining arguments.
|
|
||||||
func_exec_program ()
|
|
||||||
{
|
|
||||||
case " $* " in
|
|
||||||
*\ --lt-*)
|
|
||||||
for lt_wr_arg
|
|
||||||
do
|
|
||||||
case $lt_wr_arg in
|
|
||||||
--lt-*) ;;
|
|
||||||
*) set x "$@" "$lt_wr_arg"; shift;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done ;;
|
|
||||||
esac
|
|
||||||
func_exec_program_core ${1+"$@"}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Parse options
|
|
||||||
func_parse_lt_options "$0" ${1+"$@"}
|
|
||||||
|
|
||||||
# Find the directory that this script lives in.
|
|
||||||
thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'`
|
|
||||||
test "x$thisdir" = "x$file" && thisdir=.
|
|
||||||
|
|
||||||
# Follow symbolic links until we get to the real thisdir.
|
|
||||||
file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'`
|
|
||||||
while test -n "$file"; do
|
|
||||||
destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'`
|
|
||||||
|
|
||||||
# If there was a directory component, then change thisdir.
|
|
||||||
if test "x$destdir" != "x$file"; then
|
|
||||||
case "$destdir" in
|
|
||||||
[\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
|
|
||||||
*) thisdir="$thisdir/$destdir" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
file=`$ECHO "$file" | /bin/sed 's%^.*/%%'`
|
|
||||||
file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'`
|
|
||||||
done
|
|
||||||
|
|
||||||
# Usually 'no', except on cygwin/mingw when embedded into
|
|
||||||
# the cwrapper.
|
|
||||||
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
|
|
||||||
if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
|
|
||||||
# special case for '.'
|
|
||||||
if test "$thisdir" = "."; then
|
|
||||||
thisdir=`pwd`
|
|
||||||
fi
|
|
||||||
# remove .libs from thisdir
|
|
||||||
case "$thisdir" in
|
|
||||||
*[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;;
|
|
||||||
.libs ) thisdir=. ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try to get the absolute directory name.
|
|
||||||
absdir=`cd "$thisdir" && pwd`
|
|
||||||
test -n "$absdir" && thisdir="$absdir"
|
|
||||||
|
|
||||||
program='test_streams'
|
|
||||||
progdir="$thisdir/.libs"
|
|
||||||
|
|
||||||
|
|
||||||
if test -f "$progdir/$program"; then
|
|
||||||
# Add our own library path to LD_LIBRARY_PATH
|
|
||||||
LD_LIBRARY_PATH="/home/john/GIT/libvips/libvips/.libs:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"
|
|
||||||
|
|
||||||
# Some systems cannot cope with colon-terminated LD_LIBRARY_PATH
|
|
||||||
# The second colon is a workaround for a bug in BeOS R4 sed
|
|
||||||
LD_LIBRARY_PATH=`$ECHO "$LD_LIBRARY_PATH" | /bin/sed 's/::*$//'`
|
|
||||||
|
|
||||||
export LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
|
|
||||||
# Run the actual program with our arguments.
|
|
||||||
func_exec_program ${1+"$@"}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# The program doesn't exist.
|
|
||||||
$ECHO "$0: error: '$progdir/$program' does not exist" 1>&2
|
|
||||||
$ECHO "This script is just a wrapper for $program." 1>&2
|
|
||||||
$ECHO "See the libtool documentation for more information." 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
Loading…
Reference in New Issue
Block a user