#!/usr/bin/python
# walk vips and generate a list of all operators and their descriptions
# for docs
# sample output:
#
# gamma
# gamma an image
# vips_gamma()
#
from gi.repository import Vips, GObject
vips_type_operation = GObject.GType.from_name("VipsOperation")
def gen_function(cls):
op = Vips.Operation.new(cls.name)
gtype = Vips.type_find("VipsOperation", cls.name)
nickname = Vips.nickname_find(gtype)
print ''
print ' %s' % nickname
print ' %s' % op.get_description()
print ' vips_%s()' % nickname
print '
'
# we have a few synonyms ... don't generate twice
generated = {}
def gen_function_list(cls):
if not cls.is_abstract():
gtype = Vips.type_find("VipsOperation", cls.name)
nickname = Vips.nickname_find(gtype)
if not nickname in generated:
gen_function(cls)
generated[nickname] = True
if len(cls.children) > 0:
for child in cls.children:
gen_function_list(child)
if __name__ == '__main__':
gen_function_list(vips_type_operation)