Top | ![]() |
![]() |
![]() |
![]() |
enum | VipsArgumentFlags |
#define | VIPS_ARGUMENT_REQUIRED_INPUT |
#define | VIPS_ARGUMENT_OPTIONAL_INPUT |
#define | VIPS_ARGUMENT_REQUIRED_OUTPUT |
#define | VIPS_ARGUMENT_OPTIONAL_OUTPUT |
VipsArgument | |
VipsArgumentClass | |
VipsArgumentInstance | |
typedef | VipsArgumentTable |
#define | VIPS_ARGUMENT_COLLECT_END |
GObject ╰── VipsObject ├── VipsOperation ├── VipsImage ├── VipsInterpolate ├── VipsRegion ╰── VipsThreadState
The VipsObject class and associated types and macros.
VipsObject is the base class for all objects in libvips. It has the following major features:
Functional class creation Vips objects have a very regular lifecycle: initialise, build, use, destroy. They behave rather like function calls and are free of side-effects.
Run-time introspection Vips objects can be fully introspected at run-time. There is not need for a separate source-code analysis.
Command-line interface Vips objects have an automatic command-line line interface with a set of virtual methods.
#define VIPS_ARG_INTERPOLATE( CLASS, NAME, PRIORITY, LONG, DESC, FLAGS, OFFSET )
#define VIPS_ARG_DOUBLE( CLASS, NAME, PRIORITY, LONG, DESC, \ FLAGS, OFFSET, MIN, MAX, VALUE )
#define VIPS_ARG_INT( CLASS, NAME, PRIORITY, LONG, DESC, \ FLAGS, OFFSET, MIN, MAX, VALUE )
#define VIPS_ARG_UINT64( CLASS, NAME, PRIORITY, LONG, DESC, \ FLAGS, OFFSET, MIN, MAX, VALUE )
#define VIPS_ARG_ENUM( CLASS, NAME, PRIORITY, LONG, DESC, \ FLAGS, OFFSET, TYPE, VALUE )
#define VIPS_ARG_FLAGS( CLASS, NAME, PRIORITY, LONG, DESC, \ FLAGS, OFFSET, TYPE, VALUE )
#define VIPS_ARG_STRING( CLASS, NAME, PRIORITY, LONG, DESC, FLAGS, OFFSET, \ VALUE )
VipsArgumentInstance * vips__argument_get_instance (VipsArgumentClass *Param1
,VipsObject *Param2
);
Convenience ... given the VipsArgumentClass, get the VipsArgumentInstance.
VipsArgument * vips__argument_table_lookup (VipsArgumentTable *Param1
,GParamSpec *Param2
);
void vips__object_set_member (VipsObject *object
,GParamSpec *pspec
,GObject **member
,GObject *argument
);
void * (*VipsArgumentMapFn) (VipsObject *Param1
,GParamSpec *Param2
,VipsArgumentClass *Param3
,VipsArgumentInstance *Param4
,void *a
,void *b
);
void * vips_argument_map (VipsObject *object
,VipsArgumentMapFn fn
,void *a
,void *b
);
Loop over the vips_arguments to an object. Stop when fn
returns non-NULL
and return that value.
void * (*VipsArgumentClassMapFn) (VipsObjectClass *Param1
,GParamSpec *Param2
,VipsArgumentClass *Param3
,void *a
,void *b
);
void * vips_argument_class_map (VipsObjectClass *object_class
,VipsArgumentClassMapFn fn
,void *a
,void *b
);
And loop over a class. Same as ^^, but with no VipsArgumentInstance.
gboolean
vips_argument_class_needsstring (VipsArgumentClass *argument_class
);
int vips_object_get_argument (VipsObject *object
,const char *name
,GParamSpec **pspec
,VipsArgumentClass **argument_class
,VipsArgumentInstance **argument_instance
);
Look up the three things you need to work with a vips argument.
gboolean vips_object_argument_isset (VipsObject *object
,const char *name
);
Convenience: has an argument been assigned. Useful for bindings.
VipsArgumentFlags vips_object_get_argument_flags (VipsObject *object
,const char *name
);
Convenience: get the flags for an argument. Useful for bindings.
int vips_object_get_argument_priority (VipsObject *object
,const char *name
);
Convenience: get the priority for an argument. Useful for bindings.
void vips_object_set_property (GObject *gobject
,guint property_id
,const GValue *value
,GParamSpec *pspec
);
void vips_object_get_property (GObject *gobject
,guint property_id
,GValue *value
,GParamSpec *pspec
);
void vips_object_class_install_argument (VipsObjectClass *Param1
,GParamSpec *pspec
,VipsArgumentFlags flags
,int priority
,guint offset
);
int vips_object_set_argument_from_string (VipsObject *object
,const char *name
,const char *value
);
gboolean vips_object_argument_needsstring (VipsObject *object
,const char *name
);
int vips_object_get_argument_to_string (VipsObject *object
,const char *name
,const char *arg
);
void * (*VipsObjectSetArguments) (VipsObject *Param1
,void *Param2
,void *Param3
);
VipsObject * vips_object_new (GType type
,VipsObjectSetArguments set
,void *a
,void *b
);
g_object_new() the object, set any arguments with set
, call
vips_object_build()
and return the complete object.
int vips_object_set_valist (VipsObject *object
,va_list ap
);
See vips_object_set()
.
int vips_object_set (VipsObject *object
,...
);
Set a list of vips object arguments. For example:
vips_object_set (operation, "input", in, "output", &out, NULL);
Input arguments are given in-line, output arguments are given as pointers to where the output value should be written.
See also: vips_object_set_valist()
, vips_object_set_from_string()
.
int vips_object_set_from_string (VipsObject *object
,const char *string
);
Set object arguments from a string. The string can be something like "a=12", or "a = 12, b = 13", or "fred". The string can optionally be enclosed in brackets.
You'd typically use this between creating the object and building it.
See also: vips_object_set()
, vips_object_build()
,
vips_cache_operation_buildp()
.
VipsObject * vips_object_new_from_string (VipsObjectClass *object_class
,const char *p
);
void vips_object_to_string (VipsObject *object
,VipsBuf *buf
);
The inverse of vips_object_new_from_string()
: turn an object into eg.
"VipsInterpolateSnohalo1(blur=.333333)".
void * vips_object_map (VipsSListMap2Fn fn
,void *a
,void *b
);
Call a function for all alive objects.
Stop when fn
returns non-NULL
and return that value.
void * vips_type_map (GType base
,VipsTypeMap2Fn fn
,void *a
,void *b
);
Map over a type's children. Stop when fn
returns non-NULL
and return that value.
void * vips_type_map_all (GType base
,VipsTypeMapFn fn
,void *a
);
Map over a type's children, direct and indirect. Stop when fn
returns
non-NULL
and return that value.
void * vips_class_map_all (GType base
,VipsClassMapFn fn
,void *a
);
Loop over all the subclasses of a base type. Non-abstract classes only.
VipsObjectClass * vips_class_find (const char *basename
,const char *nickname
);
Search below basename, return the first class whose name or nickname matches.
VipsObject ** vips_object_local_array (VipsObject *parent
,int n
);
Make an array of NULL VipsObject pointers. When parent
closes, every
non-NULL pointer in the array will be unreffed and the array will be
freed. Handy for creating a set of temporary images for a function.
The array is NULL-terminated, ie. contains an extra NULL element at the end.
Example:
VipsObject **t; t = vips_object_local_array( a, 5 ); if( vips_add( a, b, &t[0], NULL ) || vips_invert( t[0], &t[1], NULL ) || vips_add( t[1], t[0], &t[2], NULL ) || vips_costra( t[2], out, NULL ) ) return( -1 );
See also: vips_object_local()
.
VipsArgumentFlags
is deprecated and should not be used in newly-written code.
Flags we associate with each object argument.
Have separate input & output flags. Both set is an error; neither set is OK.
Input gobjects are automatically reffed, output gobjects automatically ref us. We also automatically watch for "destroy" and unlink.
VIPS_ARGUMENT_SET_ALWAYS
is handy for arguments which are set from C. For
example, VipsImage::width is a property that gives access to the Xsize
member of struct _VipsImage. We default its 'assigned' to TRUE
since the field is always set directly by C.
VIPS_ARGUMENT_DEPRECATED
arguments are not shown in help text, are not
looked for if required, are not checked for "have-been-set". You can
deprecate a required argument, but you must obviously add a new required
argument if you do.
typedef struct { GParamSpec *pspec; /* pspec for this argument */ /* More stuff, see below */ } VipsArgument;
typedef struct { VipsArgument parent; /* The class of the object we are an arg for. */ VipsObjectClass *object_class; VipsArgumentFlags flags; int priority; /* Order args by this */ guint offset; /* G_STRUCT_OFFSET of member in object */ } VipsArgumentClass;
typedef struct { VipsArgument parent; /* The class we are part of. */ VipsArgumentClass *argument_class; /* The object we are attached to. */ VipsObject *object; /* Has been set. */ gboolean assigned; /* If this is an output argument, keep the id of our "close" handler * here. */ gulong close_id; /* We need to listen for "invalidate" on input images and send our own * "invalidate" out. If we go, we need to disconnect. */ gulong invalidate_id; } VipsArgumentInstance;
“description”
property“description” gchar *
Class description.
Flags: Read / Write
Default value: ""
“postbuild”
signalgint user_function (VipsObject *vipsobject, gpointer user_data)
Flags: Run Last
“postclose”
signalvoid user_function (VipsObject *vipsobject, gpointer user_data)
Flags: Run Last
“preclose”
signalvoid user_function (VipsObject *vipsobject, gpointer user_data)
Flags: Run Last