From b6aa0808dca1ccac0b7570824df6c84d53b69cb5 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 17 Dec 2007 19:00:09 +0000 Subject: [PATCH] stuff --- python/vipsCC/VImage.i | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/python/vipsCC/VImage.i b/python/vipsCC/VImage.i index e30e2730..9e1f10f7 100644 --- a/python/vipsCC/VImage.i +++ b/python/vipsCC/VImage.i @@ -35,18 +35,41 @@ namespace std { %template(ImageVector) vector; } -/* VImage defines a lot of other operator overloads ... but SWIGs autowrapping - * doesn't work well for them. Do by hand later. - */ %include vips/VImage.h +/* Search for a VIPS operation that matches a name and a set of args. + */ +%inline %{ + +/* We need to wrap by hand, hmm + */ + +%} + /* Now wrap SWIG's VImage_core with our own VImage class which does operations * from the VIPS operation database. */ %pythoncode %{ +# proxy class to hold a method name during call +class VImage_method: + def __init__ (self,name): + self.method = name + + def __call__ (self, obj_to_call, arguments): + method = obj_to_call.__getattr__ (self.method) + print "VImage_method: calling ", self.method + print " with args ", arguments + method (arguments) + class VImage (VImage_core): + def __init (self, *args): + VImage_core.__init__ (self, *args) def __getattr__ (self, name): print "VImage getattr: ", name + if (is_a_valid_method (name)): + return VImage_method (name) + else + raise AttributeError %} /* Helper code for vips_init().