required C++ output params were broken
see https://github.com/jcupitt/libvips/pull/213 this now works: VImage rows; VImage cols = in.profile( &rows );
This commit is contained in:
parent
ca9cab48cc
commit
6440830315
|
@ -1,4 +1,5 @@
|
||||||
30/12/14 started 7.42.2
|
30/12/14 started 7.42.2
|
||||||
|
- C++ required output params were broken, thanks Lovell
|
||||||
- allow c++ set enum from string
|
- allow c++ set enum from string
|
||||||
- display param default and range in usage
|
- display param default and range in usage
|
||||||
- better docs
|
- better docs
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* compile with:
|
* compile with:
|
||||||
*
|
*
|
||||||
* g++ -g -Wall avg.cc `pkg-config vips-cpp --cflags --libs`
|
* g++ -g -Wall avg.cpp `pkg-config vips-cpp --cflags --libs`
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
using namespace vips8;
|
using namespace vips;
|
||||||
|
|
||||||
int
|
int
|
||||||
main( int argc, char **argv )
|
main( int argc, char **argv )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* compile with:
|
* compile with:
|
||||||
*
|
*
|
||||||
* g++ -g -Wall embed.cc `pkg-config vips-cpp --cflags --libs`
|
* g++ -g -Wall embed.cpp `pkg-config vips-cpp --cflags --libs`
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
using namespace vips8;
|
using namespace vips;
|
||||||
|
|
||||||
int
|
int
|
||||||
main( int argc, char **argv )
|
main( int argc, char **argv )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* compile with:
|
* compile with:
|
||||||
*
|
*
|
||||||
* g++ -g -Wall invert.cc `pkg-config vips-cpp --cflags --libs`
|
* g++ -g -Wall invert.cpp `pkg-config vips-cpp --cflags --libs`
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
using namespace vips8;
|
using namespace vips;
|
||||||
|
|
||||||
int
|
int
|
||||||
main( int argc, char **argv )
|
main( int argc, char **argv )
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* compile with:
|
||||||
|
*
|
||||||
|
* g++ -g -Wall profile.cpp `pkg-config vips-cpp --cflags --libs`
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DEBUG
|
||||||
|
|
||||||
|
#include <vips/vips8>
|
||||||
|
|
||||||
|
using namespace vips;
|
||||||
|
|
||||||
|
int
|
||||||
|
main( int argc, char **argv )
|
||||||
|
{
|
||||||
|
GOptionContext *context;
|
||||||
|
GOptionGroup *main_group;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if( vips_init( argv[0] ) )
|
||||||
|
vips_error_exit( NULL );
|
||||||
|
|
||||||
|
context = g_option_context_new( "" );
|
||||||
|
|
||||||
|
main_group = g_option_group_new( NULL, NULL, NULL, NULL, NULL );
|
||||||
|
g_option_context_set_main_group( context, main_group );
|
||||||
|
g_option_context_add_group( context, vips_get_option_group() );
|
||||||
|
|
||||||
|
if( !g_option_context_parse( context, &argc, &argv, &error ) ) {
|
||||||
|
if( error ) {
|
||||||
|
fprintf( stderr, "%s\n", error->message );
|
||||||
|
g_error_free( error );
|
||||||
|
}
|
||||||
|
|
||||||
|
vips_error_exit( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
VImage in = VImage::new_from_file( argv[1] );
|
||||||
|
|
||||||
|
VImage rows;
|
||||||
|
VImage cols = in.profile( &rows );
|
||||||
|
|
||||||
|
rows.write_to_file( argv[2] );
|
||||||
|
cols.write_to_file( argv[3] );
|
||||||
|
}
|
||||||
|
|
||||||
|
vips_shutdown();
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
|
@ -104,7 +104,7 @@ def find_first_output(op, required):
|
||||||
def cppize(name):
|
def cppize(name):
|
||||||
return re.sub('-', '_', name)
|
return re.sub('-', '_', name)
|
||||||
|
|
||||||
def gen_arg_list(required):
|
def gen_arg_list(op, required):
|
||||||
first = True
|
first = True
|
||||||
for prop in required:
|
for prop in required:
|
||||||
if not first:
|
if not first:
|
||||||
|
@ -113,6 +113,12 @@ def gen_arg_list(required):
|
||||||
first = False
|
first = False
|
||||||
|
|
||||||
print get_ctype(prop),
|
print get_ctype(prop),
|
||||||
|
|
||||||
|
# output params are passed by reference
|
||||||
|
flags = op.get_argument_flags(prop.name)
|
||||||
|
if flags & Vips.ArgumentFlags.OUTPUT:
|
||||||
|
print '*',
|
||||||
|
|
||||||
print cppize(prop.name),
|
print cppize(prop.name),
|
||||||
|
|
||||||
if not first:
|
if not first:
|
||||||
|
@ -142,7 +148,7 @@ def gen_operation(cls):
|
||||||
|
|
||||||
print 'VImage::%s(' % nickname,
|
print 'VImage::%s(' % nickname,
|
||||||
|
|
||||||
gen_arg_list(required)
|
gen_arg_list(op, required)
|
||||||
|
|
||||||
print ')'
|
print ')'
|
||||||
print ' throw( VError )'
|
print ' throw( VError )'
|
||||||
|
@ -167,7 +173,7 @@ def gen_operation(cls):
|
||||||
else:
|
else:
|
||||||
flags = op.get_argument_flags(prop.name)
|
flags = op.get_argument_flags(prop.name)
|
||||||
arg = cppize(prop.name)
|
arg = cppize(prop.name)
|
||||||
if flags & Vips.ArgumentFlags.OUTPUT:
|
if flags & Vips.ArgumentFlags.OUTPUT and prop == result:
|
||||||
arg = '&' + arg
|
arg = '&' + arg
|
||||||
|
|
||||||
print 'set( "%s", %s )' % (prop.name, arg),
|
print 'set( "%s", %s )' % (prop.name, arg),
|
||||||
|
|
|
@ -94,7 +94,7 @@ def find_first_output(op, required):
|
||||||
def cppize(name):
|
def cppize(name):
|
||||||
return re.sub('-', '_', name)
|
return re.sub('-', '_', name)
|
||||||
|
|
||||||
def gen_arg_list(required):
|
def gen_arg_list(op, required):
|
||||||
first = True
|
first = True
|
||||||
for prop in required:
|
for prop in required:
|
||||||
if not first:
|
if not first:
|
||||||
|
@ -103,6 +103,12 @@ def gen_arg_list(required):
|
||||||
first = False
|
first = False
|
||||||
|
|
||||||
print get_ctype(prop),
|
print get_ctype(prop),
|
||||||
|
|
||||||
|
# output params are passed by reference
|
||||||
|
flags = op.get_argument_flags(prop.name)
|
||||||
|
if flags & Vips.ArgumentFlags.OUTPUT:
|
||||||
|
print '*',
|
||||||
|
|
||||||
print cppize(prop.name),
|
print cppize(prop.name),
|
||||||
|
|
||||||
if not first:
|
if not first:
|
||||||
|
@ -136,7 +142,7 @@ def gen_operation(cls):
|
||||||
|
|
||||||
print '%s(' % nickname,
|
print '%s(' % nickname,
|
||||||
|
|
||||||
gen_arg_list(required)
|
gen_arg_list(op, required)
|
||||||
|
|
||||||
print ')'
|
print ')'
|
||||||
print ' throw( VError );'
|
print ' throw( VError );'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// headers for vips operations
|
// headers for vips operations
|
||||||
// Thu Dec 18 11:24:18 GMT 2014
|
// Tue Jan 6 11:41:51 GMT 2015
|
||||||
// this file is generated automatically, do not edit!
|
// this file is generated automatically, do not edit!
|
||||||
|
|
||||||
static void system( char * cmd_format , VOption *options = 0 )
|
static void system( char * cmd_format , VOption *options = 0 )
|
||||||
|
@ -70,9 +70,9 @@ VImage hough_line( VOption *options = 0 )
|
||||||
throw( VError );
|
throw( VError );
|
||||||
VImage hough_circle( VOption *options = 0 )
|
VImage hough_circle( VOption *options = 0 )
|
||||||
throw( VError );
|
throw( VError );
|
||||||
VImage project( VImage rows , VOption *options = 0 )
|
VImage project( VImage * rows , VOption *options = 0 )
|
||||||
throw( VError );
|
throw( VError );
|
||||||
VImage profile( VImage rows , VOption *options = 0 )
|
VImage profile( VImage * rows , VOption *options = 0 )
|
||||||
throw( VError );
|
throw( VError );
|
||||||
VImage measure( int h , int v , VOption *options = 0 )
|
VImage measure( int h , int v , VOption *options = 0 )
|
||||||
throw( VError );
|
throw( VError );
|
||||||
|
@ -80,8 +80,6 @@ std::vector<double> getpoint( int x , int y , VOption *options = 0 )
|
||||||
throw( VError );
|
throw( VError );
|
||||||
VImage copy( VOption *options = 0 )
|
VImage copy( VOption *options = 0 )
|
||||||
throw( VError );
|
throw( VError );
|
||||||
VImage blockcache( VOption *options = 0 )
|
|
||||||
throw( VError );
|
|
||||||
VImage tilecache( VOption *options = 0 )
|
VImage tilecache( VOption *options = 0 )
|
||||||
throw( VError );
|
throw( VError );
|
||||||
VImage linecache( VOption *options = 0 )
|
VImage linecache( VOption *options = 0 )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// bodies for vips operations
|
// bodies for vips operations
|
||||||
// Thu Dec 18 11:24:06 GMT 2014
|
// Tue Jan 6 11:44:30 GMT 2015
|
||||||
// this file is generated automatically, do not edit!
|
// this file is generated automatically, do not edit!
|
||||||
|
|
||||||
void VImage::system( char * cmd_format , VOption *options )
|
void VImage::system( char * cmd_format , VOption *options )
|
||||||
|
@ -467,7 +467,7 @@ VImage VImage::hough_circle( VOption *options )
|
||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::project( VImage rows , VOption *options )
|
VImage VImage::project( VImage * rows , VOption *options )
|
||||||
throw( VError )
|
throw( VError )
|
||||||
{
|
{
|
||||||
VImage columns;
|
VImage columns;
|
||||||
|
@ -476,12 +476,12 @@ VImage VImage::project( VImage rows , VOption *options )
|
||||||
(options ? options : VImage::option()) ->
|
(options ? options : VImage::option()) ->
|
||||||
set( "in", *this ) ->
|
set( "in", *this ) ->
|
||||||
set( "columns", &columns ) ->
|
set( "columns", &columns ) ->
|
||||||
set( "rows", &rows ) );
|
set( "rows", rows ) );
|
||||||
|
|
||||||
return( columns );
|
return( columns );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::profile( VImage rows , VOption *options )
|
VImage VImage::profile( VImage * rows , VOption *options )
|
||||||
throw( VError )
|
throw( VError )
|
||||||
{
|
{
|
||||||
VImage columns;
|
VImage columns;
|
||||||
|
@ -490,7 +490,7 @@ VImage VImage::profile( VImage rows , VOption *options )
|
||||||
(options ? options : VImage::option()) ->
|
(options ? options : VImage::option()) ->
|
||||||
set( "in", *this ) ->
|
set( "in", *this ) ->
|
||||||
set( "columns", &columns ) ->
|
set( "columns", &columns ) ->
|
||||||
set( "rows", &rows ) );
|
set( "rows", rows ) );
|
||||||
|
|
||||||
return( columns );
|
return( columns );
|
||||||
}
|
}
|
||||||
|
@ -538,19 +538,6 @@ VImage VImage::copy( VOption *options )
|
||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
VImage VImage::blockcache( VOption *options )
|
|
||||||
throw( VError )
|
|
||||||
{
|
|
||||||
VImage out;
|
|
||||||
|
|
||||||
call( "blockcache" ,
|
|
||||||
(options ? options : VImage::option()) ->
|
|
||||||
set( "out", &out ) ->
|
|
||||||
set( "in", *this ) );
|
|
||||||
|
|
||||||
return( out );
|
|
||||||
}
|
|
||||||
|
|
||||||
VImage VImage::tilecache( VOption *options )
|
VImage VImage::tilecache( VOption *options )
|
||||||
throw( VError )
|
throw( VError )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue