support many-returns ops in Python
add various %apply rules to move values returned via args into the result
This commit is contained in:
parent
190d438ec1
commit
b51faee8ca
@ -2,6 +2,7 @@
|
||||
- version bump
|
||||
- added vips_foreign_find_save_options()/vips_foreign_find_load_options()
|
||||
- delayed write to foreign via a "w" image was not working
|
||||
- support operations with many returns in Python
|
||||
|
||||
20/8/11 started 7.27.0
|
||||
- version bump for new dev cycle
|
||||
|
7
TODO
7
TODO
@ -1,8 +1,5 @@
|
||||
- swig is not wrapping ops which return more than one arg by reference
|
||||
correctly .. eg. im_correl()
|
||||
|
||||
|
||||
|
||||
- swig is not wrapping im_project() correctly ... returns an extra VImage via
|
||||
a param
|
||||
|
||||
- fft with odd width or height is broken ... DC ends up in the wring place
|
||||
|
||||
|
@ -444,14 +444,6 @@ void VImage::initdesc( int x, int y, int b,
|
||||
verror();
|
||||
}
|
||||
|
||||
// used to test SWIG wrappers with output args
|
||||
double VImage::test_member( double a, double b, double *c, double *d )
|
||||
{
|
||||
*c = a + b;
|
||||
*d = a - b;
|
||||
return a * b;
|
||||
}
|
||||
|
||||
// Create a Vargv from a name
|
||||
Vargv::Vargv( const char *name )
|
||||
{
|
||||
|
@ -288,9 +288,6 @@ public:
|
||||
void initdesc( int, int, int, TBandFmt, TCoding, TType,
|
||||
float = 1.0, float = 1.0, int = 0, int = 0 ) throw( VError );
|
||||
|
||||
// test member for SWIG output args
|
||||
double test_member( double a, double b, double *c, double *d );
|
||||
|
||||
/* Insert automatically generated headers.
|
||||
*/
|
||||
#include "vipsc++.h"
|
||||
|
@ -75,13 +75,53 @@ struct VBuffer {
|
||||
$1.size = buffer_len;
|
||||
}
|
||||
|
||||
/* Functions which return extra values though their parameters need special
|
||||
* typemaps.
|
||||
*/
|
||||
|
||||
// double maxpos_avg( double& maxpos_avg_y, double& maxpos_avg_out )
|
||||
%apply double *OUTPUT { double & maxpos_avg_y };
|
||||
%apply double *OUTPUT { double & maxpos_avg_out };
|
||||
|
||||
// VImage system_image( char* system_image_in_format, char* system_image_out_format, char* system_image_command, char*& system_image_log )
|
||||
%cstring_output_allocate(char **system_image_log, g_free(*$1));
|
||||
|
||||
// VImage segment( int& segment_segments )
|
||||
%apply int *OUTPUT { int & segment_segments };
|
||||
|
||||
// VImage project( VImage& project_vout ) throw( VError );
|
||||
// nope ... not sure how to handle this one
|
||||
//%apply VImage *OUTPUT { VImage & project_vout };
|
||||
|
||||
// VImage label_regions( int& label_regions_segments )
|
||||
%apply int *OUTPUT { int & label_regions_segments };
|
||||
|
||||
// double correl( VImage correl_sec, int correl_xref, int correl_yref, int correl_xsec, int correl_ysec, int correl_hwindowsize, int correl_hsearchsize, int& correl_x, int& correl_y )
|
||||
%apply int *OUTPUT { int & correl_x };
|
||||
%apply int *OUTPUT { int & correl_y };
|
||||
|
||||
// int _find_lroverlap( VImage _find_lroverlap_sec, int _find_lroverlap_bandno, int _find_lroverlap_xr, int _find_lroverlap_yr, int _find_lroverlap_xs, int _find_lroverlap_ys, int _find_lroverlap_halfcorrelation, int _find_lroverlap_halfarea, int& _find_lroverlap_dy0, double& _find_lroverlap_scale1, double& _find_lroverlap_angle1, double& _find_lroverlap_dx1, double& _find_lroverlap_dy1 )
|
||||
%apply int *OUTPUT { int & _find_lroverlap_dy0 };
|
||||
%apply double *OUTPUT { double & _find_lroverlap_scale1 };
|
||||
%apply double *OUTPUT { double & _find_lroverlap_angle1 };
|
||||
%apply double *OUTPUT { double & _find_lroverlap_dx1 };
|
||||
%apply double *OUTPUT { double & _find_lroverlap_dy1 };
|
||||
|
||||
// int _find_tboverlap( VImage _find_tboverlap_sec, int _find_tboverlap_bandno, int _find_tboverlap_xr, int _find_tboverlap_yr, int _find_tboverlap_xs, int _find_tboverlap_ys, int _find_tboverlap_halfcorrelation, int _find_tboverlap_halfarea, int& _find_tboverlap_dy0, double& _find_tboverlap_scale1, double& _find_tboverlap_angle1, double& _find_tboverlap_dx1, double& _find_tboverlap_dy1 )
|
||||
%apply int *OUTPUT { int & _find_tboverlap_dy0 };
|
||||
%apply double *OUTPUT { double & _find_tboverlap_scale1 };
|
||||
%apply double *OUTPUT { double & _find_tboverlap_angle1 };
|
||||
%apply double *OUTPUT { double & _find_tboverlap_dx1 };
|
||||
%apply double *OUTPUT { double & _find_tboverlap_dy1 };
|
||||
|
||||
// double maxpos_subpel( double& maxpos_subpel_y )
|
||||
%apply double *OUTPUT { double & maxpos_subpel_y };
|
||||
|
||||
/* Need the expanded VImage.h in this directory, rather than the usual
|
||||
* vips/VImage.h. SWIG b0rks on #include inside class definitions.
|
||||
*/
|
||||
%include VImage.h
|
||||
|
||||
|
||||
|
||||
%extend vips::VImage {
|
||||
public:
|
||||
VBuffer tobuffer () throw (VError)
|
||||
|
@ -1,4 +0,0 @@
|
||||
from vipsCC import *
|
||||
|
||||
a = VImage.VImage("/home/john/pics/shark.jpg")
|
||||
print a.maxpos_avg()
|
Loading…
Reference in New Issue
Block a user