diff --git a/configure.in b/configure.in index a0cc703d..5545b8e4 100644 --- a/configure.in +++ b/configure.in @@ -55,7 +55,7 @@ vips_introspection_sources="$introspection_sources2" # add headers that form the public vips8 API .. don't do a find and exclude, # we end up excluding almost everything argh -headers="vips.h object.h image.h error.h format.h region.h interpolate.h header.h operation.h enumtypes.h arithmetic.h" +headers="vips.h object.h image.h error.h format.h interpolate.h header.h operation.h enumtypes.h arithmetic.h" for name in $headers; do vips_introspection_sources="$vips_introspection_sources include/vips/$name" done diff --git a/libvips/arithmetic/im_measure.c b/libvips/arithmetic/im_measure.c index b3e12d6a..d63c5085 100644 --- a/libvips/arithmetic/im_measure.c +++ b/libvips/arithmetic/im_measure.c @@ -147,7 +147,7 @@ measure_patches( IMAGE *im, double *coeff, } /** - * im_measure_area: + * im_measure_area: (skip) * @im: image to measure * @left: area of image containing chart * @top: area of image containing chart diff --git a/libvips/arithmetic/im_recomb.c b/libvips/arithmetic/im_recomb.c index ca6c8e1c..2b95d5d1 100644 --- a/libvips/arithmetic/im_recomb.c +++ b/libvips/arithmetic/im_recomb.c @@ -95,7 +95,7 @@ recomb_buf( void *bin, void *bout, int width, IMAGE *in, DOUBLEMASK *mat ) } /** - * im_recomb: + * im_recomb: (skip) * @in: input image * @out: output image * @recomb: recombination matrix diff --git a/libvips/arithmetic/im_stats.c b/libvips/arithmetic/im_stats.c index c7aa6254..ab234ffd 100644 --- a/libvips/arithmetic/im_stats.c +++ b/libvips/arithmetic/im_stats.c @@ -183,7 +183,7 @@ stats_scan( void *in, int n, void *seq, void *a, void *b ) } /** - * im_stats: + * im_stats: (skip) * @in: image to scan * * Find many image statistics in a single pass through the data. Returns a diff --git a/libvips/format/format.c b/libvips/format/format.c index b956a70b..9290b375 100644 --- a/libvips/format/format.c +++ b/libvips/format/format.c @@ -245,7 +245,7 @@ format_compare( VipsFormatClass *a, VipsFormatClass *b ) } /** - * vips_format_map: + * vips_format_map: (skip) * @fn: function to apply to each #VipsFormatClass * @a: user data * @b: user data diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index af90fd74..ec4752de 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -382,7 +382,7 @@ gboolean vips_image_isMSBfirst( VipsImage *image ); gboolean vips_image_isfile( VipsImage *image ); gboolean vips_image_ispartial( VipsImage *image ); -int vips_image_write_line( VipsImage *image, int ypos, PEL *linebuffer ); +int vips_image_write_line( VipsImage *image, int ypos, void *linebuffer ); int vips_image_wio_input( VipsImage *image ); int vips_image_wio_output( VipsImage *image ); diff --git a/libvips/include/vips/interpolate.h b/libvips/include/vips/interpolate.h index c2781241..ffb59952 100644 --- a/libvips/include/vips/interpolate.h +++ b/libvips/include/vips/interpolate.h @@ -61,7 +61,7 @@ typedef struct _VipsInterpolate { * interpolate the value at position (x, y) in "in". */ typedef void (*VipsInterpolateMethod)( VipsInterpolate *interpolate, - PEL *out, VipsRegion *in, double x, double y ); + void *out, VipsRegion *in, double x, double y ); typedef struct _VipsInterpolateClass { VipsObjectClass parent_class; @@ -88,7 +88,7 @@ typedef struct _VipsInterpolateClass { GType vips_interpolate_get_type( void ); void vips_interpolate( VipsInterpolate *interpolate, - PEL *out, VipsRegion *in, double x, double y ); + void *out, VipsRegion *in, double x, double y ); VipsInterpolateMethod vips_interpolate_get_method( VipsInterpolate *interpolate ); int vips_interpolate_get_window_size( VipsInterpolate *interpolate ); int vips_interpolate_get_window_offset( VipsInterpolate *interpolate ); diff --git a/libvips/include/vips/object.h b/libvips/include/vips/object.h index 87988d36..dc3554ea 100644 --- a/libvips/include/vips/object.h +++ b/libvips/include/vips/object.h @@ -152,11 +152,6 @@ typedef struct _VipsArgumentInstance { */ typedef GHashTable VipsArgumentTable; -VipsArgumentInstance *vips__argument_get_instance( - VipsArgumentClass *argument_class, - VipsObject *object); -VipsArgument *vips__argument_table_lookup( VipsArgumentTable *table, - GParamSpec *pspec); typedef void *(*VipsArgumentMapFn)( VipsObject *object, GParamSpec *pspec, VipsArgumentClass *argument_class, VipsArgumentInstance *argument_instance, void *a, void *b ); diff --git a/libvips/include/vips/private.h b/libvips/include/vips/private.h index cfbe348e..49be63b2 100644 --- a/libvips/include/vips/private.h +++ b/libvips/include/vips/private.h @@ -90,7 +90,7 @@ typedef struct { * update operation and we'd need to _remove() and _insert() on every list * operation. */ -typedef struct { +typedef struct _VipsBufferCacheList { GSList *buffers; /* GSList of VipsBuffer* */ GThread *thread; /* Just for sanity checking */ struct _VipsImage *im; @@ -99,7 +99,7 @@ typedef struct { /* What we track for each pixel buffer. */ -typedef struct { +typedef struct _VipsBuffer { int ref_count; /* # of regions referencing us */ struct _VipsImage *im; /* VipsImage we are attached to */ @@ -124,7 +124,7 @@ void vips_buffer_print( VipsBuffer *buffer ); /* Region types. */ -typedef enum region_type { +typedef enum _RegionType { VIPS_REGION_NONE, VIPS_REGION_BUFFER, /* a pixel buffer */ VIPS_REGION_OTHER_REGION, /* memory on another region */ @@ -166,6 +166,12 @@ int vips__image_write_prepare( struct _VipsImage *image ); */ void vips_arithmetic_operation_init( void ); +VipsArgumentInstance *vips__argument_get_instance( + VipsArgumentClass *argument_class, + VipsObject *object); +VipsArgument *vips__argument_table_lookup( VipsArgumentTable *table, + GParamSpec *pspec); + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/iofuncs/error.c b/libvips/iofuncs/error.c index e9866eaf..dbb20e3e 100644 --- a/libvips/iofuncs/error.c +++ b/libvips/iofuncs/error.c @@ -1101,7 +1101,7 @@ vips_check_hist( const char *domain, VipsImage *im ) } /** - * vips_check_imask: + * vips_check_imask: (skip) * @domain: the originating domain for the error message * @mask: mask to check * @@ -1129,7 +1129,7 @@ vips_check_imask( const char *domain, INTMASK *mask ) } /** - * vips_check_dmask: + * vips_check_dmask: (skip) * @domain: the originating domain for the error message * @mask: mask to check * @@ -1157,7 +1157,7 @@ vips_check_dmask( const char *domain, DOUBLEMASK *mask ) } /** - * vips_check_dmask_1d: + * vips_check_dmask_1d: (skip) * @domain: the originating domain for the error message * @mask: mask to check * diff --git a/libvips/iofuncs/header.c b/libvips/iofuncs/header.c index a632f3b9..abf3abae 100644 --- a/libvips/iofuncs/header.c +++ b/libvips/iofuncs/header.c @@ -415,7 +415,7 @@ vips_image_get_mode( VipsImage *image ) } /** - * vips_image_get_data: + * vips_image_get_data: (skip) * @image: image to get data for * * Return a pointer to the image's pixel data, if possible. This can involve @@ -877,7 +877,7 @@ vips_image_map_fn( VipsMeta *meta, VipsImageMapFn fn, void *a ) } /** - * vips_image_map: + * vips_image_map: (skip) * @image: image to map over * @fn: function to call for each header field * @a: user data for function @@ -1231,7 +1231,7 @@ meta_get_value( VipsImage *image, } /** - * vips_image_set_area: + * vips_image_set_area: (skip) * @image: image to attach the metadata to * @field: metadata name * @free_fn: free function for @data @@ -1256,7 +1256,7 @@ vips_image_set_area( VipsImage *image, const char *field, } /** - * vips_image_get_area: + * vips_image_get_area: (skip) * @image: image to get the metadata from * @field: metadata name * @data: return metadata value @@ -1401,7 +1401,7 @@ vips_ref_string_get_type( void ) } /** - * vips_blob_get: + * vips_blob_get: (skip) * @value: GValue to get from * @length: return the blob length here, optionally * @@ -1493,7 +1493,7 @@ vips_blob_get_type( void ) } /** - * vips_blob_set: + * vips_blob_set: (skip) * @value: GValue to set * @free_fn: free function for @data * @data: pointer to area of memory @@ -1529,7 +1529,7 @@ vips_blob_set( GValue *value, } /** - * vips_image_set_blob: + * vips_image_set_blob: (skip) * @image: image to attach the metadata to * @field: metadata name * @free_fn: free function for @data @@ -1557,7 +1557,7 @@ vips_image_set_blob( VipsImage *image, const char *field, } /** - * vips_image_get_blob: + * vips_image_get_blob: (skip) * @image: image to get the metadata from * @field: metadata name * @data: pointer to area of memory diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index bc17abb3..1aa8a729 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -1969,7 +1969,7 @@ vips__image_write_prepare( VipsImage *image ) * Returns: 0 on success, or -1 on error. */ int -vips_image_write_line( VipsImage *image, int ypos, PEL *linebuffer ) +vips_image_write_line( VipsImage *image, int ypos, void *linebuffer ) { int linesize = VIPS_IMAGE_SIZEOF_LINE( image ); diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index 2697021d..ff9ba4fd 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -238,7 +238,18 @@ vips_argument_table_destroy( VipsArgumentTable *table ) g_hash_table_destroy( table ); } -/* Loop over the vips_arguments to an object. +/** + * vips_argument_map: (skip) + * @object: object whose args should be enumerated + * @fn: call this function for every argument + * @a: client data + * @b: client data + * + * Loop over the vips_arguments to an object. Stop when @fn returns non-%NULL + * and return that value. + * + * Returns: %NULL if @fn returns %NULL for all arguments, otherwise the first + * non-%NULL value from @fn. */ void * vips_argument_map( VipsObject *object, @@ -1300,6 +1311,18 @@ vips_object_set_required( VipsObject *object, const char *value ) return( 0 ); } +/** + * vips_object_new: (skip) + * @type: object to create + * @set: set arguments with this + * @a: client data + * @b: client data + * + * g_object_new() the object, set any arguments with @set, call + * vips_object_build() and return the complete object. + * + * Returns: the new object + */ VipsObject * vips_object_new( GType type, VipsObjectSetArguments set, void *a, void *b ) { @@ -1462,7 +1485,12 @@ vips_object_to_string_optional( VipsObject *object, return( NULL ); } -/* The inverse of vips_object_new_from_string(): turn an object into eg. +/** + * vips_object_to_string: (skip) + * @object: object to stringify + * @buf: write string here + * + * The inverse of vips_object_new_from_string(): turn an object into eg. * "VipsInterpolateSnohalo1(blur=.333333)". */ void @@ -1502,6 +1530,18 @@ vips_object_map_sub( VipsObject *key, VipsObject *value, args->result = args->fn( key, args->a, args->b ); } +/** + * vips_object_map: (skip) + * @fn: function to call for all objects + * @a: client data + * @b: client data + * + * Call a function for all alive objects. + * Stop when @fn returns non-%NULL and return that value. + * + * Returns: %NULL if @fn returns %NULL for all arguments, otherwise the first + * non-%NULL value from @fn. + */ void * vips_object_map( VipsSListMap2Fn fn, void *a, void *b ) { @@ -1525,7 +1565,18 @@ vips_object_map( VipsSListMap2Fn fn, void *a, void *b ) return( args.result ); } -/* Map over all a type's children. +/** + * vips_type_map: (skip) + * @base: base type + * @fn: call this function for every type + * @a: client data + * @b: client data + * + * Map over a type's children. Stop when @fn returns non-%NULL + * and return that value. + * + * Returns: %NULL if @fn returns %NULL for all arguments, otherwise the first + * non-%NULL value from @fn. */ void * vips_type_map( GType base, VipsTypeMap2 fn, void *a, void *b ) @@ -1544,7 +1595,17 @@ vips_type_map( GType base, VipsTypeMap2 fn, void *a, void *b ) return( result ); } -/* Loop over all the subtypes of a base type. +/** + * vips_type_map_all: (skip) + * @base: base type + * @fn: call this function for every type + * @a: client data + * + * Map over a type's children, direct and indirect. Stop when @fn returns + * non-%NULL and return that value. + * + * Returns: %NULL if @fn returns %NULL for all arguments, otherwise the first + * non-%NULL value from @fn. */ void * vips_type_map_all( GType base, VipsTypeMap fn, void *a ) @@ -1558,18 +1619,28 @@ vips_type_map_all( GType base, VipsTypeMap fn, void *a ) return( result ); } -/* Loop over all the subclasses of a base type. +/** + * vips_class_map_all: (skip) + * @base: base type + * @fn: call this function for every class + * @a: client data + * + * Map over a class's subclasses, direct and indirect. Stop when @fn returns + * non-%NULL and return that value. + * + * Returns: %NULL if @fn returns %NULL for all arguments, otherwise the first + * non-%NULL value from @fn. */ void * -vips_class_map_all( GType type, VipsClassMap fn, void *a ) +vips_class_map_all( GType base, VipsClassMap fn, void *a ) { void *result; /* We never unref this ref, but we never unload classes * anyway, so so what. */ - if( !(result = fn( VIPS_OBJECT_CLASS( g_type_class_ref( type ) ), a )) ) - result = vips_type_map( type, + if( !(result = fn( VIPS_OBJECT_CLASS( g_type_class_ref( base ) ), a )) ) + result = vips_type_map( base, (VipsTypeMap2) vips_class_map_all, fn, a ); return( result ); @@ -1589,8 +1660,15 @@ test_name( VipsObjectClass *class, const char *nickname ) return( NULL ); } -/* Find a class ... search below base, return the first match on a nickname or - * a name. +/** + * vips_class_find: (skip) + * @basename: name of base class + * @nickname: search for a class with this nickname + * + * Search below basename, return the first class whose name or nickname + * matches. + * + * Returns: the found class. */ VipsObjectClass * vips_class_find( const char *basename, const char *nickname ) diff --git a/libvips/resample/bicubic.cpp b/libvips/resample/bicubic.cpp index ed5bac83..ddbb01a5 100644 --- a/libvips/resample/bicubic.cpp +++ b/libvips/resample/bicubic.cpp @@ -105,7 +105,7 @@ G_DEFINE_TYPE( VipsInterpolateBicubic, vips_interpolate_bicubic, */ template static void inline -bicubic_int_tab( PEL *pout, const PEL *pin, +bicubic_int_tab( void *pout, const PEL *pin, const int bands, const int lskip, const int *cx, const int *cy ) { @@ -173,7 +173,7 @@ bicubic_int_tab( PEL *pout, const PEL *pin, */ template static void inline -bicubic_float_tab( PEL *pout, const PEL *pin, +bicubic_float_tab( void *pout, const PEL *pin, const int bands, const int lskip, const double *cx, const double *cy ) { @@ -236,7 +236,7 @@ bicubic_float_tab( PEL *pout, const PEL *pin, */ template static void inline -bicubic_notab( PEL *pout, const PEL *pin, +bicubic_notab( void *pout, const PEL *pin, const int bands, const int lskip, double x, double y ) { @@ -303,7 +303,7 @@ bicubic_notab( PEL *pout, const PEL *pin, static void vips_interpolate_bicubic_interpolate( VipsInterpolate *interpolate, - PEL *out, REGION *in, double x, double y ) + void *out, REGION *in, double x, double y ) { /* Find the mask index. We round-to-nearest, so we need to generate * indexes in 0 to VIPS_TRANSFORM_SCALE, 2^n + 1 values. We multiply diff --git a/libvips/resample/interpolate.c b/libvips/resample/interpolate.c index 31351673..7338357f 100644 --- a/libvips/resample/interpolate.c +++ b/libvips/resample/interpolate.c @@ -200,7 +200,7 @@ vips_interpolate_init( VipsInterpolate *interpolate ) } /** - * vips_interpolate: + * vips_interpolate: (skip) * @interpolate: interpolator to use * @out: write result here * @in: read source data from here @@ -215,7 +215,7 @@ vips_interpolate_init( VipsInterpolate *interpolate ) */ void vips_interpolate( VipsInterpolate *interpolate, - PEL *out, REGION *in, double x, double y ) + void *out, REGION *in, double x, double y ) { VipsInterpolateClass *class = VIPS_INTERPOLATE_GET_CLASS( interpolate ); @@ -225,7 +225,7 @@ vips_interpolate( VipsInterpolate *interpolate, } /** - * vips_interpolate_get_method: + * vips_interpolate_get_method: (skip) * @interpolate: interpolator to use * * Look up the @interpolate method in the class and return it. Use this @@ -333,7 +333,7 @@ G_DEFINE_TYPE( VipsInterpolateNearest, vips_interpolate_nearest, static void vips_interpolate_nearest_interpolate( VipsInterpolate *interpolate, - PEL *out, REGION *in, double x, double y ) + void *out, REGION *in, double x, double y ) { /* Pel size and line size. */ @@ -346,11 +346,12 @@ vips_interpolate_nearest_interpolate( VipsInterpolate *interpolate, const int yi = (int) y; const PEL *p = (PEL *) IM_REGION_ADDR( in, xi, yi ); + PEL *q = (PEL *) out; int z; for( z = 0; z < ps; z++ ) - out[z] = p[z]; + q[z] = p[z]; } static void @@ -390,7 +391,7 @@ vips_interpolate_nearest_new( void ) * A convenience function that returns a nearest-neighbour interpolator you * don't need to free. * - * Returns: a nearest-neighbour interpolator + * Returns: (transfer none): a nearest-neighbour interpolator */ VipsInterpolate * vips_interpolate_nearest_static( void ) @@ -501,7 +502,7 @@ G_DEFINE_TYPE( VipsInterpolateBilinear, vips_interpolate_bilinear, static void vips_interpolate_bilinear_interpolate( VipsInterpolate *interpolate, - PEL *out, REGION *in, double x, double y ) + void *out, REGION *in, double x, double y ) { /* Pel size and line size. */ @@ -560,7 +561,7 @@ vips_interpolate_bilinear_new( void ) * A convenience function that returns a bilinear interpolator you * don't need to free. * - * Returns: a bilinear interpolator + * Returns: (transfer none): a bilinear interpolator */ VipsInterpolate * vips_interpolate_bilinear_static( void ) diff --git a/libvips/resample/lbb.cpp b/libvips/resample/lbb.cpp index d7c6cf64..eb886ddd 100644 --- a/libvips/resample/lbb.cpp +++ b/libvips/resample/lbb.cpp @@ -570,7 +570,7 @@ lbbicubic( const double c00, */ #define LBB_CONVERSION( conversion ) \ template static void inline \ - lbb_ ## conversion( PEL* restrict pout, \ + lbb_ ## conversion( void* restrict pout, \ const PEL* restrict pin, \ const int bands, \ const int lskip, \ @@ -752,7 +752,7 @@ G_DEFINE_TYPE( VipsInterpolateLbb, vips_interpolate_lbb, static void vips_interpolate_lbb_interpolate( VipsInterpolate* restrict interpolate, - PEL* restrict out, + void* restrict out, REGION* restrict in, double absolute_x, double absolute_y ) diff --git a/libvips/resample/nohalo.cpp b/libvips/resample/nohalo.cpp index 56dfee7c..9003fa4a 100644 --- a/libvips/resample/nohalo.cpp +++ b/libvips/resample/nohalo.cpp @@ -1222,8 +1222,8 @@ lbbicubic( const double c00, */ #define NOHALO_CONVERSION( conversion ) \ template static void inline \ - nohalo_ ## conversion( PEL* restrict pout, \ - const PEL* restrict pin, \ + nohalo_ ## conversion( void* restrict pout, \ + const void* restrict pin, \ const int bands, \ const int lskip, \ const double x_0, \ @@ -1477,7 +1477,7 @@ G_DEFINE_TYPE( VipsInterpolateNohalo, vips_interpolate_nohalo, static void vips_interpolate_nohalo_interpolate( VipsInterpolate* restrict interpolate, - PEL* restrict out, + void* restrict out, REGION* restrict in, double absolute_x, double absolute_y ) diff --git a/libvips/resample/vsqbs.cpp b/libvips/resample/vsqbs.cpp index bdc27b98..d0002e9a 100644 --- a/libvips/resample/vsqbs.cpp +++ b/libvips/resample/vsqbs.cpp @@ -178,7 +178,7 @@ typedef struct _VipsInterpolateVsqbsClass { */ #define VSQBS_CONVERSION( conversion ) \ template static void inline \ - vsqbs_ ## conversion( PEL* restrict pout, \ + vsqbs_ ## conversion( void* restrict pout, \ const PEL* restrict pin, \ const int bands, \ const int lskip, \ @@ -303,7 +303,7 @@ extern "C" { static void vips_interpolate_vsqbs_interpolate( VipsInterpolate* restrict interpolate, - PEL* restrict out, + void* restrict out, REGION* restrict in, double absolute_x, double absolute_y )