From d0ec401a12d8631036387d398cafddb1420df39e Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 31 Dec 2011 18:22:42 +0000 Subject: [PATCH] hackery to get goi working --- TODO | 27 ++- configure.in | 9 +- libvips/arithmetic/abs.c | 3 +- libvips/arithmetic/add.c | 2 +- libvips/arithmetic/arithmetic.c | 6 +- libvips/arithmetic/arithmetic.h | 2 +- libvips/arithmetic/boolean.c | 4 +- libvips/arithmetic/complex.c | 7 +- libvips/arithmetic/divide.c | 2 +- libvips/arithmetic/im_maxpos_avg.c | 2 +- libvips/arithmetic/invert.c | 3 +- libvips/arithmetic/linear.c | 3 +- libvips/arithmetic/math.c | 3 +- libvips/arithmetic/math2.c | 4 +- libvips/arithmetic/max.c | 5 +- libvips/arithmetic/measure.c | 5 +- libvips/arithmetic/min.c | 5 +- libvips/arithmetic/multiply.c | 10 +- libvips/arithmetic/relational.c | 8 +- libvips/arithmetic/remainder.c | 4 +- libvips/arithmetic/round.c | 3 +- libvips/arithmetic/sign.c | 3 +- libvips/arithmetic/statistic.c | 4 +- libvips/arithmetic/subtract.c | 2 +- libvips/arithmetic/unaryconst.c | 6 +- libvips/arithmetic/unaryconst.h | 2 +- libvips/colour/im_LabQ2Lab.c | 4 +- libvips/colour/im_LabQ2disp.c | 8 +- libvips/colour/im_XYZ2disp.c | 2 +- libvips/colour/im_argb2rgba.c | 2 +- libvips/colour/im_disp2XYZ.c | 2 +- libvips/colour/im_icc_transform.c | 12 +- libvips/conversion/bandary.c | 6 +- libvips/conversion/bandary.h | 2 +- libvips/conversion/bandjoin.c | 4 +- libvips/conversion/bandmean.c | 3 +- libvips/conversion/black.c | 5 +- libvips/conversion/cast.c | 4 +- libvips/conversion/copy.c | 17 +- libvips/conversion/embed.c | 29 +-- libvips/conversion/extract.c | 10 +- libvips/conversion/flip.c | 8 +- libvips/conversion/ifthenelse.c | 20 +- libvips/conversion/im_falsecolour.c | 2 +- libvips/conversion/im_subsample.c | 8 +- libvips/conversion/im_text.c | 2 +- libvips/conversion/im_zoom.c | 12 +- libvips/conversion/insert.c | 13 +- libvips/conversion/join.c | 5 +- libvips/conversion/recomb.c | 4 +- libvips/conversion/rot.c | 12 +- libvips/conversion/tilecache.c | 9 +- libvips/convolution/im_conv.c | 12 +- libvips/convolution/im_conv_f.c | 8 +- libvips/convolution/im_fastcor.c | 4 +- libvips/convolution/im_spcor.c | 4 +- libvips/deprecated/cooc_funcs.c | 10 +- libvips/foreign/Makefile.am | 14 +- libvips/foreign/csv.c | 6 +- libvips/foreign/csvload.c | 5 +- libvips/foreign/csvsave.c | 5 +- libvips/foreign/fits.c | 14 +- libvips/foreign/foreign.c | 46 +++- libvips/foreign/magick2vips.c | 2 +- libvips/foreign/matlab.c | 11 +- libvips/foreign/openexr2vips.c | 2 +- libvips/foreign/ppm.c | 22 +- libvips/foreign/ppmsave.c | 5 +- libvips/foreign/radiance.c | 2 +- libvips/foreign/rawload.c | 5 +- libvips/foreign/rawsave.c | 6 +- libvips/foreign/tiff2vips.c | 52 +++-- libvips/foreign/vips2tiff.c | 291 ++++++++++++------------ libvips/freq_filt/fmaskcir.c | 12 +- libvips/freq_filt/im_freq_mask.c | 4 +- libvips/freq_filt/im_fwfft.c | 24 +- libvips/freq_filt/im_invfft.c | 4 +- libvips/freq_filt/im_invfftr.c | 4 +- libvips/histograms_lut/im_buildlut.c | 2 +- libvips/histograms_lut/im_histeq.c | 2 +- libvips/histograms_lut/im_histgr.c | 6 +- libvips/histograms_lut/im_histindexed.c | 8 +- libvips/histograms_lut/im_histnD.c | 4 +- libvips/histograms_lut/im_histplot.c | 8 +- libvips/histograms_lut/im_histspec.c | 2 +- libvips/histograms_lut/im_identity.c | 2 +- libvips/histograms_lut/im_lhisteq.c | 6 +- libvips/histograms_lut/im_maplut.c | 22 +- libvips/histograms_lut/im_project.c | 4 +- libvips/histograms_lut/im_stdif.c | 6 +- libvips/histograms_lut/tone.c | 2 +- libvips/include/vips/foreign.h | 2 +- libvips/include/vips/image.h | 6 +- libvips/include/vips/inplace.h | 18 +- libvips/include/vips/internal.h | 6 +- libvips/include/vips/private.h | 6 +- libvips/include/vips/region.h | 6 +- libvips/include/vips/type.h | 8 + libvips/include/vips/vips7compat.h | 2 + libvips/inplace/draw.c | 8 +- libvips/inplace/draw.h | 10 +- libvips/inplace/flood.c | 34 +-- libvips/inplace/im_draw_circle.c | 10 +- libvips/inplace/im_draw_image.c | 6 +- libvips/inplace/im_draw_line.c | 6 +- libvips/inplace/im_draw_mask.c | 12 +- libvips/inplace/im_draw_point.c | 4 +- libvips/inplace/im_draw_rect.c | 8 +- libvips/inplace/inplace_dispatch.c | 24 +- libvips/iofuncs/image.c | 2 +- libvips/iofuncs/object.c | 25 +- libvips/iofuncs/region.c | 16 +- libvips/iofuncs/sinkmemory.c | 2 +- libvips/iofuncs/sinkscreen.c | 4 +- libvips/iofuncs/type.c | 10 +- libvips/iofuncs/vector.c | 2 +- libvips/iofuncs/window.c | 2 +- libvips/morphology/im_cntlines.c | 10 +- libvips/morphology/im_profile.c | 10 +- libvips/morphology/im_rank.c | 4 +- libvips/morphology/im_rank_image.c | 13 +- libvips/morphology/im_zerox.c | 4 +- libvips/morphology/morphology.c | 12 +- libvips/mosaicing/im_lrcalcon.c | 8 +- libvips/mosaicing/im_lrmerge.c | 16 +- libvips/mosaicing/im_tbmerge.c | 16 +- libvips/other/im_eye.c | 2 +- libvips/resample/im_affine.c | 4 +- libvips/resample/interpolate.c | 12 +- 129 files changed, 731 insertions(+), 606 deletions(-) diff --git a/TODO b/TODO index 94991d1d..7405d505 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,29 @@ -- automake conditionals are breaking introspection +- remaining warnings + +include/vips/type.h:99: Warning: Vips: vips_value_get_area: return value: Missing (transfer) annotation +include/vips/type.h:98: Warning: Vips: vips_value_set_area: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async) +include/vips/type.h:137: Warning: Vips: vips_value_get_array: return value: Missing (transfer) annotation +include/vips/type.h:156: Warning: Vips: vips_value_get_array_object: return value: Missing (transfer) annotation +include/vips/type.h:86: Warning: Vips: vips_area_new: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async) +include/vips/type.h:87: Warning: Vips: vips_area_new_blob: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async) + +iofuncs/type.c:518: Warning: Vips: vips_value_get_blob: return value: Missing (transfer) annotation +iofuncs/type.c:471: Warning: Vips: vips_value_set_blob: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async) + +iofuncs/header.c:921: Warning: Vips: vips_image_set_area: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async) +iofuncs/header.c:993: Warning: Vips: vips_image_set_blob: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async) + +include/vips/object.h:273: Warning: Vips: vips__argument_table_lookup: return value: Unresolved type: 'VipsArgument*' + +include/vips/operation.h:81: Warning: Vips: vips_operation_class_print_usage: argument operation_class: Unresolved type: 'VipsOperationClass*' + +foreign/foreign.c:383: Warning: Vips: vips_foreign_map: argument fn: Unresolved type: 'VipsSListMap2Fn' +foreign/foreign.c:399: Warning: Vips: vips_foreign_map: return value: Missing (transfer) annotation + +conversion/im_system_image.c:129: Warning: Vips: im_system_image: return value: Missing (transfer) annotation + + - we need to build all of them, but use ifdefs to knock chunks out diff --git a/configure.in b/configure.in index 3b3fa56b..14563ef8 100644 --- a/configure.in +++ b/configure.in @@ -55,7 +55,8 @@ 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 foreign.h interpolate.h header.h operation.h enumtypes.h arithmetic.h conversion.h" +headers="vips.h object.h image.h error.h foreign.h interpolate.h header.h +operation.h enumtypes.h arithmetic.h conversion.h type.h" for name in $headers; do vips_introspection_sources="$vips_introspection_sources include/vips/$name" done @@ -726,10 +727,10 @@ native win32: $vips_os_win32 native OS X: $vips_os_darwin open files in binary mode: $vips_binary_open enable debug: $enable_debug -build C++ components: $enable_cxx evaluate with threads: $enable_threads -build docs with gtkdoc $enable_gtk_doc -gobject introspection $found_introspection +build C++ components: $enable_cxx +build docs with gtkdoc: $enable_gtk_doc +gobject introspection: $found_introspection * optional packages and modules use fftw3 for FFT: $with_fftw3 diff --git a/libvips/arithmetic/abs.c b/libvips/arithmetic/abs.c index 9767bf71..32183611 100644 --- a/libvips/arithmetic/abs.c +++ b/libvips/arithmetic/abs.c @@ -164,7 +164,8 @@ vips_abs_build( VipsObject *object ) #endif /*HAVE_HYPOT*/ static void -vips_abs_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width ) +vips_abs_buffer( VipsArithmetic *arithmetic, + VipsPel *out, VipsPel **in, int width ) { VipsUnary *unary = VIPS_UNARY( arithmetic ); const int bands = vips_image_get_bands( unary->in ); diff --git a/libvips/arithmetic/add.c b/libvips/arithmetic/add.c index fb823c7a..380baea1 100644 --- a/libvips/arithmetic/add.c +++ b/libvips/arithmetic/add.c @@ -96,7 +96,7 @@ G_DEFINE_TYPE( VipsAdd, vips_add, VIPS_TYPE_BINARY ); } static void -add_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width ) +add_buffer( VipsArithmetic *arithmetic, VipsPel *out, VipsPel **in, int width ) { VipsArithmeticClass *class = VIPS_ARITHMETIC_GET_CLASS( arithmetic ); VipsImage *im = arithmetic->ready[0]; diff --git a/libvips/arithmetic/arithmetic.c b/libvips/arithmetic/arithmetic.c index c482e5b4..028f7791 100644 --- a/libvips/arithmetic/arithmetic.c +++ b/libvips/arithmetic/arithmetic.c @@ -270,7 +270,7 @@ vips_arithmetic_gen( VipsRegion *or, VipsArithmeticClass *class = VIPS_ARITHMETIC_GET_CLASS( arithmetic ); Rect *r = &or->valid; - PEL *p[MAX_INPUT_IMAGES], *q; + VipsPel *p[MAX_INPUT_IMAGES], *q; int i, y; /* Prepare all input regions and make buffer pointers. @@ -278,10 +278,10 @@ vips_arithmetic_gen( VipsRegion *or, for( i = 0; ir[i]; i++ ) { if( vips_region_prepare( ir[i], r ) ) return( -1 ); - p[i] = (PEL *) VIPS_REGION_ADDR( ir[i], r->left, r->top ); + p[i] = (VipsPel *) VIPS_REGION_ADDR( ir[i], r->left, r->top ); } p[i] = NULL; - q = (PEL *) VIPS_REGION_ADDR( or, r->left, r->top ); + q = (VipsPel *) VIPS_REGION_ADDR( or, r->left, r->top ); for( y = 0; y < r->height; y++ ) { class->process_line( arithmetic, q, p, r->width ); diff --git a/libvips/arithmetic/arithmetic.h b/libvips/arithmetic/arithmetic.h index 9841b930..32b7c295 100644 --- a/libvips/arithmetic/arithmetic.h +++ b/libvips/arithmetic/arithmetic.h @@ -58,7 +58,7 @@ extern "C" { struct _VipsArithmetic; typedef void (*VipsArithmeticProcessFn)( struct _VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ); + VipsPel *out, VipsPel **in, int width ); typedef struct _VipsArithmetic { VipsOperation parent_instance; diff --git a/libvips/arithmetic/boolean.c b/libvips/arithmetic/boolean.c index eea2bdf8..1e6c1995 100644 --- a/libvips/arithmetic/boolean.c +++ b/libvips/arithmetic/boolean.c @@ -140,7 +140,7 @@ vips_boolean_build( VipsObject *object ) static void vips_boolean_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsBoolean *boolean = (VipsBoolean *) arithmetic; VipsImage *im = arithmetic->ready[0]; @@ -462,7 +462,7 @@ vips_boolean_const_build( VipsObject *object ) static void vips_boolean_const_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic; VipsBooleanConst *bconst = (VipsBooleanConst *) arithmetic; diff --git a/libvips/arithmetic/complex.c b/libvips/arithmetic/complex.c index 5abea5ec..e5411e93 100644 --- a/libvips/arithmetic/complex.c +++ b/libvips/arithmetic/complex.c @@ -163,7 +163,8 @@ G_DEFINE_TYPE( VipsComplex, vips_complex, VIPS_TYPE_UNARY ); } static void -vips_complex_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width ) +vips_complex_buffer( VipsArithmetic *arithmetic, + VipsPel *out, VipsPel **in, int width ) { VipsComplex *cmplx = (VipsComplex *) arithmetic; VipsImage *im = arithmetic->ready[0]; @@ -418,7 +419,7 @@ vips_complexget_build( VipsObject *object ) static void vips_complexget_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsComplexget *complexget = (VipsComplexget *) arithmetic; VipsImage *im = arithmetic->ready[0]; @@ -608,7 +609,7 @@ vips_complexform_build( VipsObject *object ) static void vips_complexform_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsImage *im = arithmetic->ready[0]; const int sz = width * vips_image_get_bands( im ); diff --git a/libvips/arithmetic/divide.c b/libvips/arithmetic/divide.c index d4043725..640976d8 100644 --- a/libvips/arithmetic/divide.c +++ b/libvips/arithmetic/divide.c @@ -152,7 +152,7 @@ G_DEFINE_TYPE( VipsDivide, vips_divide, VIPS_TYPE_BINARY ); static void vips_divide_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsImage *im = arithmetic->ready[0]; const int sz = width * vips_image_get_bands( im ); diff --git a/libvips/arithmetic/im_maxpos_avg.c b/libvips/arithmetic/im_maxpos_avg.c index cce7e593..955b20fa 100644 --- a/libvips/arithmetic/im_maxpos_avg.c +++ b/libvips/arithmetic/im_maxpos_avg.c @@ -186,7 +186,7 @@ maxposavg_scan( REGION *reg, void *seq, void *a, void *b, gboolean *stop ) occurences = maxposavg->occurences; for( y = 0; y < r->height; y++ ) { - PEL *in = (PEL *) IM_REGION_ADDR( reg, r->left, r->top + y ); + VipsPel *in = VIPS_REGION_ADDR( reg, r->left, r->top + y ); switch( reg->im->BandFmt ) { case IM_BANDFMT_UCHAR: LOOP( unsigned char ); break; diff --git a/libvips/arithmetic/invert.c b/libvips/arithmetic/invert.c index 5c3de271..3acdfb1b 100644 --- a/libvips/arithmetic/invert.c +++ b/libvips/arithmetic/invert.c @@ -82,7 +82,8 @@ G_DEFINE_TYPE( VipsInvert, vips_invert, VIPS_TYPE_UNARY ); } static void -vips_invert_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width ) +vips_invert_buffer( VipsArithmetic *arithmetic, + VipsPel *out, VipsPel **in, int width ) { VipsImage *im = arithmetic->ready[0]; diff --git a/libvips/arithmetic/linear.c b/libvips/arithmetic/linear.c index 284464e6..b354d851 100644 --- a/libvips/arithmetic/linear.c +++ b/libvips/arithmetic/linear.c @@ -187,7 +187,8 @@ vips_linear_build( VipsObject *object ) /* Lintra a buffer, n set of scale/offset. */ static void -vips_linear_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width ) +vips_linear_buffer( VipsArithmetic *arithmetic, + VipsPel *out, VipsPel **in, int width ) { VipsImage *im = arithmetic->ready[0]; VipsLinear *linear = (VipsLinear *) arithmetic; diff --git a/libvips/arithmetic/math.c b/libvips/arithmetic/math.c index 64bb8295..06f5e8c9 100644 --- a/libvips/arithmetic/math.c +++ b/libvips/arithmetic/math.c @@ -139,7 +139,8 @@ vips_math_build( VipsObject *object ) #define EXP10( X ) (pow( 10.0, (X) )) static void -vips_math_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width ) +vips_math_buffer( VipsArithmetic *arithmetic, + VipsPel *out, VipsPel **in, int width ) { VipsMath *math = (VipsMath *) arithmetic; VipsImage *im = arithmetic->ready[0]; diff --git a/libvips/arithmetic/math2.c b/libvips/arithmetic/math2.c index 24bdef4a..3869e9c4 100644 --- a/libvips/arithmetic/math2.c +++ b/libvips/arithmetic/math2.c @@ -145,7 +145,7 @@ vips_math2_build( VipsObject *object ) static void vips_math2_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsMath2 *math2 = (VipsMath2 *) arithmetic; VipsImage *im = arithmetic->ready[0]; @@ -361,7 +361,7 @@ vips_math2_const_build( VipsObject *object ) static void vips_math2_const_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic; VipsMath2Const *math2 = (VipsMath2Const *) arithmetic; diff --git a/libvips/arithmetic/max.c b/libvips/arithmetic/max.c index c772c659..fee36c3d 100644 --- a/libvips/arithmetic/max.c +++ b/libvips/arithmetic/max.c @@ -324,9 +324,12 @@ vips_max_init( VipsMax *max ) * vips_max: * @in: input #VipsImage * @out: output pixel maximum + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @x: horizontal position of maximum * @y: vertical position of maximum - * @...: %NULL-terminated list of optional named arguments * * This operation finds the maximum value in an image. * diff --git a/libvips/arithmetic/measure.c b/libvips/arithmetic/measure.c index 726a5e7b..4ba953a0 100644 --- a/libvips/arithmetic/measure.c +++ b/libvips/arithmetic/measure.c @@ -259,11 +259,14 @@ vips_measure_init( VipsMeasure *measure ) * @out: array of measurements * @h: patches across chart * @v: patches down chart + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @left: area of image containing chart * @top: area of image containing chart * @width: area of image containing chart * @height: area of image containing chart - * @...: %NULL-terminated list of optional named arguments * * Analyse a grid of colour patches, producing an array of patch averages. * The mask has a row for each measured patch and a column for each image diff --git a/libvips/arithmetic/min.c b/libvips/arithmetic/min.c index c13c7239..08de516d 100644 --- a/libvips/arithmetic/min.c +++ b/libvips/arithmetic/min.c @@ -325,9 +325,12 @@ vips_min_init( VipsMin *min ) * vips_min: * @in: input #VipsImage * @out: output pixel maximum + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @x: horizontal position of minimum * @y: vertical position of minimum - * @...: %NULL-terminated list of optional named arguments * * This operation finds the minimum value in an image. * diff --git a/libvips/arithmetic/multiply.c b/libvips/arithmetic/multiply.c index 8e28768c..34920694 100644 --- a/libvips/arithmetic/multiply.c +++ b/libvips/arithmetic/multiply.c @@ -113,7 +113,7 @@ G_DEFINE_TYPE( VipsMultiply, vips_multiply, VIPS_TYPE_BINARY ); static void vips_multiply_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsImage *im = arithmetic->ready[0]; const int sz = width * vips_image_get_bands( im ); @@ -183,11 +183,11 @@ vips_multiply_init( VipsMultiply *multiply ) /** * vips_multiply: - * @in1: input #VipsImage 1 - * @in2: input #VipsImage 2 - * @out: output #VipsImage + * @left: left-hand image + * @right: right-hand image + * @out: output image * - * This operation calculates @in1 * @in2 and writes the result to @out. + * This operation calculates @left * @right and writes the result to @out. * * If the images differ in size, the smaller image is enlarged to match the * larger by adding zero pixels along the bottom and right. diff --git a/libvips/arithmetic/relational.c b/libvips/arithmetic/relational.c index 0cdedb5a..fcd10760 100644 --- a/libvips/arithmetic/relational.c +++ b/libvips/arithmetic/relational.c @@ -109,7 +109,7 @@ vips_relational_build( VipsObject *object ) #define RLOOP( TYPE, ROP ) { \ TYPE *left = (TYPE *) in[0]; \ TYPE *right = (TYPE *) in[1]; \ - PEL *q = (PEL *) out; \ + VipsPel *q = (VipsPel *) out; \ \ for( x = 0; x < sz; x++ ) \ q[x] = (left[x] ROP right[x]) ? 255 : 0; \ @@ -118,7 +118,7 @@ vips_relational_build( VipsObject *object ) #define CLOOP( TYPE, COP ) { \ TYPE *left = (TYPE *) in[0]; \ TYPE *right = (TYPE *) in[1]; \ - PEL *q = (PEL *) out; \ + VipsPel *q = (VipsPel *) out; \ \ for( x = 0; x < sz; x++ ) { \ q[x] = COP( left[0], left[1], right[0], right[1]) ? 255 : 0; \ @@ -154,7 +154,7 @@ vips_relational_build( VipsObject *object ) static void vips_relational_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsRelational *relational = (VipsRelational *) arithmetic; VipsImage *im = arithmetic->ready[0]; @@ -496,7 +496,7 @@ vips_relational_const_build( VipsObject *object ) static void vips_relational_const_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic; VipsRelationalConst *rconst = (VipsRelationalConst *) arithmetic; diff --git a/libvips/arithmetic/remainder.c b/libvips/arithmetic/remainder.c index c951f7ae..9fd053df 100644 --- a/libvips/arithmetic/remainder.c +++ b/libvips/arithmetic/remainder.c @@ -121,7 +121,7 @@ vips_remainder_build( VipsObject *object ) static void vips_remainder_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsImage *im = arithmetic->ready[0]; const int sz = width * vips_image_get_bands( im ); @@ -289,7 +289,7 @@ vips_remainder_const_build( VipsObject *object ) static void vips_remainder_const_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic; VipsImage *im = arithmetic->ready[0]; diff --git a/libvips/arithmetic/round.c b/libvips/arithmetic/round.c index 0cd39bb4..9e1d4470 100644 --- a/libvips/arithmetic/round.c +++ b/libvips/arithmetic/round.c @@ -105,7 +105,8 @@ vips_round_build( VipsObject *object ) } static void -vips_round_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width ) +vips_round_buffer( VipsArithmetic *arithmetic, + VipsPel *out, VipsPel **in, int width ) { VipsRound *round = (VipsRound *) arithmetic; VipsImage *im = arithmetic->ready[0]; diff --git a/libvips/arithmetic/sign.c b/libvips/arithmetic/sign.c index 7e554114..d6430914 100644 --- a/libvips/arithmetic/sign.c +++ b/libvips/arithmetic/sign.c @@ -99,7 +99,8 @@ G_DEFINE_TYPE( VipsSign, vips_sign, VIPS_TYPE_UNARY ); } static void -vips_sign_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width ) +vips_sign_buffer( VipsArithmetic *arithmetic, + VipsPel *out, VipsPel **in, int width ) { VipsUnary *unary = VIPS_UNARY( arithmetic ); const int bands = vips_image_get_bands( unary->in ); diff --git a/libvips/arithmetic/statistic.c b/libvips/arithmetic/statistic.c index f46bc555..9c9ff1e7 100644 --- a/libvips/arithmetic/statistic.c +++ b/libvips/arithmetic/statistic.c @@ -74,12 +74,12 @@ vips_statistic_scan( VipsRegion *region, int lsk = IM_REGION_LSKIP( region ); int y; - PEL *p; + VipsPel *p; VIPS_DEBUG_MSG( "vips_statistic_scan: %d x %d @ %d x %d\n", r->width, r->height, r->left, r->top ); - p = (PEL *) IM_REGION_ADDR( region, r->left, r->top ); + p = VIPS_REGION_ADDR( region, r->left, r->top ); for( y = 0; y < r->height; y++ ) { if( class->scan( statistic, seq, r->left, r->top + y, p, r->width ) ) diff --git a/libvips/arithmetic/subtract.c b/libvips/arithmetic/subtract.c index 78007520..80a169f7 100644 --- a/libvips/arithmetic/subtract.c +++ b/libvips/arithmetic/subtract.c @@ -92,7 +92,7 @@ G_DEFINE_TYPE( VipsSubtract, vips_subtract, VIPS_TYPE_BINARY ); static void vips_subtract_buffer( VipsArithmetic *arithmetic, - PEL *out, PEL **in, int width ) + VipsPel *out, VipsPel **in, int width ) { VipsImage *im = arithmetic->ready[0]; diff --git a/libvips/arithmetic/unaryconst.c b/libvips/arithmetic/unaryconst.c index fe387e39..78ecc325 100644 --- a/libvips/arithmetic/unaryconst.c +++ b/libvips/arithmetic/unaryconst.c @@ -84,14 +84,14 @@ G_DEFINE_ABSTRACT_TYPE( VipsUnaryConst, vips_unary_const, VIPS_TYPE_UNARY ); /* Cast a n-band vector of double to a m-band vector in another format. */ -static PEL * +static VipsPel * make_pixel( VipsObject *obj, int m, VipsBandFmt fmt, int n, double *p ) { - PEL *q; + VipsPel *q; int i; if( !(q = VIPS_ARRAY( obj, - m * vips__image_sizeof_bandformat[fmt], PEL )) ) + m * vips__image_sizeof_bandformat[fmt], VipsPel )) ) return( NULL ); switch( fmt ) { diff --git a/libvips/arithmetic/unaryconst.h b/libvips/arithmetic/unaryconst.h index 12fa11c6..55469241 100644 --- a/libvips/arithmetic/unaryconst.h +++ b/libvips/arithmetic/unaryconst.h @@ -67,7 +67,7 @@ typedef struct _VipsUnaryConst { * const_format in type. */ int n; - PEL *c_ready; + VipsPel *c_ready; } VipsUnaryConst; diff --git a/libvips/colour/im_LabQ2Lab.c b/libvips/colour/im_LabQ2Lab.c index d059a838..674704e9 100644 --- a/libvips/colour/im_LabQ2Lab.c +++ b/libvips/colour/im_LabQ2Lab.c @@ -55,13 +55,13 @@ /* imb_LabQ2Lab: CONVERT n pels from packed 32bit Lab to float values * in a buffer - * ARGS: PEL *inp pointer to first byte of Lab32 buffer + * ARGS: VipsPel *inp pointer to first byte of Lab32 buffer * float *outbuf destination buffer * int n number of pels to process * (C) K.Martinez 2/5/93 */ void -imb_LabQ2Lab( PEL *inp, float *outbuf, int n ) +imb_LabQ2Lab( VipsPel *inp, float *outbuf, int n ) { signed char *b; /* to read input bytes */ int l; diff --git a/libvips/colour/im_LabQ2disp.c b/libvips/colour/im_LabQ2disp.c index 6839ded7..31815b7b 100644 --- a/libvips/colour/im_LabQ2disp.c +++ b/libvips/colour/im_LabQ2disp.c @@ -51,9 +51,9 @@ */ typedef struct { struct im_col_display *disp; - PEL red[ 64 * 64 * 64 ]; - PEL green[ 64 * 64 * 64 ]; - PEL blue[ 64 * 64 * 64 ]; + VipsPel red[ 64 * 64 * 64 ]; + VipsPel green[ 64 * 64 * 64 ]; + VipsPel blue[ 64 * 64 * 64 ]; } CalibrateInfo; /* Do our own indexing of the arrays, to make sure we get efficient mults. @@ -63,7 +63,7 @@ typedef struct { /* Process a buffer of data. */ static void -imb_LabQ2disp( PEL *p, PEL *q, int n, CalibrateInfo *cal ) +imb_LabQ2disp( VipsPel *p, VipsPel *q, int n, CalibrateInfo *cal ) { int x, t; diff --git a/libvips/colour/im_XYZ2disp.c b/libvips/colour/im_XYZ2disp.c index 41183190..47cc701e 100644 --- a/libvips/colour/im_XYZ2disp.c +++ b/libvips/colour/im_XYZ2disp.c @@ -65,7 +65,7 @@ /* Process a buffer of data. */ void -imb_XYZ2disp( float *p, PEL *q, int n, struct im_col_display *d ) +imb_XYZ2disp( float *p, VipsPel *q, int n, struct im_col_display *d ) { struct im_col_tab_disp *table = im_col_display_get_table( d ); float rstep = (d->d_YCR - d->d_Y0R) / 1500.0; diff --git a/libvips/colour/im_argb2rgba.c b/libvips/colour/im_argb2rgba.c index aa244580..90c3eac3 100644 --- a/libvips/colour/im_argb2rgba.c +++ b/libvips/colour/im_argb2rgba.c @@ -41,7 +41,7 @@ #include static void -argb2rgba( guint32 *in, PEL *out, int n, void *_bg ) +argb2rgba( guint32 *in, VipsPel *out, int n, void *_bg ) { guint32 bg = GPOINTER_TO_UINT( _bg ); diff --git a/libvips/colour/im_disp2XYZ.c b/libvips/colour/im_disp2XYZ.c index ddfcccfb..bec0608b 100644 --- a/libvips/colour/im_disp2XYZ.c +++ b/libvips/colour/im_disp2XYZ.c @@ -55,7 +55,7 @@ /* Convert a buffer. */ void -imb_disp2XYZ( PEL *p, float *q, int n, struct im_col_display *d ) +imb_disp2XYZ( VipsPel *p, float *q, int n, struct im_col_display *d ) { int x; diff --git a/libvips/colour/im_icc_transform.c b/libvips/colour/im_icc_transform.c index 1d7a72c3..04f765d7 100644 --- a/libvips/colour/im_icc_transform.c +++ b/libvips/colour/im_icc_transform.c @@ -299,7 +299,7 @@ decode_lab( WORD *fixed, float *lab, int n ) } static void -transform_buf( PEL *in, PEL *out, int n, Icc *icc ) +transform_buf( VipsPel *in, VipsPel *out, int n, Icc *icc ) { g_mutex_lock( icc->lock ); cmsDoTransform( icc->trans, in, out, n ); @@ -462,7 +462,7 @@ im_icc_transform( IMAGE *in, IMAGE *out, } static void -import_buf( PEL *in, float *out, int n, Icc *icc ) +import_buf( VipsPel *in, float *out, int n, Icc *icc ) { /* Buffer of encoded 16-bit pixels we write to. */ @@ -644,7 +644,7 @@ im_icc_import_embedded( IMAGE *in, IMAGE *out, VipsIntent intent ) } static void -export_buf( float *in, PEL *out, int n, Icc *icc ) +export_buf( float *in, VipsPel *out, int n, Icc *icc ) { /* Buffer of encoded 16-bit pixels we transform. */ @@ -1103,7 +1103,7 @@ decode_lab( guint16 *fixed, float *lab, int n ) } static void -transform_buf( PEL *in, PEL *out, int n, Icc *icc ) +transform_buf( VipsPel *in, VipsPel *out, int n, Icc *icc ) { g_mutex_lock( icc->lock ); cmsDoTransform( icc->trans, in, out, n ); @@ -1273,7 +1273,7 @@ im_icc_transform( IMAGE *in, IMAGE *out, } static void -import_buf( PEL *in, float *out, int n, Icc *icc ) +import_buf( VipsPel *in, float *out, int n, Icc *icc ) { /* Buffer of encoded 16-bit pixels we write to. */ @@ -1437,7 +1437,7 @@ im_icc_import_embedded( IMAGE *in, IMAGE *out, VipsIntent intent ) } static void -export_buf( float *in, PEL *out, int n, Icc *icc ) +export_buf( float *in, VipsPel *out, int n, Icc *icc ) { /* Buffer of encoded 16-bit pixels we transform. */ diff --git a/libvips/conversion/bandary.c b/libvips/conversion/bandary.c index 12634578..673825ea 100644 --- a/libvips/conversion/bandary.c +++ b/libvips/conversion/bandary.c @@ -88,16 +88,16 @@ vips_bandary_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) VipsBandaryClass *class = VIPS_BANDARY_GET_CLASS( bandary ); Rect *r = &or->valid; - PEL *p[MAX_INPUT_IMAGES], *q; + VipsPel *p[MAX_INPUT_IMAGES], *q; int y, i; for( i = 0; i < bandary->n; i++ ) { if( vips_region_prepare( ir[i], r ) ) return( -1 ); - p[i] = (PEL *) VIPS_REGION_ADDR( ir[i], r->left, r->top ); + p[i] = VIPS_REGION_ADDR( ir[i], r->left, r->top ); } p[i] = NULL; - q = (PEL *) VIPS_REGION_ADDR( or, r->left, r->top ); + q = VIPS_REGION_ADDR( or, r->left, r->top ); for( y = 0; y < r->height; y++ ) { class->process_line( bandary, q, p, r->width ); diff --git a/libvips/conversion/bandary.h b/libvips/conversion/bandary.h index 4364617f..dc106c61 100644 --- a/libvips/conversion/bandary.h +++ b/libvips/conversion/bandary.h @@ -53,7 +53,7 @@ extern "C" { struct _VipsBandary; typedef void (*VipsBandaryProcessFn)( struct _VipsBandary *bandary, - PEL *out, PEL **in, int width ); + VipsPel *out, VipsPel **in, int width ); typedef struct _VipsBandary { VipsConversion parent_instance; diff --git a/libvips/conversion/bandjoin.c b/libvips/conversion/bandjoin.c index 12a8fc0f..148ce1ba 100644 --- a/libvips/conversion/bandjoin.c +++ b/libvips/conversion/bandjoin.c @@ -85,7 +85,7 @@ typedef VipsBandaryClass VipsBandjoinClass; G_DEFINE_TYPE( VipsBandjoin, vips_bandjoin, VIPS_TYPE_BANDARY ); static void -vips_bandjoin_buffer( VipsBandary *bandary, PEL *q, PEL **p, int width ) +vips_bandjoin_buffer( VipsBandary *bandary, VipsPel *q, VipsPel **p, int width ) { VipsConversion *conversion = (VipsConversion *) bandary; VipsImage **in = bandary->ready; @@ -104,7 +104,7 @@ vips_bandjoin_buffer( VipsBandary *bandary, PEL *q, PEL **p, int width ) */ int ips = VIPS_IMAGE_SIZEOF_PEL( in[i] ); - PEL *p1, *q1; + VipsPel *p1, *q1; int x, z; q1 = q; diff --git a/libvips/conversion/bandmean.c b/libvips/conversion/bandmean.c index d0e31306..7b3315cd 100644 --- a/libvips/conversion/bandmean.c +++ b/libvips/conversion/bandmean.c @@ -119,7 +119,8 @@ G_DEFINE_TYPE( VipsBandmean, vips_bandmean, VIPS_TYPE_BANDARY ); } static void -vips_bandmean_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width ) +vips_bandmean_buffer( VipsBandary *bandary, + VipsPel *out, VipsPel **in, int width ) { VipsImage *im = bandary->ready[0]; const int bands = im->Bands; diff --git a/libvips/conversion/black.c b/libvips/conversion/black.c index 0f0a23f4..8760b17e 100644 --- a/libvips/conversion/black.c +++ b/libvips/conversion/black.c @@ -157,9 +157,12 @@ vips_black_init( VipsBlack *black ) * @out: output image * @width: output width * @height: output height - * @bands: output bands * @...: %NULL-terminated list of optional named arguments * + * Optional arguments: + * + * @bands: output bands + * * Make a black unsigned char image of a specified size. * * See also: im_make_xy(), im_text(), im_gaussnoise(). diff --git a/libvips/conversion/cast.c b/libvips/conversion/cast.c index 00a7cecb..9e5d05f7 100644 --- a/libvips/conversion/cast.c +++ b/libvips/conversion/cast.c @@ -335,8 +335,8 @@ vips_cast_gen( VipsRegion *or, void *vseq, void *a, void *b, return( -1 ); for( y = to; y < bo; y++ ) { - PEL *in = (PEL *) VIPS_REGION_ADDR( ir, le, y ); - PEL *out = (PEL *) VIPS_REGION_ADDR( or, le, y ); + VipsPel *in = VIPS_REGION_ADDR( ir, le, y ); + VipsPel *out = VIPS_REGION_ADDR( or, le, y ); switch( cast->in->BandFmt ) { case VIPS_FORMAT_UCHAR: diff --git a/libvips/conversion/copy.c b/libvips/conversion/copy.c index 29dbcee9..f863892f 100644 --- a/libvips/conversion/copy.c +++ b/libvips/conversion/copy.c @@ -127,7 +127,7 @@ G_DEFINE_TYPE( VipsCopy, vips_copy, VIPS_TYPE_CONVERSION ); /* Swap pairs of bytes. */ static void -vips_copy_swap2( PEL *in, PEL *out, int width, VipsImage *im ) +vips_copy_swap2( VipsPel *in, VipsPel *out, int width, VipsImage *im ) { guint16 *p = (guint16 *) in; guint16 *q = (guint16 *) out; @@ -142,7 +142,7 @@ vips_copy_swap2( PEL *in, PEL *out, int width, VipsImage *im ) /* Swap 4- of bytes. */ static void -vips_copy_swap4( PEL *in, PEL *out, int width, VipsImage *im ) +vips_copy_swap4( VipsPel *in, VipsPel *out, int width, VipsImage *im ) { guint32 *p = (guint32 *) in; guint32 *q = (guint32 *) out; @@ -157,7 +157,7 @@ vips_copy_swap4( PEL *in, PEL *out, int width, VipsImage *im ) /* Swap 8- of bytes. */ static void -vips_copy_swap8( PEL *in, PEL *out, int width, VipsImage *im ) +vips_copy_swap8( VipsPel *in, VipsPel *out, int width, VipsImage *im ) { guint64 *p = (guint64 *) in; guint64 *q = (guint64 *) out; @@ -169,7 +169,7 @@ vips_copy_swap8( PEL *in, PEL *out, int width, VipsImage *im ) q[x] = GUINT64_SWAP_LE_BE( p[x] ); } -typedef void (*SwapFn)( PEL *in, PEL *out, int width, VipsImage *im ); +typedef void (*SwapFn)( VipsPel *in, VipsPel *out, int width, VipsImage *im ); static SwapFn vips_copy_swap_fn[] = { NULL, /* VIPS_FORMAT_UCHAR = 0, */ @@ -203,9 +203,9 @@ vips_copy_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) int y; for( y = 0; y < r->height; y++ ) { - PEL *p = (PEL *) VIPS_REGION_ADDR( ir, + VipsPel *p = VIPS_REGION_ADDR( ir, r->left, r->top + y ); - PEL *q = (PEL *) VIPS_REGION_ADDR( or, + VipsPel *q = VIPS_REGION_ADDR( or, r->left, r->top + y ); swap( p, q, r->width, copy->in ); @@ -401,6 +401,10 @@ vips_copy_init( VipsCopy *copy ) * vips_copy: * @in: input image * @out: output image + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @width: set image width * @height: set image height * @bands: set image bands @@ -412,7 +416,6 @@ vips_copy_init( VipsCopy *copy ) * @xoffset: set image xoffset * @yoffset: set image yoffset * @swap: swap byte order - * @...: %NULL-terminated list of optional named arguments * * Copy an image, optionally modifying the header. VIPS copies images by * copying pointers, so this operation is instant, even for very large images. diff --git a/libvips/conversion/embed.c b/libvips/conversion/embed.c index d9893c2a..58aaa016 100644 --- a/libvips/conversion/embed.c +++ b/libvips/conversion/embed.c @@ -143,7 +143,7 @@ vips_embed_find_edge( VipsEmbed *embed, VipsRect *r, int i, VipsRect *out ) /* Copy a single pixel sideways into a line of pixels. */ static void -vips_embed_copy_pixel( VipsEmbed *embed, PEL *q, PEL *p, int n ) +vips_embed_copy_pixel( VipsEmbed *embed, VipsPel *q, VipsPel *p, int n ) { const int bs = VIPS_IMAGE_SIZEOF_PEL( embed->in ); @@ -160,12 +160,12 @@ vips_embed_copy_pixel( VipsEmbed *embed, PEL *q, PEL *p, int n ) */ static void vips_embed_paint_edge( VipsEmbed *embed, - VipsRegion *or, int i, VipsRect *r, PEL *p, int plsk ) + VipsRegion *or, int i, VipsRect *r, VipsPel *p, int plsk ) { const int bs = VIPS_IMAGE_SIZEOF_PEL( embed->in ); VipsRect todo; - PEL *q; + VipsPel *q; int y; /* Pixels left to paint. @@ -176,7 +176,7 @@ vips_embed_paint_edge( VipsEmbed *embed, * todo, then use the line copier below to paint the rest of it. */ if( i > 3 ) { - q = (PEL *) VIPS_REGION_ADDR( or, todo.left, todo.top ); + q = VIPS_REGION_ADDR( or, todo.left, todo.top ); vips_embed_copy_pixel( embed, q, p, todo.width ); p = q; @@ -188,8 +188,7 @@ vips_embed_paint_edge( VipsEmbed *embed, /* Vertical line of pixels to copy. */ for( y = 0; y < todo.height; y++ ) { - q = (PEL *) VIPS_REGION_ADDR( or, - todo.left, todo.top + y ); + q = VIPS_REGION_ADDR( or, todo.left, todo.top + y ); vips_embed_copy_pixel( embed, q, p, todo.width ); p += plsk; } @@ -198,8 +197,7 @@ vips_embed_paint_edge( VipsEmbed *embed, /* Horizontal line of pixels to copy. */ for( y = 0; y < todo.height; y++ ) { - q = (PEL *) VIPS_REGION_ADDR( or, - todo.left, todo.top + y ); + q = VIPS_REGION_ADDR( or, todo.left, todo.top + y ); memcpy( q, p, bs * todo.width ); } } @@ -214,7 +212,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) Rect ovl; int i; - PEL *p; + VipsPel *p; int plsk; /* Entirely within the input image? Generate the subimage and copy @@ -275,7 +273,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) * that. */ if( !vips_rect_isempty( &ovl ) ) { - p = (PEL *) VIPS_REGION_ADDR( or, + p = VIPS_REGION_ADDR( or, edge.left, edge.top ); plsk = VIPS_REGION_LSKIP( or ); } @@ -287,7 +285,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) edge.top -= embed->y; if( vips_region_prepare( ir, &edge ) ) return( -1 ); - p = (PEL *) VIPS_REGION_ADDR( ir, + p = VIPS_REGION_ADDR( ir, edge.left, edge.top ); plsk = VIPS_REGION_LSKIP( ir ); } @@ -567,13 +565,16 @@ vips_embed_init( VipsEmbed *embed ) * vips_embed: * @in: input image * @out: output image - * @width: @out should be this many pixels across - * @height: @out should be this many pixels down * @x: place @in at this x position in @out * @y: place @in at this y position in @out - * @extend: how to generate the edge pixels + * @width: @out should be this many pixels across + * @height: @out should be this many pixels down * @...: %NULL-terminated list of optional named arguments * + * Optional arguments: + * + * @extend: how to generate the edge pixels + * * The opposite of vips_extract_area(): embed @in within an image of size * @width by @height at position @x, @y. @extend * controls what appears in the new pels, see #VipsExtend. diff --git a/libvips/conversion/extract.c b/libvips/conversion/extract.c index d9cc6cd2..495c1005 100644 --- a/libvips/conversion/extract.c +++ b/libvips/conversion/extract.c @@ -278,7 +278,8 @@ typedef VipsBandaryClass VipsExtractBandClass; G_DEFINE_TYPE( VipsExtractBand, vips_extract_band, VIPS_TYPE_BANDARY ); static void -vips_extract_band_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width ) +vips_extract_band_buffer( VipsBandary *bandary, + VipsPel *out, VipsPel **in, int width ) { VipsConversion *conversion = (VipsConversion *) bandary; VipsExtractBand *extract = (VipsExtractBand *) bandary; @@ -287,7 +288,7 @@ vips_extract_band_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width ) int ips = VIPS_IMAGE_SIZEOF_PEL( im ); const int ops = VIPS_IMAGE_SIZEOF_PEL( conversion->out ); - PEL *p, *q; + VipsPel *p, *q; int x, z; p = in[0] + extract->band * es; @@ -381,9 +382,12 @@ vips_extract_band_init( VipsExtractBand *extract ) * @in: input image * @out: output image * @band: band to extract - * @n: number of bands to extract * @...: %NULL-terminated list of optional named arguments * + * Optional arguments: + * + * @n: number of bands to extract + * * Extract a band or bands from an image. Extracting out of range is an error. * * See also: vips_extract_area(). diff --git a/libvips/conversion/flip.c b/libvips/conversion/flip.c index a24424c7..d5b61c3f 100644 --- a/libvips/conversion/flip.c +++ b/libvips/conversion/flip.c @@ -88,7 +88,7 @@ vips_flip_vertical_gen( VipsRegion *or, void *seq, void *a, void *b, VipsRegion *ir = (VipsRegion *) seq; VipsRect *r = &or->valid; VipsRect in; - PEL *p, *q; + VipsPel *p, *q; int y; int le = r->left; @@ -110,8 +110,8 @@ vips_flip_vertical_gen( VipsRegion *or, void *seq, void *a, void *b, /* Loop, copying and reversing lines. */ - p = (PEL *) VIPS_REGION_ADDR( ir, le, in.top + in.height - 1 ); - q = (PEL *) VIPS_REGION_ADDR( or, le, to ); + p = VIPS_REGION_ADDR( ir, le, in.top + in.height - 1 ); + q = VIPS_REGION_ADDR( or, le, to ); psk = VIPS_REGION_LSKIP( ir ); qsk = VIPS_REGION_LSKIP( or ); ls = VIPS_REGION_SIZEOF_LINE( or ); @@ -133,7 +133,7 @@ vips_flip_horizontal_gen( VipsRegion *or, void *seq, void *a, void *b, VipsRegion *ir = (VipsRegion *) seq; VipsRect *r = &or->valid; VipsRect in; - PEL *p, *q; + VipsPel *p, *q; int x, y, z; int le = r->left; diff --git a/libvips/conversion/ifthenelse.c b/libvips/conversion/ifthenelse.c index 3e975368..665be75f 100644 --- a/libvips/conversion/ifthenelse.c +++ b/libvips/conversion/ifthenelse.c @@ -172,7 +172,8 @@ G_DEFINE_TYPE( VipsIfthenelse, vips_ifthenelse, VIPS_TYPE_CONVERSION ); /* Blend with a 1-band conditional image. */ static void -vips_blend1_buffer( PEL *qp, PEL *c, PEL *ap, PEL *bp, int width, +vips_blend1_buffer( VipsPel *qp, + VipsPel *c, VipsPel *ap, VipsPel *bp, int width, VipsImage *im ) { int i, x, z; @@ -199,7 +200,8 @@ vips_blend1_buffer( PEL *qp, PEL *c, PEL *ap, PEL *bp, int width, /* Blend with a many band conditional image. */ static void -vips_blendn_buffer( PEL *qp, PEL *c, PEL *ap, PEL *bp, int width, +vips_blendn_buffer( VipsPel *qp, + VipsPel *c, VipsPel *ap, VipsPel *bp, int width, VipsImage *im ) { int x, z; @@ -261,10 +263,10 @@ vips_ifthenelse_gen( VipsRegion *or, void *seq, void *client1, void *client2, /* Is the conditional all zero or all non-zero? We can avoid asking * for one of the inputs to be calculated. */ - all0 = *((PEL *) VIPS_REGION_ADDR( ir[2], le, to )) == 0; - alln0 = *((PEL *) VIPS_REGION_ADDR( ir[2], le, to )) != 0; + all0 = *VIPS_REGION_ADDR( ir[2], le, to ) == 0; + alln0 = *VIPS_REGION_ADDR( ir[2], le, to ) != 0; for( y = to; y < bo; y++ ) { - PEL *p = (PEL *) VIPS_REGION_ADDR( ir[2], le, y ); + VipsPel *p = VIPS_REGION_ADDR( ir[2], le, y ); for( x = 0; x < width; x++ ) { all0 &= p[x] == 0; @@ -298,10 +300,10 @@ vips_ifthenelse_gen( VipsRegion *or, void *seq, void *client1, void *client2, return( -1 ); for( y = to; y < bo; y++ ) { - PEL *ap = (PEL *) VIPS_REGION_ADDR( ir[0], le, y ); - PEL *bp = (PEL *) VIPS_REGION_ADDR( ir[1], le, y ); - PEL *cp = (PEL *) VIPS_REGION_ADDR( ir[2], le, y ); - PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y ); + VipsPel *ap = VIPS_REGION_ADDR( ir[0], le, y ); + VipsPel *bp = VIPS_REGION_ADDR( ir[1], le, y ); + VipsPel *cp = VIPS_REGION_ADDR( ir[2], le, y ); + VipsPel *q = VIPS_REGION_ADDR( or, le, y ); if( ifthenelse->blend ) { if( c->Bands == 1 ) diff --git a/libvips/conversion/im_falsecolour.c b/libvips/conversion/im_falsecolour.c index 4222d68c..49b22feb 100644 --- a/libvips/conversion/im_falsecolour.c +++ b/libvips/conversion/im_falsecolour.c @@ -341,7 +341,7 @@ im_falsecolour( IMAGE *in, IMAGE *out ) return( -1 ); in = t[1]; - if( !(lut = im_image( (PEL *) PET_colour, + if( !(lut = im_image( (VipsPel *) PET_colour, 1, 256, 3, IM_BANDFMT_UCHAR )) ) return( -1 ); if( im_maplut( in, out, lut ) ) { diff --git a/libvips/conversion/im_subsample.c b/libvips/conversion/im_subsample.c index ecaac347..ae66e9d9 100644 --- a/libvips/conversion/im_subsample.c +++ b/libvips/conversion/im_subsample.c @@ -85,8 +85,8 @@ line_shrink_gen( REGION *or, void *seq, void *a, void *b ) /* Loop down the region. */ for( y = to; y < bo; y++ ) { - PEL *q = IM_REGION_ADDR( or, le, y ); - PEL *p; + VipsPel *q = IM_REGION_ADDR( or, le, y ); + VipsPel *p; /* Loop across the region, in owidth sized pieces. */ @@ -149,8 +149,8 @@ point_shrink_gen( REGION *or, void *seq, void *a, void *b ) /* Loop down the region. */ for( y = to; y < bo; y++ ) { - PEL *q = IM_REGION_ADDR( or, le, y ); - PEL *p; + VipsPel *q = IM_REGION_ADDR( or, le, y ); + VipsPel *p; /* Loop across the region, in owidth sized pieces. */ diff --git a/libvips/conversion/im_text.c b/libvips/conversion/im_text.c index a21a114e..16c0e17a 100644 --- a/libvips/conversion/im_text.c +++ b/libvips/conversion/im_text.c @@ -94,7 +94,7 @@ text_ft_to_vips( FT_Bitmap *bitmap, IMAGE *out ) for( y = 0; y < bitmap->rows; y++ ) if( im_writeline( y, out, - (PEL *) bitmap->buffer + y * bitmap->pitch ) ) + (VipsPel *) bitmap->buffer + y * bitmap->pitch ) ) return( -1 ); return( 0 ); diff --git a/libvips/conversion/im_zoom.c b/libvips/conversion/im_zoom.c index 649a37cb..192ffbed 100644 --- a/libvips/conversion/im_zoom.c +++ b/libvips/conversion/im_zoom.c @@ -122,9 +122,9 @@ paint_whole( REGION *or, REGION *ir, ZoomInfo *zm, /* Loop over input, as we know we are all whole. */ for( y = itop; y < ibottom; y++ ) { - PEL *p = (PEL *) IM_REGION_ADDR( ir, ileft, y ); - PEL *q = (PEL *) IM_REGION_ADDR( or, left, y * zm->yfac ); - PEL *r; + VipsPel *p = IM_REGION_ADDR( ir, ileft, y ); + VipsPel *q = IM_REGION_ADDR( or, left, y * zm->yfac ); + VipsPel *r; /* Expand the first line of pels. */ @@ -184,9 +184,9 @@ paint_part( REGION *or, REGION *ir, const ZoomInfo *zm, /* Have to loop over output. */ for( y = top; y < bottom; ) { - PEL *p = (PEL *) IM_REGION_ADDR( ir, ix, y / zm->yfac ); - PEL *q = (PEL *) IM_REGION_ADDR( or, left, y ); - PEL *r; + VipsPel *p = IM_REGION_ADDR( ir, ix, y / zm->yfac ); + VipsPel *q = IM_REGION_ADDR( or, left, y ); + VipsPel *r; /* Output pels until we jump the input pointer. */ diff --git a/libvips/conversion/insert.c b/libvips/conversion/insert.c index 7aed7ecc..6b39c1cd 100644 --- a/libvips/conversion/insert.c +++ b/libvips/conversion/insert.c @@ -89,7 +89,7 @@ typedef struct _VipsInsert { /* Pixel we paint calculated from background. */ - PEL *ink; + VipsPel *ink; /* Inputs cast and banded up. */ @@ -209,7 +209,7 @@ vips_insert_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) /* Calculate a pixel for an image from a vec of double. Valid while im is * valid. */ -PEL * +VipsPel * vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n ) { VipsImage **t; @@ -237,14 +237,14 @@ vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n ) #ifdef VIPS_DEBUG { - PEL *p = (PEL *) (t[3]->data); + VipsPel *p = (VipsPel *) (t[3]->data); printf( "vips__vector_to_ink: ink = %p (%d %d %d)\n", p, p[0], p[1], p[2] ); } #endif /*VIPS_DEBUG*/ - return( (PEL *) t[3]->data ); + return( (VipsPel *) t[3]->data ); } static int @@ -407,9 +407,12 @@ vips_insert_init( VipsInsert *insert ) * @out: output image * @x: left position of @sub * @y: top position of @sub + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @expand: expand output to hold whole of both images * @background: colour for new pixels - * @...: %NULL-terminated list of optional named arguments * * Insert one image into another. @sub is inserted into image @main at * position @x, @y relative to the top LH corner of @main. diff --git a/libvips/conversion/join.c b/libvips/conversion/join.c index b074a378..815f4ccb 100644 --- a/libvips/conversion/join.c +++ b/libvips/conversion/join.c @@ -274,11 +274,14 @@ vips_join_init( VipsJoin *join ) * @in2: second input image * @out: output image * @direction: join horizontally or vertically + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @expand: %TRUE to expand the output image to hold all of the input pixels * @shim: space between images, in pixels * @background: background ink colour * @align: low, centre or high alignment - * @...: %NULL-terminated list of optional named arguments * * Join @in1 and @in2 together, left-right or up-down depending on the value * of @direction. diff --git a/libvips/conversion/recomb.c b/libvips/conversion/recomb.c index 432e86a1..6d1b7ce8 100644 --- a/libvips/conversion/recomb.c +++ b/libvips/conversion/recomb.c @@ -113,9 +113,9 @@ vips_recomb_gen( VipsRegion *or, return( -1 ); for( y = 0; y < or->valid.height; y++ ) { - PEL *in = (PEL *) VIPS_REGION_ADDR( ir, + VipsPel *in = VIPS_REGION_ADDR( ir, or->valid.left, or->valid.top + y ); - PEL *out = (PEL *) VIPS_REGION_ADDR( or, + VipsPel *out = VIPS_REGION_ADDR( or, or->valid.left, or->valid.top + y ); switch( vips_image_get_format( im ) ) { diff --git a/libvips/conversion/rot.c b/libvips/conversion/rot.c index 6a2a20de..d00e35fc 100644 --- a/libvips/conversion/rot.c +++ b/libvips/conversion/rot.c @@ -132,11 +132,11 @@ vips_rot90_gen( VipsRegion *or, void *seq, void *a, void *b, for( y = to; y < bo; y++ ) { /* Start of this output line. */ - PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y ); + VipsPel *q = VIPS_REGION_ADDR( or, le, y ); /* Corresponding position in ir. */ - PEL *p = (PEL *) VIPS_REGION_ADDR( ir, + VipsPel *p = VIPS_REGION_ADDR( ir, need.left + y - to, need.top + need.height - 1 ); @@ -193,11 +193,11 @@ vips_rot180_gen( VipsRegion *or, void *seq, void *a, void *b, for( y = to; y < bo; y++ ) { /* Start of this output line. */ - PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y ); + VipsPel *q = VIPS_REGION_ADDR( or, le, y ); /* Corresponding position in ir. */ - PEL *p = (PEL *) VIPS_REGION_ADDR( ir, + VipsPel *p = VIPS_REGION_ADDR( ir, need.left + need.width - 1, need.top + need.height - (y - to) - 1 ); @@ -255,11 +255,11 @@ vips_rot270_gen( VipsRegion *or, void *seq, void *a, void *b, for( y = to; y < bo; y++ ) { /* Start of this output line. */ - PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y ); + VipsPel *q = VIPS_REGION_ADDR( or, le, y ); /* Corresponding position in ir. */ - PEL *p = (PEL *) VIPS_REGION_ADDR( ir, + VipsPel *p = VIPS_REGION_ADDR( ir, need.left + need.width - (y - to) - 1, need.top ); diff --git a/libvips/conversion/tilecache.c b/libvips/conversion/tilecache.c index 2e94b5d3..4c27eb97 100644 --- a/libvips/conversion/tilecache.c +++ b/libvips/conversion/tilecache.c @@ -292,8 +292,8 @@ copy_region( VipsRegion *from, VipsRegion *to, VipsRect *area ) /* Loop down common area, copying. */ for( y = area->top; y < VIPS_RECT_BOTTOM( area ); y++ ) { - PEL *p = (PEL *) VIPS_REGION_ADDR( from, area->left, y ); - PEL *q = (PEL *) VIPS_REGION_ADDR( to, area->left, y ); + VipsPel *p = VIPS_REGION_ADDR( from, area->left, y ); + VipsPel *q = VIPS_REGION_ADDR( to, area->left, y ); memcpy( q, p, VIPS_IMAGE_SIZEOF_PEL( from->im ) * area->width ); } @@ -438,10 +438,13 @@ vips_tile_cache_init( VipsTileCache *cache ) * vips_tilecache: * @in: input image * @out: output image + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @tile_width: width of tiles in cache * @tile_height: height of tiles in cache * @max_tiles: maximum number of tiles to cache - * @...: %NULL-terminated list of optional named arguments * * This operation behaves rather like vips_copy() between images * @in and @out, except that it keeps a cache of computed pixels. diff --git a/libvips/convolution/im_conv.c b/libvips/convolution/im_conv.c index 21151800..17bfe5e3 100644 --- a/libvips/convolution/im_conv.c +++ b/libvips/convolution/im_conv.c @@ -540,7 +540,7 @@ typedef struct { REGION *ir; /* Input region */ int *offsets; /* Offsets for each non-zero matrix element */ - PEL **pts; /* Per-non-zero mask element pointers */ + VipsPel **pts; /* Per-non-zero mask element pointers */ int underflow; /* Underflow/overflow counts */ int overflow; @@ -602,7 +602,7 @@ conv_start( IMAGE *out, void *a, void *b ) */ seq->ir = im_region_create( in ); seq->offsets = IM_ARRAY( out, conv->nnz, int ); - seq->pts = IM_ARRAY( out, conv->nnz, PEL * ); + seq->pts = IM_ARRAY( out, conv->nnz, VipsPel * ); if( !seq->ir || !seq->offsets || !seq->pts ) { conv_stop( seq, in, conv ); return( NULL ); @@ -726,7 +726,7 @@ conv_gen( REGION *or, void *vseq, void *a, void *b ) */ for( z = 0; z < conv->nnz; z++ ) seq->pts[z] = seq->offsets[z] + - (PEL *) IM_REGION_ADDR( ir, le, y ); + IM_REGION_ADDR( ir, le, y ); switch( in->BandFmt ) { case IM_BANDFMT_UCHAR: @@ -965,8 +965,8 @@ convvec_gen( REGION *or, void *vseq, void *a, void *b ) printf( "before convolve: %d, %d\n", r->left, r->top + y ); for( v = 0; v < mask->ysize; v++ ) { for( h = 0; h < mask->xsize; h++ ) - printf( "%3d ", *((PEL *) IM_REGION_ADDR( ir, - r->left + h, r->top + y + v )) ); + printf( "%3d ", *IM_REGION_ADDR( ir, + r->left + h, r->top + y + v ) ); printf( "\n" ); } } @@ -996,7 +996,7 @@ convvec_gen( REGION *or, void *vseq, void *a, void *b ) #ifdef DEBUG_PIXELS printf( "after clip: %d\n", - *((PEL *) IM_REGION_ADDR( or, r->left, r->top + y )) ); + *IM_REGION_ADDR( or, r->left, r->top + y ) ); #endif /*DEBUG_PIXELS*/ } diff --git a/libvips/convolution/im_conv_f.c b/libvips/convolution/im_conv_f.c index 9af1b048..cbac06e2 100644 --- a/libvips/convolution/im_conv_f.c +++ b/libvips/convolution/im_conv_f.c @@ -154,7 +154,7 @@ typedef struct { REGION *ir; /* Input region */ int *offsets; /* Offsets for each non-zero matrix element */ - PEL **pts; /* Per-non-zero mask element image pointers */ + VipsPel **pts; /* Per-non-zero mask element image pointers */ int last_bpl; /* Avoid recalcing offsets, if we can */ } ConvSequence; @@ -194,7 +194,7 @@ conv_start( IMAGE *out, void *a, void *b ) */ seq->ir = im_region_create( in ); seq->offsets = IM_ARRAY( out, conv->nnz, int ); - seq->pts = IM_ARRAY( out, conv->nnz, PEL * ); + seq->pts = IM_ARRAY( out, conv->nnz, VipsPel * ); if( !seq->ir || !seq->offsets || !seq->pts ) { conv_stop( seq, in, conv ); return( NULL ); @@ -278,8 +278,8 @@ conv_gen( REGION *or, void *vseq, void *a, void *b ) /* Init pts for this line of PELs. */ for( z = 0; z < conv->nnz; z++ ) - seq->pts[z] = seq->offsets[z] + - (PEL *) IM_REGION_ADDR( ir, le, y ); + seq->pts[z] = seq->offsets[z] + + IM_REGION_ADDR( ir, le, y ); switch( in->BandFmt ) { case IM_BANDFMT_UCHAR: diff --git a/libvips/convolution/im_fastcor.c b/libvips/convolution/im_fastcor.c index ec28262a..dc666cd5 100644 --- a/libvips/convolution/im_fastcor.c +++ b/libvips/convolution/im_fastcor.c @@ -91,8 +91,8 @@ fastcor_gen( REGION *or, void *seq, void *a, void *b ) IM_REGION_ADDR( or, r->left, r->top + y ); for( x = 0; x < r->width; x++ ) { - PEL *b = (PEL *) ref->data; - PEL *a = (PEL *) + VipsPel *b = ref->data; + VipsPel *a = IM_REGION_ADDR( ir, r->left + x, r->top + y ); int sum; diff --git a/libvips/convolution/im_spcor.c b/libvips/convolution/im_spcor.c index 97fa2125..92817e66 100644 --- a/libvips/convolution/im_spcor.c +++ b/libvips/convolution/im_spcor.c @@ -171,7 +171,7 @@ spcor_gen( REGION *or, void *vseq, void *a, void *b ) float *q = (float *) IM_REGION_ADDR( or, le, y ); for( x = le; x < ri; x++ ) { - PEL *p = (PEL *) IM_REGION_ADDR( ir, x, y ); + VipsPel *p = IM_REGION_ADDR( ir, x, y ); /* Find sums for this position. */ @@ -203,7 +203,7 @@ spcor_new( IMAGE *out, IMAGE *ref ) { Spcor *spcor; size_t sz = ref->Xsize * ref->Ysize; - PEL *p = (PEL *) ref->data; + VipsPel *p = ref->data; double s; size_t i; diff --git a/libvips/deprecated/cooc_funcs.c b/libvips/deprecated/cooc_funcs.c index 84eb2ad8..f4e2cc56 100644 --- a/libvips/deprecated/cooc_funcs.c +++ b/libvips/deprecated/cooc_funcs.c @@ -81,7 +81,7 @@ IMAGE *im, *m; int xpos, ypos, xsize, ysize; /* location of the box within im */ int dx, dy; /* displacements */ { - PEL *input, *cpinput; + VipsPel *input, *cpinput; int *buf, *pnt, *cpnt; double *line, *cpline; int x, y; @@ -113,7 +113,7 @@ int dx, dy; /* displacements */ if ( (buf == NULL) || (line == NULL) ) { im_error( "im_cooc_sym", "%s", _( "calloc failed") ); return(-1); } - input = (PEL*)im->data; + input = im->data; input += ( ypos * im->Xsize + xpos ); offset = dy * im->Xsize + dx; for ( y=0; yXsize; x++) *cpline++ = (double)(*cpnt++)/(double)norm; - if (im_writeline( y, m, (PEL *) line ) == -1) + if (im_writeline( y, m, (VipsPel *) line ) == -1) { im_error( "im_cooc_sym", "%s", _( "unable to im_writeline") ); return(-1); @@ -158,7 +158,7 @@ IMAGE *im, *m; int xpos, ypos, xsize, ysize; /* location of the box within im */ int dx, dy; /* displacements */ { - PEL *input, *cpinput; + VipsPel *input, *cpinput; int *buf, *pnt, *cpnt; double *line, *cpline; int x, y; @@ -190,7 +190,7 @@ int dx, dy; /* displacements */ if ( (buf == NULL) || (line == NULL) ) { im_error( "im_cooc_ord", "%s", _( "calloc failed") ); return(-1); } - input = (PEL*)im->data; + input = im->data; input += ( ypos * im->Xsize + xpos ); offset = dy * im->Xsize + dx; for ( y=0; ydata; + p = in->data; for( y = 0; y < in->Ysize; y++ ) { for( x = 0; x < w; x++ ) { if( x > 0 ) diff --git a/libvips/foreign/csvload.c b/libvips/foreign/csvload.c index 6482f1b9..093e8612 100644 --- a/libvips/foreign/csvload.c +++ b/libvips/foreign/csvload.c @@ -176,11 +176,14 @@ vips_foreign_load_csv_init( VipsForeignLoadCsv *csv ) * vips_csvload: * @filename: file to load * @out: output image + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @skip: skip this many lines at start of file * @lines: read this many lines from file * @whitespace: set of whitespace characters * @separator: set of separator characters - * @...: %NULL-terminated list of optional named arguments * * Load a CSV (comma-separated values) file. The output image is always 1 * band (monochrome), #VIPS_FORMAT_DOUBLE. diff --git a/libvips/foreign/csvsave.c b/libvips/foreign/csvsave.c index f01b1d3f..39cb6090 100644 --- a/libvips/foreign/csvsave.c +++ b/libvips/foreign/csvsave.c @@ -142,9 +142,12 @@ vips_foreign_save_csv_init( VipsForeignSaveCsv *csv ) * vips_csvsave: * @in: image to save * @filename: file to write to - * @separator: separator string * @...: %NULL-terminated list of optional named arguments * + * Optional arguments: + * + * @separator: separator string + * * Writes the pixels in @in to the @filename as CSV (comma-separated values). * The image is written * one line of text per scanline. Complex numbers are written as diff --git a/libvips/foreign/fits.c b/libvips/foreign/fits.c index 7132149d..07149673 100644 --- a/libvips/foreign/fits.c +++ b/libvips/foreign/fits.c @@ -113,7 +113,7 @@ typedef struct { /* We split bands up for write into this buffer. */ - PEL *buffer; + VipsPel *buffer; } VipsFits; const char *vips__fits_suffs[] = { ".fits", NULL }; @@ -349,7 +349,7 @@ fits2vips_generate( VipsRegion *out, VipsFits *fits = (VipsFits *) a; Rect *r = &out->valid; - PEL *q; + VipsPel *q; int z; int status; @@ -384,7 +384,7 @@ fits2vips_generate( VipsRegion *out, for( z = 0; z < MAX_DIMENSIONS; z++ ) inc[z] = 1; - q = (PEL *) VIPS_REGION_ADDR( out, r->left, r->top ); + q = VIPS_REGION_ADDR( out, r->left, r->top ); /* Break on ffgsv() for this call. */ @@ -417,7 +417,7 @@ fits2vips_generate( VipsRegion *out, for( z = 0; z < MAX_DIMENSIONS; z++ ) inc[z] = 1; - q = (PEL *) VIPS_REGION_ADDR( out, r->left, y ); + q = VIPS_REGION_ADDR( out, r->left, y ); /* Break on ffgsv() for this call. */ @@ -562,7 +562,7 @@ vips_fits_new_write( VipsImage *in, const char *filename ) /* We need to be able to hold one scanline of one band. */ if( !(fits->buffer = VIPS_ARRAY( NULL, - VIPS_IMAGE_SIZEOF_ELEMENT( in ) * in->Xsize, PEL )) ) + VIPS_IMAGE_SIZEOF_ELEMENT( in ) * in->Xsize, VipsPel )) ) return( NULL ); /* fits_create_file() will fail if there's a file of thet name, unless @@ -682,11 +682,11 @@ vips_fits_write( VipsRegion *region, VipsRect *area, void *a ) */ for( y = 0; y < area->height; y++ ) { - PEL *p = (PEL *) VIPS_REGION_ADDR( region, + VipsPel *p = VIPS_REGION_ADDR( region, area->left, area->top + y ); for( b = 0; b < image->Bands; b++ ) { - PEL *p1, *q; + VipsPel *p1, *q; long fpixel[3]; p1 = p + b * es; diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 55b7a84f..daadbcf3 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -1450,9 +1450,12 @@ vips_magickload( const char *filename, VipsImage **out, ... ) * vips_tiffload: * @filename: file to load * @out: decompressed image - * @page: load this page * @...: %NULL-terminated list of optional named arguments * + * Optional arguments: + * + * @page: load this page + * * Read a TIFF file into a VIPS image. It is a full baseline TIFF 6 reader, * with extensions for tiled images, multipage images, LAB colour space, * pyramidal images and JPEG compression. including CMYK and YCbCr. @@ -1483,6 +1486,10 @@ vips_tiffload( const char *filename, VipsImage **out, ... ) * vips_tiffsave: * @in: image to save * @filename: file to write to + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @compression; use this compression scheme * @Q: quality factor * @predictor; compress with this prediction @@ -1496,7 +1503,6 @@ vips_tiffload( const char *filename, VipsImage **out, ... ) * @xres; horizontal resolution * @yres; vertical resolution * @bigtiff; write a BigTiff file - * @...: %NULL-terminated list of optional named arguments * * Write a VIPS image to a file as TIFF. * @@ -1611,10 +1617,12 @@ vips_jpegload_buffer( void *buf, size_t len, VipsImage **out, ... ) * vips_jpegload: * @filename: file to load * @out: decompressed image - * @flags: image flags + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @shrink: shrink by this much on load * @fail: fail on warnings - * @...: %NULL-terminated list of optional named arguments * * Read a JPEG file into a VIPS image. It can read most 8-bit JPEG images, * including CMYK and YCbCr. @@ -1673,9 +1681,12 @@ vips_jpegload( const char *filename, VipsImage **out, ... ) /** * vips_jpegsave_mime: * @in: image to save + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @Q: JPEG quality factor * @profile: attach this ICC profile - * @...: %NULL-terminated list of optional named arguments * * As vips_jpegsave(), but save as a mime jpeg on stdout. * @@ -1701,9 +1712,12 @@ vips_jpegsave_mime( VipsImage *in, ... ) * @in: image to save * @buf: return output buffer here * @len: return output length here + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @Q: JPEG quality factor * @profile: attach this ICC profile - * @...: %NULL-terminated list of optional named arguments * * As vips_jpegsave(), but save to a memory buffer. * @@ -1742,9 +1756,12 @@ vips_jpegsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) * vips_jpegsave: * @in: image to save * @filename: file to write to + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @Q: quality factor * @profile: attach this ICC profile - * @...: %NULL-terminated list of optional named arguments * * Write a VIPS image to a file as JPEG. * @@ -1815,9 +1832,12 @@ vips_openexrload( const char *filename, VipsImage **out, ... ) * vips_openslideload: * @filename: file to load * @out: decompressed image + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @layer: load this layer * @associated: load this associated image - * @...: %NULL-terminated list of optional named arguments * * Read a virtual slide supported by the OpenSlide library into a VIPS image. * OpenSlide supports images in Aperio, Hamamatsu VMS, Hamamatsu VMU, MIRAX, @@ -1938,9 +1958,12 @@ vips_pngload( const char *filename, VipsImage **out, ... ) * vips_pngsave: * @in: image to save * @filename: file to write to + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @compression: compression level * @interlace: interlace image - * @...: %NULL-terminated list of optional named arguments * * Write a VIPS image to a file as PNG. * @@ -1979,9 +2002,12 @@ vips_pngsave( VipsImage *in, const char *filename, ... ) * @in: image to save * @buf: return output buffer here * @len: return output length here + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @compression: compression level * @interlace: interlace image - * @...: %NULL-terminated list of optional named arguments * * As vips_pngsave(), but save to a memory buffer. * diff --git a/libvips/foreign/magick2vips.c b/libvips/foreign/magick2vips.c index 6344e130..0bd6c0d6 100644 --- a/libvips/foreign/magick2vips.c +++ b/libvips/foreign/magick2vips.c @@ -477,7 +477,7 @@ parse_header( Read *read ) } static void -unpack_pixels( VipsImage *im, PEL *q8, PixelPacket *pixels, int n ) +unpack_pixels( VipsImage *im, VipsPel *q8, PixelPacket *pixels, int n ) { int x; diff --git a/libvips/foreign/matlab.c b/libvips/foreign/matlab.c index 0519755d..5a196a65 100644 --- a/libvips/foreign/matlab.c +++ b/libvips/foreign/matlab.c @@ -223,7 +223,7 @@ static int mat2vips_get_data( mat_t *mat, matvar_t *var, VipsImage *im ) { int y; - PEL *buffer; + VipsPel *buffer; const int es = VIPS_IMAGE_SIZEOF_ELEMENT( im ); /* Matlab images are plane-separate, so we have to assemble bands in @@ -240,20 +240,21 @@ mat2vips_get_data( mat_t *mat, matvar_t *var, VipsImage *im ) /* Matlab images are in columns, so we have to transpose into * scanlines with this buffer. */ - if( !(buffer = VIPS_ARRAY( im, VIPS_IMAGE_SIZEOF_LINE( im ), PEL )) ) + if( !(buffer = VIPS_ARRAY( im, + VIPS_IMAGE_SIZEOF_LINE( im ), VipsPel )) ) return( -1 ); for( y = 0; y < im->Ysize; y++ ) { - const PEL *p = var->data + y * es; + const VipsPel *p = var->data + y * es; int x; - PEL *q; + VipsPel *q; q = buffer; for( x = 0; x < im->Xsize; x++ ) { int b; for( b = 0; b < im->Bands; b++ ) { - const PEL *p2 = p + b * is; + const VipsPel *p2 = p + b * is; int z; for( z = 0; z < es; z++ ) diff --git a/libvips/foreign/openexr2vips.c b/libvips/foreign/openexr2vips.c index bcec2328..ad0c6bb2 100644 --- a/libvips/foreign/openexr2vips.c +++ b/libvips/foreign/openexr2vips.c @@ -399,7 +399,7 @@ vips__openexr_read( const char *filename, VipsImage *out ) (ImfHalf *) imf_buffer, vips_buffer ); if( vips_image_write_line( out, y, - (PEL *) vips_buffer ) ) + (VipsPel *) vips_buffer ) ) return( -1 ); } } diff --git a/libvips/foreign/ppm.c b/libvips/foreign/ppm.c index dd2aae15..9d8762c9 100644 --- a/libvips/foreign/ppm.c +++ b/libvips/foreign/ppm.c @@ -305,9 +305,9 @@ static int read_ascii( FILE *fp, VipsImage *out ) { int x, y; - PEL *buf; + VipsPel *buf; - if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) ) + if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); for( y = 0; y < out->Ysize; y++ ) { @@ -349,9 +349,9 @@ static int read_1bit_ascii( FILE *fp, VipsImage *out ) { int x, y; - PEL *buf; + VipsPel *buf; - if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) ) + if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); for( y = 0; y < out->Ysize; y++ ) { @@ -381,9 +381,9 @@ read_1bit_binary( FILE *fp, VipsImage *out ) { int x, y, i; int bits; - PEL *buf; + VipsPel *buf; - if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) ) + if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); bits = fgetc( fp ); @@ -493,7 +493,7 @@ vips__ppm_load( const char *filename, VipsImage *out ) int vips__ppm_isppm( const char *filename ) { - PEL buf[3]; + VipsPel buf[3]; if( vips__get_bytes( filename, buf, 2 ) ) { int i; @@ -523,7 +523,7 @@ vips__ppm_flags( const char *filename ) const char *vips__ppm_suffs[] = { ".ppm", ".pgm", ".pbm", ".pfm", NULL }; -typedef int (*write_fn)( VipsImage *in, FILE *fp, PEL *p ); +typedef int (*write_fn)( VipsImage *in, FILE *fp, VipsPel *p ); /* What we track during a PPM write. */ @@ -564,7 +564,7 @@ write_new( VipsImage *in, const char *name ) } static int -write_ppm_line_ascii( VipsImage *in, FILE *fp, PEL *p ) +write_ppm_line_ascii( VipsImage *in, FILE *fp, VipsPel *p ) { const int sk = VIPS_IMAGE_SIZEOF_PEL( in ); int x, k; @@ -604,7 +604,7 @@ write_ppm_line_ascii( VipsImage *in, FILE *fp, PEL *p ) } static int -write_ppm_line_binary( VipsImage *in, FILE *fp, PEL *p ) +write_ppm_line_binary( VipsImage *in, FILE *fp, VipsPel *p ) { if( !fwrite( p, VIPS_IMAGE_SIZEOF_LINE( in ), 1, fp ) ) { vips_error( "vips2ppm", @@ -622,7 +622,7 @@ write_ppm_block( REGION *region, Rect *area, void *a ) int i; for( i = 0; i < area->height; i++ ) { - PEL *p = (PEL *) VIPS_REGION_ADDR( region, 0, area->top + i ); + VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + i ); if( write->fn( write->in, write->fp, p ) ) return( -1 ); diff --git a/libvips/foreign/ppmsave.c b/libvips/foreign/ppmsave.c index a00be19f..629b80e2 100644 --- a/libvips/foreign/ppmsave.c +++ b/libvips/foreign/ppmsave.c @@ -138,9 +138,12 @@ vips_foreign_save_ppm_init( VipsForeignSavePpm *ppm ) * vips_ppmsave: * @in: image to save * @filename: file to write to - * @ascii: save as ASCII rather than binary * @...: %NULL-terminated list of optional named arguments * + * Optional arguments: + * + * @ascii: save as ASCII rather than binary + * * Write a VIPS image to a file as PPM. It can write 8, 16 or * 32 bit unsigned integer images, float images, colour or monochrome, * stored as binary or ASCII. diff --git a/libvips/foreign/radiance.c b/libvips/foreign/radiance.c index ac8743ac..f829a223 100644 --- a/libvips/foreign/radiance.c +++ b/libvips/foreign/radiance.c @@ -1098,7 +1098,7 @@ vips2rad_put_data_block( VipsRegion *region, Rect *area, void *a ) int i; for( i = 0; i < area->height; i++ ) { - PEL *p = (PEL *) VIPS_REGION_ADDR( region, 0, area->top + i ); + VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + i ); if( fwritecolrs( p, area->width, write->fout ) ) return( -1 ); diff --git a/libvips/foreign/rawload.c b/libvips/foreign/rawload.c index 3830a715..a1614c2b 100644 --- a/libvips/foreign/rawload.c +++ b/libvips/foreign/rawload.c @@ -157,11 +157,14 @@ vips_foreign_load_raw_init( VipsForeignLoadRaw *raw ) * vips_rawload: * @filename: file to load * @out: output image + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * * @width: width of image in pixels * @height: height of image in pixels * @bands: number of image bands * @offset: offset in bytes from start of file - * @...: %NULL-terminated list of optional named arguments * * This operation mmaps the file, setting @out so that access to that * image will read from the file. diff --git a/libvips/foreign/rawsave.c b/libvips/foreign/rawsave.c index 51081cd2..c945f03b 100644 --- a/libvips/foreign/rawsave.c +++ b/libvips/foreign/rawsave.c @@ -94,7 +94,8 @@ vips_foreign_save_raw_write( VipsRegion *region, Rect *area, void *a ) int i; for( i = 0; i < area->height; i++ ) { - PEL *p = VIPS_REGION_ADDR( region, area->left, area->top + i ); + VipsPel *p = + VIPS_REGION_ADDR( region, area->left, area->top + i ); if( vips__write( raw->fd, p, VIPS_IMAGE_SIZEOF_PEL( save->in ) * area->width ) ) @@ -222,7 +223,8 @@ vips_foreign_save_raw_fd_write( VipsRegion *region, Rect *area, void *a ) int i; for( i = 0; i < area->height; i++ ) { - PEL *p = VIPS_REGION_ADDR( region, area->left, area->top + i ); + VipsPel *p = + VIPS_REGION_ADDR( region, area->left, area->top + i ); if( vips__write( fd->fd, p, VIPS_IMAGE_SIZEOF_PEL( save->in ) * area->width ) ) diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 1d9b892b..5844365f 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -178,7 +178,8 @@ /* Scanline-type process function. */ -typedef void (*scanline_process_fn)( PEL *q, PEL *p, int n, void *client ); +typedef void (*scanline_process_fn)( VipsPel *q, VipsPel *p, int n, + void *client ); /* Stuff we track during a read. */ @@ -326,7 +327,7 @@ tfget16( TIFF *tif, ttag_t tag, int *out ) /* Per-scanline process function for VIPS_CODING_LABQ. */ static void -labpack_line( PEL *q, PEL *p, int n, void *dummy ) +labpack_line( VipsPel *q, VipsPel *p, int n, void *dummy ) { int x; @@ -363,7 +364,7 @@ parse_labpack( ReadTiff *rtiff, VipsImage *out ) /* Per-scanline process function for VIPS_CODING_LABQ. */ static void -labs_line( PEL *q, PEL *p, int n, void *dummy ) +labs_line( VipsPel *q, VipsPel *p, int n, void *dummy ) { int x; unsigned short *p1 = (unsigned short *) p; @@ -401,13 +402,13 @@ parse_labs( ReadTiff *rtiff, VipsImage *out ) /* Per-scanline process function for 1 bit images. */ static void -onebit_line( PEL *q, PEL *p, int n, void *flg ) +onebit_line( VipsPel *q, VipsPel *p, int n, void *flg ) { /* Extract PHOTOMETRIC_INTERPRETATION. */ int pm = *((int *) flg); int x, i, z; - PEL bits; + VipsPel bits; int black = (pm == PHOTOMETRIC_MINISBLACK) ? 0 : 255; int white = black ^ -1; @@ -415,7 +416,7 @@ onebit_line( PEL *q, PEL *p, int n, void *flg ) /* (sigh) how many times have I written this? */ for( x = 0, i = 0; i < (n >> 3); i++ ) { - bits = (PEL) p[i]; + bits = (VipsPel) p[i]; for( z = 0; z < 8; z++, x++ ) { q[x] = (bits & 128) ? white : black; @@ -465,11 +466,11 @@ parse_onebit( ReadTiff *rtiff, int pm, VipsImage *out ) /* Per-scanline process function for 8-bit greyscale images. */ static void -greyscale8_line( PEL *q, PEL *p, int n, void *flg ) +greyscale8_line( VipsPel *q, VipsPel *p, int n, void *flg ) { /* Extract swap mask. */ - PEL mask = *((PEL *) flg); + VipsPel mask = *((VipsPel *) flg); int x; /* Read bytes, swapping sense if necessary. @@ -483,7 +484,7 @@ greyscale8_line( PEL *q, PEL *p, int n, void *flg ) static int parse_greyscale8( ReadTiff *rtiff, int pm, VipsImage *out ) { - PEL *mask; + VipsPel *mask; if( !tfequals( rtiff->tiff, TIFFTAG_SAMPLESPERPIXEL, 1 ) || !tfequals( rtiff->tiff, TIFFTAG_BITSPERSAMPLE, 8 ) ) @@ -491,7 +492,7 @@ parse_greyscale8( ReadTiff *rtiff, int pm, VipsImage *out ) /* Eor each pel with this later. */ - if( !(mask = VIPS_ARRAY( out, 1, PEL )) ) + if( !(mask = VIPS_ARRAY( out, 1, VipsPel )) ) return( -1 ); *mask = (pm == PHOTOMETRIC_MINISBLACK) ? 0 : 255; @@ -509,7 +510,7 @@ parse_greyscale8( ReadTiff *rtiff, int pm, VipsImage *out ) /* Per-scanline process function for 16-bit greyscale images. */ static void -greyscale16_line( PEL *q, PEL *p, int n, void *flg ) +greyscale16_line( VipsPel *q, VipsPel *p, int n, void *flg ) { /* Extract swap mask. */ @@ -555,7 +556,7 @@ parse_greyscale16( ReadTiff *rtiff, int pm, VipsImage *out ) /* Per-scanline process function when we just need to copy. */ static void -memcpy_line( PEL *q, PEL *p, int n, void *client ) +memcpy_line( VipsPel *q, VipsPel *p, int n, void *client ) { VipsImage *im = (VipsImage *) client; @@ -587,9 +588,9 @@ parse_greyscale32f( ReadTiff *rtiff, int pm, VipsImage *out ) typedef struct { /* LUTs mapping image indexes to RGB. */ - PEL *red; - PEL *green; - PEL *blue; + VipsPel *red; + VipsPel *green; + VipsPel *blue; /* Bits per sample. */ @@ -603,12 +604,12 @@ typedef struct { /* Per-scanline process function for palette images. */ static void -palette_line( PEL *q, PEL *p, int n, void *flg ) +palette_line( VipsPel *q, VipsPel *p, int n, void *flg ) { PaletteRead *read = (PaletteRead *) flg; int bit; - PEL data; + VipsPel data; int x; bit = 0; @@ -648,9 +649,9 @@ parse_palette( ReadTiff *rtiff, VipsImage *out ) int i; if( !(read = VIPS_NEW( out, PaletteRead )) || - !(read->red = VIPS_ARRAY( out, 256, PEL )) || - !(read->green = VIPS_ARRAY( out, 256, PEL )) || - !(read->blue = VIPS_ARRAY( out, 256, PEL )) ) + !(read->red = VIPS_ARRAY( out, 256, VipsPel )) || + !(read->green = VIPS_ARRAY( out, 256, VipsPel )) || + !(read->blue = VIPS_ARRAY( out, 256, VipsPel )) ) return( -1 ); if( !tfequals( rtiff->tiff, TIFFTAG_SAMPLESPERPIXEL, 1 ) || @@ -1225,10 +1226,10 @@ tiff_fill_region( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop ) * Just unpack the section of the tile we need. */ for( z = 0; z < hit.height; z++ ) { - PEL *p = (PEL *) buf + + VipsPel *p = (VipsPel *) buf + (hit.left - tile.left) * tps + (hit.top - tile.top + z) * tls; - PEL *q = (PEL *) VIPS_REGION_ADDR( out, + VipsPel *q = VIPS_REGION_ADDR( out, hit.left, hit.top + z ); rtiff->sfn( q, p, hit.width, rtiff->client ); @@ -1312,13 +1313,13 @@ read_stripwise( ReadTiff *rtiff, VipsImage *out ) tsize_t strip_size; int number_of_strips; - PEL *vbuf; + VipsPel *vbuf; tdata_t tbuf; tstrip_t strip; tsize_t length; int y; int i; - PEL *p; + VipsPel *p; #ifdef DEBUG printf( "tiff2vips: read_stripwise\n" ); @@ -1342,7 +1343,8 @@ read_stripwise( ReadTiff *rtiff, VipsImage *out ) /* Make buffers. */ - if( !(vbuf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) || + if( !(vbuf = VIPS_ARRAY( out, + VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) || !(tbuf = vips_malloc( VIPS_OBJECT( out ), strip_size )) ) return( -1 ); diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index 66636d57..81090289 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -182,7 +182,7 @@ /* Max no of tiles we buffer in a layer. Enough to buffer a line of 64x64 * tiles on a 100k pixel across image. */ -#define IM_MAX_LAYER_BUFFER (1000) +#define MAX_LAYER_BUFFER (1000) /* Bits we OR together for quadrants in a tile. */ @@ -198,7 +198,7 @@ typedef enum pyramid_bits { /* A tile in our pyramid. */ typedef struct pyramid_tile { - REGION *tile; + VipsRegion *tile; PyramidBits bits; } PyramidTile; @@ -213,8 +213,8 @@ typedef struct pyramid_layer { char *lname; /* Name of this TIFF file */ TIFF *tif; /* TIFF file we write this layer to */ - PEL *tbuf; /* TIFF output buffer */ - PyramidTile tiles[IM_MAX_LAYER_BUFFER]; + VipsPel *tbuf; /* TIFF output buffer */ + PyramidTile tiles[MAX_LAYER_BUFFER]; struct pyramid_layer *below; /* Tiles go to here */ struct pyramid_layer *above; /* Tiles come from here */ @@ -223,18 +223,18 @@ typedef struct pyramid_layer { /* A TIFF image in the process of being written. */ typedef struct tiff_write { - IMAGE *im; /* Original input image */ + VipsImage *im; /* Original input image */ char *name; /* Final name we write to */ /* Read from im with these. */ - REGION *reg; + VipsRegion *reg; char *bname; /* Name for base layer */ TIFF *tif; /* Image we write to */ PyramidLayer *layer; /* Top of pyramid, if in use */ - PEL *tbuf; /* TIFF output buffer */ + VipsPel *tbuf; /* TIFF output buffer */ int tls; /* Tile line size */ int compression; /* Compression type */ @@ -266,7 +266,7 @@ tiff_openout( TiffWrite *tw, const char *name ) #endif /*DEBUG*/ if( !(tif = TIFFOpen( name, mode )) ) { - im_error( "vips2tiff", + vips_error( "vips2tiff", _( "unable to open \"%s\" for output" ), name ); return( NULL ); } @@ -282,7 +282,7 @@ tiff_openin( const char *name ) TIFF *tif; if( !(tif = TIFFOpen( name, "r" )) ) { - im_error( "vips2tiff", + vips_error( "vips2tiff", _( "unable to open \"%s\" for input" ), name ); return( NULL ); } @@ -293,7 +293,7 @@ tiff_openin( const char *name ) /* Convert VIPS LabQ to TIFF LAB. Just take the first three bands. */ static void -LabQ2LabC( PEL *q, PEL *p, int n ) +LabQ2LabC( VipsPel *q, VipsPel *p, int n ) { int x; @@ -312,10 +312,10 @@ LabQ2LabC( PEL *q, PEL *p, int n ) /* Pack 8 bit VIPS to 1 bit TIFF. */ static void -eightbit2onebit( PEL *q, PEL *p, int n ) +eightbit2onebit( VipsPel *q, VipsPel *p, int n ) { int x; - PEL bits; + VipsPel bits; bits = 0; for( x = 0; x < n; x++ ) { @@ -338,7 +338,7 @@ eightbit2onebit( PEL *q, PEL *p, int n ) /* Convert VIPS LABS to TIFF 16 bit LAB. */ static void -LabS2Lab16( PEL *q, PEL *p, int n ) +LabS2Lab16( VipsPel *q, VipsPel *p, int n ) { int x; short *p1 = (short *) p; @@ -359,23 +359,23 @@ LabS2Lab16( PEL *q, PEL *p, int n ) /* Pack a VIPS region into a TIFF tile buffer. */ static void -pack2tiff( TiffWrite *tw, REGION *in, PEL *q, Rect *area ) +pack2tiff( TiffWrite *tw, VipsRegion *in, VipsPel *q, VipsRect *area ) { int y; - for( y = area->top; y < IM_RECT_BOTTOM( area ); y++ ) { - PEL *p = (PEL *) IM_REGION_ADDR( in, area->left, y ); + for( y = area->top; y < VIPS_RECT_BOTTOM( area ); y++ ) { + VipsPel *p = (VipsPel *) VIPS_REGION_ADDR( in, area->left, y ); - if( in->im->Coding == IM_CODING_LABQ ) + if( in->im->Coding == VIPS_CODING_LABQ ) LabQ2LabC( q, p, area->width ); else if( tw->onebit ) eightbit2onebit( q, p, area->width ); - else if( in->im->BandFmt == IM_BANDFMT_SHORT && - in->im->Type == IM_TYPE_LABS ) + else if( in->im->BandFmt == VIPS_FORMAT_SHORT && + in->im->Type == VIPS_INTERPRETATION_LABS ) LabS2Lab16( q, p, area->width ); else memcpy( q, p, - area->width * IM_IMAGE_SIZEOF_PEL( in->im ) ); + area->width * VIPS_IMAGE_SIZEOF_PEL( in->im ) ); q += tw->tls; } @@ -389,10 +389,10 @@ embed_profile_file( TIFF *tif, const char *profile ) char *buffer; unsigned int length; - if( !(buffer = im__file_read_name( profile, VIPS_ICC_DIR, &length )) ) + if( !(buffer = vips__file_read_name( profile, VIPS_ICC_DIR, &length )) ) return( -1 ); TIFFSetField( tif, TIFFTAG_ICCPROFILE, length, buffer ); - im_free( buffer ); + vips_free( buffer ); #ifdef DEBUG printf( "vips2tiff: attached profile \"%s\"\n", profile ); @@ -401,15 +401,15 @@ embed_profile_file( TIFF *tif, const char *profile ) return( 0 ); } -/* Embed an ICC profile from IMAGE metadata. +/* Embed an ICC profile from VipsImage metadata. */ static int -embed_profile_meta( TIFF *tif, IMAGE *im ) +embed_profile_meta( TIFF *tif, VipsImage *im ) { void *data; size_t data_length; - if( im_meta_get_blob( im, IM_META_ICC_NAME, &data, &data_length ) ) + if( vips_image_get_blob( im, VIPS_META_ICC_NAME, &data, &data_length ) ) return( -1 ); TIFFSetField( tif, TIFFTAG_ICCPROFILE, data_length, data ); @@ -429,14 +429,14 @@ embed_profile( TiffWrite *tw, TIFF *tif ) return( -1 ); if( !tw->icc_profile && - im_header_get_typeof( tw->im, IM_META_ICC_NAME ) && + vips_image_get_typeof( tw->im, VIPS_META_ICC_NAME ) && embed_profile_meta( tif, tw->im ) ) return( -1 ); return( 0 ); } -/* Write a TIFF header. width and height are the size of the IMAGE we are +/* Write a TIFF header. width and height are the size of the VipsImage we are * writing (may have been shrunk!). */ static int @@ -468,9 +468,9 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height ) */ TIFFSetField( tif, TIFFTAG_RESOLUTIONUNIT, tw->resunit ); TIFFSetField( tif, TIFFTAG_XRESOLUTION, - IM_CLIP( 0.01, tw->xres, 10000 ) ); + VIPS_CLIP( 0.01, tw->xres, 10000 ) ); TIFFSetField( tif, TIFFTAG_YRESOLUTION, - IM_CLIP( 0.01, tw->yres, 10000 ) ); + VIPS_CLIP( 0.01, tw->yres, 10000 ) ); /* Attach ICC profile. */ @@ -479,7 +479,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height ) /* And colour fields. */ - if( tw->im->Coding == IM_CODING_LABQ ) { + if( tw->im->Coding == VIPS_CODING_LABQ ) { TIFFSetField( tif, TIFFTAG_SAMPLESPERPIXEL, 3 ); TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE, 8 ); TIFFSetField( tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_CIELAB ); @@ -495,7 +495,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height ) TIFFSetField( tif, TIFFTAG_SAMPLESPERPIXEL, tw->im->Bands ); TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE, - im_bits_of_fmt( tw->im->BandFmt ) ); + vips_format_sizeof( tw->im->BandFmt ) << 3 ); switch( tw->im->Bands ) { case 1: @@ -509,10 +509,10 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height ) case 3: case 4: - if( tw->im->Type == IM_TYPE_LAB || - tw->im->Type == IM_TYPE_LABS ) + if( tw->im->Type == VIPS_INTERPRETATION_LAB || + tw->im->Type == VIPS_INTERPRETATION_LABS ) photometric = PHOTOMETRIC_CIELAB; - else if( tw->im->Type == IM_TYPE_CMYK ) { + else if( tw->im->Type == VIPS_INTERPRETATION_CMYK ) { photometric = PHOTOMETRIC_SEPARATED; TIFFSetField( tif, TIFFTAG_INKSET, INKSET_CMYK ); @@ -527,7 +527,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height ) else photometric = PHOTOMETRIC_RGB; - if( tw->im->Type != IM_TYPE_CMYK && + if( tw->im->Type != VIPS_INTERPRETATION_CMYK && tw->im->Bands == 4 ) { v[0] = EXTRASAMPLE_ASSOCALPHA; TIFFSetField( tif, TIFFTAG_EXTRASAMPLES, 1, v ); @@ -535,7 +535,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height ) break; case 5: - if( tw->im->Type == IM_TYPE_CMYK ) { + if( tw->im->Type == VIPS_INTERPRETATION_CMYK ) { photometric = PHOTOMETRIC_SEPARATED; TIFFSetField( tif, TIFFTAG_INKSET, INKSET_CMYK ); @@ -565,7 +565,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height ) /* Sample format ... for float, we write IEEE. */ - if( tw->im->BandFmt == IM_BANDFMT_FLOAT ) + if( tw->im->BandFmt == VIPS_FORMAT_FLOAT ) TIFFSetField( tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP ); return( 0 ); @@ -578,16 +578,13 @@ free_layer( PyramidLayer *layer ) { int i; - for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ ) - if( layer->tiles[i].tile ) { - im_region_free( layer->tiles[i].tile ); - layer->tiles[i].tile = NULL; - } + for( i = 0; i < MAX_LAYER_BUFFER; i++ ) + VIPS_FREEF( g_object_unref, layer->tiles[i].tile ); /* And close the TIFF file we are writing to. */ - IM_FREEF( im_free, layer->tbuf ); - IM_FREEF( TIFFClose, layer->tif ); + VIPS_FREEF( vips_free, layer->tbuf ); + VIPS_FREEF( TIFFClose, layer->tif ); } /* Free an entire pyramid. @@ -608,7 +605,7 @@ static int build_pyramid( TiffWrite *tw, PyramidLayer *above, PyramidLayer **zap, int w, int h ) { - PyramidLayer *layer = IM_NEW( tw->im, PyramidLayer ); + PyramidLayer *layer = VIPS_NEW( tw->im, PyramidLayer ); int i; if( !layer ) @@ -628,7 +625,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above, layer->tif = NULL; layer->tbuf = NULL; - for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ ) { + for( i = 0; i < MAX_LAYER_BUFFER; i++ ) { layer->tiles[i].tile = NULL; layer->tiles[i].bits = PYR_NONE; } @@ -645,7 +642,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above, &layer->below, layer->width, layer->height ) ) return( -1 ); - if( !(layer->lname = im__temp_name( "%s.tif" )) ) + if( !(layer->lname = vips__temp_name( "%s.tif" )) ) return( -1 ); /* Make output image. @@ -658,7 +655,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above, if( write_tiff_header( tw, layer->tif, layer->width, layer->height ) ) return( -1 ); - if( !(layer->tbuf = im_malloc( NULL, TIFFTileSize( layer->tif ) )) ) + if( !(layer->tbuf = vips_malloc( NULL, TIFFTileSize( layer->tif ) )) ) return( -1 ); return( 0 ); @@ -674,24 +671,24 @@ find_new_tile( PyramidLayer *layer ) /* Exisiting buffer we have finished with? */ - for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ ) + for( i = 0; i < MAX_LAYER_BUFFER; i++ ) if( layer->tiles[i].bits == PYR_ALL ) return( i ); /* Have to make a new one. */ - for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ ) + for( i = 0; i < MAX_LAYER_BUFFER; i++ ) if( !layer->tiles[i].tile ) { if( !(layer->tiles[i].tile = - im_region_create( layer->tw->im )) ) + vips_region_new( layer->tw->im )) ) return( -1 ); - im__region_no_ownership( layer->tiles[i].tile ); + vips__region_no_ownership( layer->tiles[i].tile ); return( i ); } /* Out of space! */ - im_error( "vips2tiff", + vips_error( "vips2tiff", "%s", _( "layer buffer exhausted -- " "try making TIFF output tiles smaller" ) ); @@ -701,17 +698,17 @@ find_new_tile( PyramidLayer *layer ) /* Find a tile in the layer buffer - if it's not there, make a new one. */ static int -find_tile( PyramidLayer *layer, Rect *pos ) +find_tile( PyramidLayer *layer, VipsRect *pos ) { int i; - Rect quad; - Rect image; - Rect inter; + VipsRect quad; + VipsRect image; + VipsRect inter; - /* Do we have a REGION for this position? + /* Do we have a VipsRegion for this position? */ - for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ ) { - REGION *reg = layer->tiles[i].tile; + for( i = 0; i < MAX_LAYER_BUFFER; i++ ) { + VipsRegion *reg = layer->tiles[i].tile; if( reg && reg->valid.left == pos->left && reg->valid.top == pos->top ) @@ -722,7 +719,7 @@ find_tile( PyramidLayer *layer, Rect *pos ) */ if( (i = find_new_tile( layer )) < 0 ) return( -1 ); - if( im_region_buffer( layer->tiles[i].tile, pos ) ) + if( vips_region_buffer( layer->tiles[i].tile, pos ) ) return( -1 ); layer->tiles[i].bits = PYR_NONE; @@ -738,43 +735,43 @@ find_tile( PyramidLayer *layer, Rect *pos ) quad.left = pos->left; quad.top = pos->top; - im_rect_intersectrect( &quad, &image, &inter ); - if( im_rect_isempty( &inter ) ) + vips_rect_intersectrect( &quad, &image, &inter ); + if( vips_rect_isempty( &inter ) ) layer->tiles[i].bits |= PYR_TL; quad.left = pos->left + quad.width; quad.top = pos->top; - im_rect_intersectrect( &quad, &image, &inter ); - if( im_rect_isempty( &inter ) ) + vips_rect_intersectrect( &quad, &image, &inter ); + if( vips_rect_isempty( &inter ) ) layer->tiles[i].bits |= PYR_TR; quad.left = pos->left; quad.top = pos->top + quad.height; - im_rect_intersectrect( &quad, &image, &inter ); - if( im_rect_isempty( &inter ) ) + vips_rect_intersectrect( &quad, &image, &inter ); + if( vips_rect_isempty( &inter ) ) layer->tiles[i].bits |= PYR_BL; quad.left = pos->left + quad.width; quad.top = pos->top + quad.height; - im_rect_intersectrect( &quad, &image, &inter ); - if( im_rect_isempty( &inter ) ) + vips_rect_intersectrect( &quad, &image, &inter ); + if( vips_rect_isempty( &inter ) ) layer->tiles[i].bits |= PYR_BR; return( i ); } /* Shrink a region by a factor of two, writing the result to a specified - * offset in another region. IM_CODING_LABQ only. + * offset in another region. VIPS_CODING_LABQ only. */ static void -shrink_region_labpack( REGION *from, Rect *area, - REGION *to, int xoff, int yoff ) +shrink_region_labpack( VipsRegion *from, VipsRect *area, + VipsRegion *to, int xoff, int yoff ) { - int ls = IM_REGION_LSKIP( from ); - Rect *t = &to->valid; + int ls = VIPS_REGION_LSKIP( from ); + VipsRect *t = &to->valid; int x, y; - Rect out; + VipsRect out; /* Calculate output size and position. */ @@ -786,10 +783,9 @@ shrink_region_labpack( REGION *from, Rect *area, /* Shrink ... ignore the extension byte for speed. */ for( y = 0; y < out.height; y++ ) { - PEL *p = (PEL *) - IM_REGION_ADDR( from, area->left, area->top + y * 2 ); - PEL *q = (PEL *) - IM_REGION_ADDR( to, out.left, out.top + y ); + VipsPel *p = VIPS_REGION_ADDR( from, + area->left, area->top + y * 2 ); + VipsPel *q = VIPS_REGION_ADDR( to, out.left, out.top + y ); for( x = 0; x < out.width; x++ ) { signed char *sp = (signed char *) p; @@ -855,16 +851,16 @@ shrink_region_labpack( REGION *from, Rect *area, * offset in another region. n-band, non-complex. */ static void -shrink_region( REGION *from, Rect *area, - REGION *to, int xoff, int yoff ) +shrink_region( VipsRegion *from, VipsRect *area, + VipsRegion *to, int xoff, int yoff ) { - int ls = IM_REGION_LSKIP( from ); - int ps = IM_IMAGE_SIZEOF_PEL( from->im ); + int ls = VIPS_REGION_LSKIP( from ); + int ps = VIPS_IMAGE_SIZEOF_PEL( from->im ); int nb = from->im->Bands; - Rect *t = &to->valid; + VipsRect *t = &to->valid; int x, y, z; - Rect out; + VipsRect out; /* Calculate output size and position. */ @@ -874,29 +870,29 @@ shrink_region( REGION *from, Rect *area, out.height = area->height / 2; for( y = 0; y < out.height; y++ ) { - PEL *p = (PEL *) - IM_REGION_ADDR( from, area->left, area->top + y * 2 ); - PEL *q = (PEL *) - IM_REGION_ADDR( to, out.left, out.top + y ); + VipsPel *p = VIPS_REGION_ADDR( from, + area->left, area->top + y * 2 ); + VipsPel *q = VIPS_REGION_ADDR( to, + out.left, out.top + y ); /* Process this line of pels. */ switch( from->im->BandFmt ) { - case IM_BANDFMT_UCHAR: + case VIPS_FORMAT_UCHAR: SHRINK_TYPE_INT( unsigned char ); break; - case IM_BANDFMT_CHAR: + case VIPS_FORMAT_CHAR: SHRINK_TYPE_INT( signed char ); break; - case IM_BANDFMT_USHORT: + case VIPS_FORMAT_USHORT: SHRINK_TYPE_INT( unsigned short ); break; - case IM_BANDFMT_SHORT: + case VIPS_FORMAT_SHORT: SHRINK_TYPE_INT( signed short ); break; - case IM_BANDFMT_UINT: + case VIPS_FORMAT_UINT: SHRINK_TYPE_INT( unsigned int ); break; - case IM_BANDFMT_INT: + case VIPS_FORMAT_INT: SHRINK_TYPE_INT( signed int ); break; - case IM_BANDFMT_FLOAT: + case VIPS_FORMAT_FLOAT: SHRINK_TYPE_FLOAT( float ); break; - case IM_BANDFMT_DOUBLE: + case VIPS_FORMAT_DOUBLE: SHRINK_TYPE_FLOAT( double ); break; default: @@ -908,7 +904,7 @@ shrink_region( REGION *from, Rect *area, /* Write a tile from a layer. */ static int -save_tile( TiffWrite *tw, TIFF *tif, PEL *tbuf, REGION *reg, Rect *area ) +save_tile( TiffWrite *tw, TIFF *tif, VipsPel *tbuf, VipsRegion *reg, VipsRect *area ) { /* Have to repack pixels. */ @@ -923,7 +919,7 @@ save_tile( TiffWrite *tw, TIFF *tif, PEL *tbuf, REGION *reg, Rect *area ) /* Write to TIFF! easy. */ if( TIFFWriteTile( tif, tbuf, area->left, area->top, 0, 0 ) < 0 ) { - im_error( "vips2tiff", "%s", _( "TIFF write tile failed" ) ); + vips_error( "vips2tiff", "%s", _( "TIFF write tile failed" ) ); return( -1 ); } @@ -934,13 +930,13 @@ save_tile( TiffWrite *tw, TIFF *tif, PEL *tbuf, REGION *reg, Rect *area ) * it and recurse. */ static int -new_tile( PyramidLayer *layer, REGION *tile, Rect *area ) +new_tile( PyramidLayer *layer, VipsRegion *tile, VipsRect *area ) { TiffWrite *tw = layer->tw; int xoff, yoff; int t, ri, bo; - Rect out, new; + VipsRect out, new; PyramidBits bit; /* Calculate pos and size of new pixels we make inside this layer. @@ -953,7 +949,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area ) /* Has size fallen to zero? Can happen if this is a one-pixel-wide * strip. */ - if( im_rect_isempty( &new ) ) + if( vips_rect_isempty( &new ) ) return( 0 ); /* Offset into this tile ... ie. which quadrant we are writing. @@ -968,8 +964,8 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area ) /* Clip against edge of image. */ - ri = IM_MIN( layer->width, out.left + layer->tw->tilew ); - bo = IM_MIN( layer->height, out.top + layer->tw->tileh ); + ri = VIPS_MIN( layer->width, out.left + layer->tw->tilew ); + bo = VIPS_MIN( layer->height, out.top + layer->tw->tileh ); out.width = ri - out.left; out.height = bo - out.top; @@ -978,7 +974,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area ) /* Shrink into place. */ - if( tw->im->Coding == IM_CODING_NONE ) + if( tw->im->Coding == VIPS_CODING_NONE ) shrink_region( tile, area, layer->tiles[t].tile, xoff, yoff ); else @@ -998,7 +994,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area ) else bit = PYR_TL; if( layer->tiles[t].bits & bit ) { - im_error( "vips2tiff", + vips_error( "vips2tiff", "%s", _( "internal error #9876345" ) ); return( -1 ); } @@ -1027,7 +1023,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area ) * generated. */ static int -write_tif_tile( REGION *out, void *seq, void *a, void *b, gboolean *stop ) +write_tif_tile( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop ) { TiffWrite *tw = (TiffWrite *) a; @@ -1058,10 +1054,10 @@ write_tif_tile( REGION *out, void *seq, void *a, void *b, gboolean *stop ) static int write_tif_tilewise( TiffWrite *tw ) { - IMAGE *im = tw->im; + VipsImage *im = tw->im; g_assert( !tw->tbuf ); - if( !(tw->tbuf = im_malloc( NULL, TIFFTileSize( tw->tif ) )) ) + if( !(tw->tbuf = vips_malloc( NULL, TIFFTileSize( tw->tif ) )) ) return( -1 ); g_assert( !tw->write_lock ); @@ -1082,24 +1078,24 @@ write_tif_tilewise( TiffWrite *tw ) } static int -write_tif_block( REGION *region, Rect *area, void *a ) +write_tif_block( VipsRegion *region, VipsRect *area, void *a ) { TiffWrite *tw = (TiffWrite *) a; - IMAGE *im = tw->im; + VipsImage *im = tw->im; int y; for( y = 0; y < area->height; y++ ) { - PEL *p = (PEL *) IM_REGION_ADDR( region, 0, area->top + y ); + VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + y ); /* Any repacking necessary. */ - if( im->Coding == IM_CODING_LABQ ) { + if( im->Coding == VIPS_CODING_LABQ ) { LabQ2LabC( tw->tbuf, p, im->Xsize ); p = tw->tbuf; } - else if( im->BandFmt == IM_BANDFMT_SHORT && - im->Type == IM_TYPE_LABS ) { + else if( im->BandFmt == VIPS_FORMAT_SHORT && + im->Type == VIPS_INTERPRETATION_LABS ) { LabS2Lab16( tw->tbuf, p, im->Xsize ); p = tw->tbuf; } @@ -1122,7 +1118,7 @@ write_tif_stripwise( TiffWrite *tw ) { g_assert( !tw->tbuf ); - if( !(tw->tbuf = im_malloc( NULL, TIFFScanlineSize( tw->tif ) )) ) + if( !(tw->tbuf = vips_malloc( NULL, TIFFScanlineSize( tw->tif ) )) ) return( -1 ); if( vips_sink_disc( tw->im, write_tif_block, tw ) ) @@ -1159,11 +1155,11 @@ free_tiff_write( TiffWrite *tw ) delete_files( tw ); #endif /*DEBUG*/ - IM_FREEF( TIFFClose, tw->tif ); - IM_FREEF( im_free, tw->tbuf ); - IM_FREEF( g_mutex_free, tw->write_lock ); - IM_FREEF( free_pyramid, tw->layer ); - IM_FREEF( im_free, tw->icc_profile ); + VIPS_FREEF( TIFFClose, tw->tif ); + VIPS_FREEF( vips_free, tw->tbuf ); + VIPS_FREEF( g_mutex_free, tw->write_lock ); + VIPS_FREEF( free_pyramid, tw->layer ); + VIPS_FREEF( vips_free, tw->icc_profile ); } /* Round N down to P boundary. @@ -1213,7 +1209,7 @@ get_resunit( VipsForeignTiffResunit resunit ) /* Make and init a TiffWrite. */ static TiffWrite * -make_tiff_write( IMAGE *im, const char *filename, +make_tiff_write( VipsImage *im, const char *filename, VipsForeignTiffCompression compression, int Q, VipsForeignTiffPredictor predictor, char *profile, @@ -1225,10 +1221,10 @@ make_tiff_write( IMAGE *im, const char *filename, { TiffWrite *tw; - if( !(tw = IM_NEW( im, TiffWrite )) ) + if( !(tw = VIPS_NEW( im, TiffWrite )) ) return( NULL ); tw->im = im; - tw->name = im_strdup( im, filename ); + tw->name = vips_strdup( VIPS_OBJECT( im ), filename ); tw->bname = NULL; tw->tif = NULL; tw->layer = NULL; @@ -1251,13 +1247,13 @@ make_tiff_write( IMAGE *im, const char *filename, if( (tw->tilew & 0xf) != 0 || (tw->tileh & 0xf) != 0 ) { - im_error( "vips2tiff", + vips_error( "vips2tiff", "%s", _( "tile size not a multiple of 16" ) ); return( NULL ); } if( !tw->tile && tw->pyramid ) { - im_warn( "vips2tiff", + vips_warn( "vips2tiff", "%s", _( "can't have strip pyramid -- " "enabling tiling" ) ); tw->tile = 1; @@ -1266,9 +1262,9 @@ make_tiff_write( IMAGE *im, const char *filename, /* We can only pyramid LABQ and non-complex images. */ if( tw->pyramid ) { - if( im->Coding == IM_CODING_NONE && + if( im->Coding == VIPS_CODING_NONE && vips_bandfmt_iscomplex( im->BandFmt ) ) { - im_error( "vips2tiff", + vips_error( "vips2tiff", "%s", _( "can only pyramid LABQ and " "non-complex images" ) ); return( NULL ); @@ -1278,26 +1274,26 @@ make_tiff_write( IMAGE *im, const char *filename, /* Only 1-bit-ize 8 bit mono images. */ if( tw->onebit ) { - if( im->Coding != IM_CODING_NONE || - im->BandFmt != IM_BANDFMT_UCHAR || + if( im->Coding != VIPS_CODING_NONE || + im->BandFmt != VIPS_FORMAT_UCHAR || im->Bands != 1 ) tw->onebit = 0; } if( tw->onebit && tw->compression == COMPRESSION_JPEG ) { - im_warn( "vips2tiff", + vips_warn( "vips2tiff", "%s", _( "can't have 1-bit JPEG -- disabling JPEG" ) ); tw->compression = COMPRESSION_NONE; } /* Sizeof a line of bytes in the TIFF tile. */ - if( im->Coding == IM_CODING_LABQ ) + if( im->Coding == VIPS_CODING_LABQ ) tw->tls = tw->tilew * 3; else if( tw->onebit ) tw->tls = ROUND_UP( tw->tilew, 8 ) / 8; else - tw->tls = IM_IMAGE_SIZEOF_PEL( im ) * tw->tilew; + tw->tls = VIPS_IMAGE_SIZEOF_PEL( im ) * tw->tilew; return( tw ); } @@ -1352,7 +1348,7 @@ tiff_copy( TiffWrite *tw, TIFF *out, TIFF *in ) if( embed_profile( tw, out ) ) return( -1 ); - buf = im_malloc( NULL, TIFFTileSize( in ) ); + buf = vips_malloc( NULL, TIFFTileSize( in ) ); n = TIFFNumberOfTiles( in ); for( tile = 0; tile < n; tile++ ) { tsize_t len; @@ -1364,11 +1360,11 @@ tiff_copy( TiffWrite *tw, TIFF *out, TIFF *in ) len = TIFFReadEncodedTile( in, tile, buf, (tsize_t) -1 ); if( len < 0 || TIFFWriteEncodedTile( out, tile, buf, len ) < 0 ) { - im_free( buf ); + vips_free( buf ); return( -1 ); } } - im_free( buf ); + vips_free( buf ); return( 0 ); } @@ -1446,7 +1442,7 @@ vips__tiff_write( VipsImage *in, const char *filename, int res; #ifdef DEBUG - printf( "im_tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() ); + printf( "tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() ); #endif /*DEBUG*/ /* Override the default TIFF error handler. @@ -1456,22 +1452,21 @@ vips__tiff_write( VipsImage *in, const char *filename, /* Check input image. */ - if( im_pincheck( in ) || - im_check_coding_known( "vips2tiff", in ) ) + if( vips_check_coding_known( "vips2tiff", in ) ) return( -1 ); - if( in->BandFmt != IM_BANDFMT_UCHAR && - !(in->BandFmt == IM_BANDFMT_SHORT && - in->Type == IM_TYPE_LABS) && - in->BandFmt != IM_BANDFMT_USHORT && - in->BandFmt != IM_BANDFMT_FLOAT ) { - im_error( "vips2tiff", "%s", + if( in->BandFmt != VIPS_FORMAT_UCHAR && + !(in->BandFmt == VIPS_FORMAT_SHORT && + in->Type == VIPS_INTERPRETATION_LABS) && + in->BandFmt != VIPS_FORMAT_USHORT && + in->BandFmt != VIPS_FORMAT_FLOAT ) { + vips_error( "vips2tiff", "%s", _( "unsigned 8-bit int, 16-bit int, " "and 32-bit float only" ) ); return( -1 ); } - if( in->Coding == IM_CODING_NONE ) { + if( in->Coding == VIPS_CODING_NONE ) { if( in->Bands < 1 || in->Bands > 5 ) { - im_error( "vips2tiff", + vips_error( "vips2tiff", "%s", _( "1 to 5 bands only" ) ); return( -1 ); } @@ -1486,7 +1481,7 @@ vips__tiff_write( VipsImage *in, const char *filename, resunit, xres, yres, bigtiff )) ) return( -1 ); if( tw->pyramid ) { - if( !(tw->bname = im__temp_name( "%s.tif" )) || + if( !(tw->bname = vips__temp_name( "%s.tif" )) || !(tw->tif = tiff_openout( tw, tw->bname )) ) { free_tiff_write( tw ); return( -1 ); diff --git a/libvips/freq_filt/fmaskcir.c b/libvips/freq_filt/fmaskcir.c index d2341ab6..168e42fa 100644 --- a/libvips/freq_filt/fmaskcir.c +++ b/libvips/freq_filt/fmaskcir.c @@ -200,7 +200,7 @@ ideal_bpf( IMAGE *out, double fcx, double fcy, double r ) cpline++; } - if( im_writeline( y, out, (PEL *) line ) ) + if( im_writeline( y, out, (VipsPel *) line ) ) return( -1 ); } @@ -270,7 +270,7 @@ ideal_brf( IMAGE *out, double fcx, double fcy, double r ) cpline++; } - if( im_writeline( y, out, (PEL *) line ) ) + if( im_writeline( y, out, (VipsPel *) line ) ) return( -1 ); } @@ -363,7 +363,7 @@ butterworth_bpf( IMAGE *out, cpline++; } - if( im_writeline( y, out, (PEL *) line ) ) + if( im_writeline( y, out, (VipsPel *) line ) ) return( -1 ); } @@ -447,7 +447,7 @@ butterworth_brf( IMAGE *out, cpline++; } - if( im_writeline( y, out, (PEL *) line ) ) + if( im_writeline( y, out, (VipsPel *) line ) ) return( -1 ); } @@ -525,7 +525,7 @@ gaussian_bpf( IMAGE *out, double fcx, double fcy, double r, double ac ) cpline++; } - if( im_writeline( y, out, (PEL *) line ) ) + if( im_writeline( y, out, (VipsPel *) line ) ) return( -1 ); } @@ -605,7 +605,7 @@ gaussian_brf( IMAGE *out, double fcx, double fcy, double r, double ac ) cpline++; } - if( im_writeline( y, out, (PEL *) line ) ) + if( im_writeline( y, out, (VipsPel *) line ) ) return( -1 ); } diff --git a/libvips/freq_filt/im_freq_mask.c b/libvips/freq_filt/im_freq_mask.c index 29cd3dc6..8d256ead 100644 --- a/libvips/freq_filt/im_freq_mask.c +++ b/libvips/freq_filt/im_freq_mask.c @@ -73,7 +73,7 @@ copy_quarter( IMAGE *out, float *coeff_s ) *cpline++ = *cpcoeff++; for( x = out->Xsize/2; x < out->Xsize; x++ ) *cpline++ = *cpcoeff--; - if( im_writeline( y, out, (PEL *) line ) ) + if( im_writeline( y, out, (VipsPel *) line ) ) return( -1 ); } @@ -85,7 +85,7 @@ copy_quarter( IMAGE *out, float *coeff_s ) *cpline++ = *cpcoeff++; for( x = out->Xsize/2; x < out->Xsize; x++ ) *cpline++ = *cpcoeff--; - if( im_writeline( y, out, (PEL *) line ) ) + if( im_writeline( y, out, (VipsPel *) line ) ) return( -1 ); } diff --git a/libvips/freq_filt/im_fwfft.c b/libvips/freq_filt/im_fwfft.c index f9bbaa32..e21d9d95 100644 --- a/libvips/freq_filt/im_fwfft.c +++ b/libvips/freq_filt/im_fwfft.c @@ -132,7 +132,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) if( im_setupout( out ) ) return( -1 ); if( !(buf = (double *) IM_ARRAY( dummy, - IM_IMAGE_SIZEOF_LINE( out ), PEL )) ) + IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); /* Copy to out and normalise. The right half is the up/down and @@ -158,7 +158,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) q += 2; } - if( im_writeline( 0, out, (PEL *) buf ) ) + if( im_writeline( 0, out, (VipsPel *) buf ) ) return( -1 ); for( y = 1; y < out->Ysize; y++ ) { @@ -185,7 +185,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) q += 2; } - if( im_writeline( y, out, (PEL *) buf ) ) + if( im_writeline( y, out, (VipsPel *) buf ) ) return( -1 ); } @@ -235,7 +235,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) if( im_setupout( out ) ) return( -1 ); if( !(buf = (double *) IM_ARRAY( dummy, - IM_IMAGE_SIZEOF_LINE( out ), PEL )) ) + IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); /* Copy to out, normalise. @@ -252,7 +252,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) q += 2; } - if( im_writeline( y, out, (PEL *) buf ) ) + if( im_writeline( y, out, (VipsPel *) buf ) ) return( -1 ); } @@ -329,7 +329,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) if( im_setupout( out ) ) return( -1 ); if( !(buf = (double *) IM_ARRAY( dummy, - IM_IMAGE_SIZEOF_LINE( out ), PEL )) ) + IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); /* Copy to out and normalise. The right half is the up/down and @@ -355,7 +355,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) q += 2; } - if( im_writeline( 0, out, (PEL *) buf ) ) + if( im_writeline( 0, out, (VipsPel *) buf ) ) return( -1 ); for( y = 1; y < out->Ysize; y++ ) { @@ -382,7 +382,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) q += 2; } - if( im_writeline( y, out, (PEL *) buf ) ) + if( im_writeline( y, out, (VipsPel *) buf ) ) return( -1 ); } @@ -442,7 +442,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) if( im_setupout( out ) ) return( -1 ); if( !(buf = (double *) IM_ARRAY( dummy, - IM_IMAGE_SIZEOF_LINE( out ), PEL )) ) + IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); /* Copy to out, normalise. @@ -459,7 +459,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) q += 2; } - if( im_writeline( y, out, (PEL *) buf ) ) + if( im_writeline( y, out, (VipsPel *) buf ) ) return( -1 ); } @@ -540,7 +540,7 @@ fwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) if( im_setupout( out ) ) return( -1 ); if( !(buf = (float *) IM_ARRAY( dummy, - IM_IMAGE_SIZEOF_LINE( out ), PEL )) ) + IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); /* Gather together real and imag parts. We have to normalise output! @@ -555,7 +555,7 @@ fwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) q += 2; } - if( im_writeline( y, out, (PEL *) buf ) ) + if( im_writeline( y, out, (VipsPel *) buf ) ) return( -1 ); } diff --git a/libvips/freq_filt/im_invfft.c b/libvips/freq_filt/im_invfft.c index c9064a84..40e70434 100644 --- a/libvips/freq_filt/im_invfft.c +++ b/libvips/freq_filt/im_invfft.c @@ -230,7 +230,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) if( im_setupout( out ) ) return( -1 ); if( !(buf = (float *) IM_ARRAY( dummy, - IM_IMAGE_SIZEOF_LINE( out ), PEL )) ) + IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); /* Gather together real and imag parts. @@ -245,7 +245,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) q += 2; } - if( im_writeline( y, out, (PEL *) buf ) ) + if( im_writeline( y, out, (VipsPel *) buf ) ) return( -1 ); } diff --git a/libvips/freq_filt/im_invfftr.c b/libvips/freq_filt/im_invfftr.c index 73e1092e..e2b37f5d 100644 --- a/libvips/freq_filt/im_invfftr.c +++ b/libvips/freq_filt/im_invfftr.c @@ -281,7 +281,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) if( im_setupout( out ) ) return( -1 ); if( !(buf = (float *) IM_ARRAY( dummy, - IM_IMAGE_SIZEOF_LINE( out ), PEL )) ) + IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) ) return( -1 ); /* Just write real part. @@ -293,7 +293,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out ) q[x] = *p1++; } - if( im_writeline( y, out, (PEL *) buf ) ) + if( im_writeline( y, out, (VipsPel *) buf ) ) return( -1 ); } diff --git a/libvips/histograms_lut/im_buildlut.c b/libvips/histograms_lut/im_buildlut.c index d338a9f3..30bab517 100644 --- a/libvips/histograms_lut/im_buildlut.c +++ b/libvips/histograms_lut/im_buildlut.c @@ -290,7 +290,7 @@ im_buildlut( DOUBLEMASK *input, IMAGE *output ) IM_BBITS_DOUBLE, IM_BANDFMT_DOUBLE, IM_CODING_NONE, IM_TYPE_HISTOGRAM, 1.0, 1.0, 0, 0 ); if( im_setupout( output ) || - im_writeline( 0, output, (PEL *) state.buf ) ) { + im_writeline( 0, output, (VipsPel *) state.buf ) ) { free_state( &state ); return( -1 ); } diff --git a/libvips/histograms_lut/im_histeq.c b/libvips/histograms_lut/im_histeq.c index 0447c03d..e79515e5 100644 --- a/libvips/histograms_lut/im_histeq.c +++ b/libvips/histograms_lut/im_histeq.c @@ -90,7 +90,7 @@ im_histcum( IMAGE *in, IMAGE *out ) in->Bands * 2 : in->Bands; const int mx = px * nb; - PEL *outbuf; + VipsPel *outbuf; int b, x; if( im_check_uncoded( "im_histcum", in ) || diff --git a/libvips/histograms_lut/im_histgr.c b/libvips/histograms_lut/im_histgr.c index 47b8aa3c..19ff43f9 100644 --- a/libvips/histograms_lut/im_histgr.c +++ b/libvips/histograms_lut/im_histgr.c @@ -148,7 +148,7 @@ find_uchar_hist( REGION *reg, void *seq, void *a, void *b, gboolean *stop ) /* Accumulate! */ for( y = to; y < bo; y++ ) { - PEL *p = (PEL *) IM_REGION_ADDR( reg, le, y ); + VipsPel *p = IM_REGION_ADDR( reg, le, y ); int i; for( i = 0, x = 0; x < r->width; x++ ) @@ -183,7 +183,7 @@ find_uchar_hist_extract( REGION *reg, /* Accumulate! */ for( y = to; y < bo; y++ ) { - PEL *p = (PEL *) IM_REGION_ADDR( reg, le, y ); + VipsPel *p = IM_REGION_ADDR( reg, le, y ); for( x = hist->which; x < max; x += nb ) bins[p[x]]++; @@ -370,7 +370,7 @@ im_histgr( IMAGE *in, IMAGE *out, int bandno ) /* Write interleaved buffer into hist. */ - if( im_writeline( 0, out, (PEL *) obuffer ) ) + if( im_writeline( 0, out, (VipsPel *) obuffer ) ) return( -1 ); return( 0 ); diff --git a/libvips/histograms_lut/im_histindexed.c b/libvips/histograms_lut/im_histindexed.c index 54566542..8dc98c88 100644 --- a/libvips/histograms_lut/im_histindexed.c +++ b/libvips/histograms_lut/im_histindexed.c @@ -169,8 +169,8 @@ hist_scan_uchar( REGION *reg, void *seq, void *a, void *b, gboolean *stop ) /* Accumulate! */ for( y = 0; y < r->height; y++ ) { - PEL *i = (PEL *) IM_REGION_ADDR( reg, r->left, r->top + y ); - PEL *v = (PEL *) IM_REGION_ADDR( hist->vreg, + VipsPel *i = IM_REGION_ADDR( reg, r->left, r->top + y ); + VipsPel *v = IM_REGION_ADDR( hist->vreg, r->left, r->top + y ); switch( value->BandFmt ) { @@ -247,7 +247,7 @@ hist_scan_ushort( REGION *reg, void *seq, void *a, void *b, gboolean *stop ) for( y = 0; y < r->height; y++ ) { unsigned short *i = (unsigned short *) IM_REGION_ADDR( reg, r->left, r->top + y ); - PEL *v = (PEL *) IM_REGION_ADDR( hist->vreg, + VipsPel *v = IM_REGION_ADDR( hist->vreg, r->left, r->top + y ); switch( value->BandFmt ) { @@ -292,7 +292,7 @@ hist_write( IMAGE *out, Histogram *hist ) if( im_setupout( out ) ) return( -1 ); - if( im_writeline( 0, out, (PEL *) hist->bins ) ) + if( im_writeline( 0, out, (VipsPel *) hist->bins ) ) return( -1 ); return( 0 ); diff --git a/libvips/histograms_lut/im_histnD.c b/libvips/histograms_lut/im_histnD.c index 42728e44..ebef41ea 100644 --- a/libvips/histograms_lut/im_histnD.c +++ b/libvips/histograms_lut/im_histnD.c @@ -171,7 +171,7 @@ find_hist( REGION *reg, void *seq, void *a, void *b, gboolean *stop ) /* Accumulate! */ for( y = to; y < bo; y++ ) { - PEL *line = IM_REGION_ADDR( reg, le, y ); + VipsPel *line = IM_REGION_ADDR( reg, le, y ); switch( im->BandFmt ) { case IM_BANDFMT_UCHAR: @@ -261,7 +261,7 @@ im_histnD( IMAGE *in, IMAGE *out, int bins ) for( z = 0; z < out->Bands; z++, i++ ) obuffer[i] = mhist->data[z][y][x]; - if( im_writeline( y, out, (PEL *) obuffer ) ) + if( im_writeline( y, out, (VipsPel *) obuffer ) ) return( -1 ); } diff --git a/libvips/histograms_lut/im_histplot.c b/libvips/histograms_lut/im_histplot.c index 25b2f202..db667eaf 100644 --- a/libvips/histograms_lut/im_histplot.c +++ b/libvips/histograms_lut/im_histplot.c @@ -145,8 +145,8 @@ make_vert_gen( REGION *or, void *seq, void *a, void *b ) int x, y, z; for( y = to; y < bo; y++ ) { - PEL *q = (PEL *) IM_REGION_ADDR( or, le, y ); - PEL *p = (PEL *) IM_IMAGE_ADDR( in, 0, y ); + VipsPel *q = IM_REGION_ADDR( or, le, y ); + VipsPel *p = IM_IMAGE_ADDR( in, 0, y ); switch( in->BandFmt ) { case IM_BANDFMT_UCHAR: VERT( unsigned char ); break; @@ -195,8 +195,8 @@ make_horz_gen( REGION *or, void *seq, void *a, void *b ) int x, y, z; for( x = le; x < ri; x++ ) { - PEL *q = (PEL *) IM_REGION_ADDR( or, x, to ); - PEL *p = (PEL *) IM_IMAGE_ADDR( in, x, 0 ); + VipsPel *q = IM_REGION_ADDR( or, x, to ); + VipsPel *p = IM_IMAGE_ADDR( in, x, 0 ); switch( in->BandFmt ) { case IM_BANDFMT_UCHAR: HORZ( unsigned char ); break; diff --git a/libvips/histograms_lut/im_histspec.c b/libvips/histograms_lut/im_histspec.c index 293353c9..873a85d5 100644 --- a/libvips/histograms_lut/im_histspec.c +++ b/libvips/histograms_lut/im_histspec.c @@ -149,7 +149,7 @@ match( IMAGE *in, IMAGE *ref, IMAGE *out ) if( im_setupout( out ) ) return( -1 ); - if( im_writeline( 0, out, (PEL *) outbuf ) ) + if( im_writeline( 0, out, (VipsPel *) outbuf ) ) return( -1 ); return( 0 ); diff --git a/libvips/histograms_lut/im_identity.c b/libvips/histograms_lut/im_identity.c index 425fb592..b55576e2 100644 --- a/libvips/histograms_lut/im_identity.c +++ b/libvips/histograms_lut/im_identity.c @@ -166,7 +166,7 @@ im_identity_ushort( IMAGE *lut, int bands, int sz ) for( p = buf, x = 0; x < sz; x++ ) for( z = 0; z < bands; z++ ) *p++ = x; - if( im_writeline( 0, lut, (PEL *) buf ) ) + if( im_writeline( 0, lut, (VipsPel *) buf ) ) return( -1 ); return( 0 ); diff --git a/libvips/histograms_lut/im_lhisteq.c b/libvips/histograms_lut/im_lhisteq.c index ceb347ee..3909bd9c 100644 --- a/libvips/histograms_lut/im_lhisteq.c +++ b/libvips/histograms_lut/im_lhisteq.c @@ -93,10 +93,10 @@ lhist_gen( REGION *or, void *seq, void *a, void *b ) for( y = 0; y < r->height; y++ ) { /* Get input and output pointers for this line. */ - PEL *p = (PEL *) IM_REGION_ADDR( ir, r->left, r->top + y ); - PEL *q = (PEL *) IM_REGION_ADDR( or, r->left, r->top + y ); + VipsPel *p = IM_REGION_ADDR( ir, r->left, r->top + y ); + VipsPel *q = IM_REGION_ADDR( or, r->left, r->top + y ); - PEL *p1; + VipsPel *p1; int hist[256]; /* Find histogram for start of this line. diff --git a/libvips/histograms_lut/im_maplut.c b/libvips/histograms_lut/im_maplut.c index 2d2be9f9..6e3bf60d 100644 --- a/libvips/histograms_lut/im_maplut.c +++ b/libvips/histograms_lut/im_maplut.c @@ -76,7 +76,7 @@ typedef struct { int es; /* IM_IMAGE_SIZEOF_ELEMENT() for lut image */ int sz; /* Number of elements in minor dimension */ int clp; /* Value we clip against */ - PEL **table; /* Lut converted to 2d array */ + VipsPel **table; /* Lut converted to 2d array */ int overflow; /* Number of overflows for non-uchar lut */ } LutInfo; @@ -107,7 +107,7 @@ build_luts( IMAGE *out, IMAGE *lut ) { LutInfo *st; int i, x; - PEL *q; + VipsPel *q; if( !(st = IM_NEW( out, LutInfo )) ) return( NULL ); @@ -130,15 +130,15 @@ build_luts( IMAGE *out, IMAGE *lut ) /* Attach tables. */ - if( !(st->table = IM_ARRAY( out, lut->Bands, PEL * )) ) + if( !(st->table = IM_ARRAY( out, lut->Bands, VipsPel * )) ) return( NULL ); for( i = 0; i < lut->Bands; i++ ) - if( !(st->table[i] = IM_ARRAY( out, st->sz * st->es, PEL )) ) + if( !(st->table[i] = IM_ARRAY( out, st->sz * st->es, VipsPel )) ) return( NULL ); /* Scan LUT and fill table. */ - q = (PEL *) lut->data; + q = (VipsPel *) lut->data; for( x = 0; x < st->sz; x++ ) for( i = 0; i < st->nb; i++ ) { memcpy( st->table[i] + x * st->es, q, st->es ); @@ -201,7 +201,7 @@ maplut_start( IMAGE *out, void *a, void *b ) \ for( y = to; y < bo; y++ ) { \ for( z = 0; z < b; z++ ) { \ - PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \ + VipsPel *p = IM_REGION_ADDR( ir, le, y ); \ OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \ OUT *tlut = (OUT *) st->table[z]; \ \ @@ -218,7 +218,7 @@ maplut_start( IMAGE *out, void *a, void *b ) \ for( y = to; y < bo; y++ ) { \ for( z = 0; z < b; z++ ) { \ - PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ) + z; \ + VipsPel *p = IM_REGION_ADDR( ir, le, y ) + z; \ OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ) + z * 2; \ OUT *tlut = (OUT *) st->table[z]; \ \ @@ -289,7 +289,7 @@ maplut_start( IMAGE *out, void *a, void *b ) \ for( y = to; y < bo; y++ ) { \ OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \ - PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \ + VipsPel *p = IM_REGION_ADDR( ir, le, y ); \ \ for( x = 0; x < ne; x++ ) \ q[x] = tlut[p[x]]; \ @@ -303,7 +303,7 @@ maplut_start( IMAGE *out, void *a, void *b ) \ for( y = to; y < bo; y++ ) { \ OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \ - PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \ + VipsPel *p = IM_REGION_ADDR( ir, le, y ); \ \ for( x = 0; x < ne; x++ ) { \ int n = p[x] * 2; \ @@ -367,7 +367,7 @@ maplut_start( IMAGE *out, void *a, void *b ) \ for( y = to; y < bo; y++ ) { \ OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \ - PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \ + VipsPel *p = IM_REGION_ADDR( ir, le, y ); \ \ for( i = 0, x = 0; x < np; x++ ) { \ int n = p[x]; \ @@ -385,7 +385,7 @@ maplut_start( IMAGE *out, void *a, void *b ) \ for( y = to; y < bo; y++ ) { \ OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \ - PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \ + VipsPel *p = IM_REGION_ADDR( ir, le, y ); \ \ for( x = 0; x < np; x++ ) { \ int n = p[x] * 2; \ diff --git a/libvips/histograms_lut/im_project.c b/libvips/histograms_lut/im_project.c index e4840d50..f6db25cf 100644 --- a/libvips/histograms_lut/im_project.c +++ b/libvips/histograms_lut/im_project.c @@ -292,10 +292,10 @@ im_project( IMAGE *in, IMAGE *hout, IMAGE *vout ) im_setupout( vout ) ) return( -1 ); - if( im_writeline( 0, vout, (PEL *) mproject->columns ) ) + if( im_writeline( 0, vout, (VipsPel *) mproject->columns ) ) return( -1 ); for( y = 0; y < in->Ysize; y++ ) - if( im_writeline( y, hout, (PEL *) mproject->rows + + if( im_writeline( y, hout, (VipsPel *) mproject->rows + y * IM_IMAGE_SIZEOF_PEL( hout ) ) ) return( -1 ); diff --git a/libvips/histograms_lut/im_stdif.c b/libvips/histograms_lut/im_stdif.c index 0b11758b..cefcb83f 100644 --- a/libvips/histograms_lut/im_stdif.c +++ b/libvips/histograms_lut/im_stdif.c @@ -97,8 +97,8 @@ stdif_gen( REGION *or, void *seq, void *a, void *b ) for( y = 0; y < r->height; y++ ) { /* Get input and output pointers for this line. */ - PEL *p = (PEL *) IM_REGION_ADDR( ir, r->left, r->top + y ); - PEL *q = (PEL *) IM_REGION_ADDR( or, r->left, r->top + y ); + VipsPel *p = IM_REGION_ADDR( ir, r->left, r->top + y ); + VipsPel *q = IM_REGION_ADDR( or, r->left, r->top + y ); /* Precompute some factors. */ @@ -106,7 +106,7 @@ stdif_gen( REGION *or, void *seq, void *a, void *b ) double f2 = 1.0 - inf->a; double f3 = inf->b * inf->s0; - PEL *p1; + VipsPel *p1; int sum; int sum2; diff --git a/libvips/histograms_lut/tone.c b/libvips/histograms_lut/tone.c index 2ef0f406..04f0ce34 100644 --- a/libvips/histograms_lut/tone.c +++ b/libvips/histograms_lut/tone.c @@ -269,7 +269,7 @@ im_tone_build_range( IMAGE *out, if( im_setupout( out ) ) return( -1 ); - if( im_writeline( 0, out, (PEL *) lut ) ) + if( im_writeline( 0, out, (VipsPel *) lut ) ) return( -1 ); return( 0 ); diff --git a/libvips/include/vips/foreign.h b/libvips/include/vips/foreign.h index 692b5113..79ff6bb7 100644 --- a/libvips/include/vips/foreign.h +++ b/libvips/include/vips/foreign.h @@ -188,7 +188,7 @@ typedef struct _VipsForeignLoadClass { GType vips_foreign_load_get_type( void ); -const char *vips_foreign_find_load( const char *foreignname ); +const char *vips_foreign_find_load( const char *filename ); VipsForeignFlags vips_foreign_flags( const char *loader, const char *filename ); gboolean vips_foreign_is_a( const char *loader, const char *filename ); diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index 599a7a2c..8386ce08 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -282,7 +282,7 @@ typedef struct _VipsImage { */ char *Hist; /* don't use, see vips_image_get_history() */ char *filename; /* pointer to copy of filename */ - PEL *data; /* start of image data for WIO */ + VipsPel *data; /* start of image data for WIO */ int kill; /* set to non-zero to block eval */ /* Everything below this private and only used internally by @@ -448,7 +448,7 @@ extern const guint64 vips__image_sizeof_bandformat[]; (X), (Y), \ 0, 0, \ (I)->Xsize, \ - (I)->Ysize ), abort(), (PEL *) NULL) \ + (I)->Ysize ), abort(), (VipsPel *) NULL) \ ) #else /*!VIPS_DEBUG*/ #define VIPS_IMAGE_ADDR( I, X, Y ) \ @@ -493,7 +493,7 @@ int vips_image_pio_input( VipsImage *image ); int vips_image_inplace( VipsImage *image ); int vips_image_write_prepare( VipsImage *image ); -int vips_image_write_line( VipsImage *image, int ypos, PEL *linebuffer ); +int vips_image_write_line( VipsImage *image, int ypos, VipsPel *linebuffer ); gboolean vips_band_format_isint( VipsBandFormat format ); gboolean vips_band_format_isuint( VipsBandFormat format ); diff --git a/libvips/include/vips/inplace.h b/libvips/include/vips/inplace.h index 2bf4fac8..8f6e268f 100644 --- a/libvips/include/vips/inplace.h +++ b/libvips/include/vips/inplace.h @@ -38,9 +38,9 @@ extern "C" { #endif /*__cplusplus*/ int im_draw_rect( VipsImage *image, - int left, int top, int width, int height, int fill, PEL *ink ); + int left, int top, int width, int height, int fill, VipsPel *ink ); int im_draw_circle( VipsImage *image, - int x, int y, int radius, gboolean fill, PEL *ink ); + int x, int y, int radius, gboolean fill, VipsPel *ink ); int im_draw_image( VipsImage *image, VipsImage *sub, int x, int y ); @@ -49,20 +49,22 @@ typedef int (*VipsPlotFn)( VipsImage *image, int x, int y, int im_draw_line_user( VipsImage *image, int x1, int y1, int x2, int y2, VipsPlotFn plot, void *a, void *b, void *c ); -int im_draw_line( VipsImage *image, int x1, int y1, int x2, int y2, PEL *ink ); +int im_draw_line( VipsImage *image, + int x1, int y1, int x2, int y2, VipsPel *ink ); int im_lineset( VipsImage *in, VipsImage *out, VipsImage *mask, VipsImage *ink, int n, int *x1v, int *y1v, int *x2v, int *y2v ); -int im_draw_flood( VipsImage *image, int x, int y, PEL *ink, VipsRect *dout ); -int im_draw_flood_blob( VipsImage *image, int x, int y, PEL *ink, VipsRect *dout ); +int im_draw_flood( VipsImage *image, int x, int y, VipsPel *ink, VipsRect *dout ); +int im_draw_flood_blob( VipsImage *image, + int x, int y, VipsPel *ink, VipsRect *dout ); int im_draw_flood_other( VipsImage *image, VipsImage *test, int x, int y, int serial, VipsRect *dout ); int im_draw_mask( VipsImage *image, - VipsImage *mask_im, int x, int y, PEL *ink ); + VipsImage *mask_im, int x, int y, VipsPel *ink ); -int im_draw_point( VipsImage *image, int x, int y, PEL *ink ); -int im_read_point( VipsImage *image, int x, int y, PEL *ink ); +int im_draw_point( VipsImage *image, int x, int y, VipsPel *ink ); +int im_read_point( VipsImage *image, int x, int y, VipsPel *ink ); int im_draw_smudge( VipsImage *image, int left, int top, int width, int height ); diff --git a/libvips/include/vips/internal.h b/libvips/include/vips/internal.h index 9c3700af..0e7ff55b 100644 --- a/libvips/include/vips/internal.h +++ b/libvips/include/vips/internal.h @@ -233,8 +233,8 @@ typedef struct { void imb_XYZ2Lab( float *, float *, int, im_colour_temperature * ); void imb_Lab2XYZ( float *, float *, int, im_colour_temperature * ); -void imb_LabQ2Lab( PEL *, float *, int ); -void imb_Lab2LabQ( float *, PEL *, int ); +void imb_LabQ2Lab( VipsPel *, float *, int ); +void imb_Lab2LabQ( float *, VipsPel *, int ); void imb_LabS2Lab( signed short *, float *, int ); void imb_Lab2LabS( float *, signed short *, int n ); @@ -268,7 +268,7 @@ int im__fmaskcir( VipsImage *out, VipsMaskType flag, va_list ap ); /* inplace */ -PEL *im__vector_to_ink( const char *domain, VipsImage *im, int n, double *vec ); +VipsPel *im__vector_to_ink( const char *domain, VipsImage *im, int n, double *vec ); VipsImage *im__inplace_base( const char *domain, VipsImage *main, VipsImage *sub, VipsImage *out ); diff --git a/libvips/include/vips/private.h b/libvips/include/vips/private.h index e2f6cb77..74ed8ccd 100644 --- a/libvips/include/vips/private.h +++ b/libvips/include/vips/private.h @@ -55,8 +55,6 @@ extern "C" { */ #define VIPS_SIZEOF_HEADER (64) -typedef unsigned char PEL; /* useful datum */ - /* What we track for each mmap window. Have a list of these on an openin * VipsImage. */ @@ -66,7 +64,7 @@ typedef struct { int top; /* Area of image we have mapped, in pixels */ int height; - PEL *data; /* First pixel of line 'top' */ + VipsPel *data; /* First pixel of line 'top' */ void *baseaddr; /* Base of window */ size_t length; /* Size of window */ @@ -106,7 +104,7 @@ typedef struct _VipsBuffer { VipsRect area; /* Area this pixel buffer covers */ gboolean done; /* Calculated and in cache */ VipsBufferCache *cache; - PEL *buf; /* Private malloc() area */ + VipsPel *buf; /* Private malloc() area */ size_t bsize; /* Size of private malloc() */ } VipsBuffer; diff --git a/libvips/include/vips/region.h b/libvips/include/vips/region.h index b94cd658..e8ebf18f 100644 --- a/libvips/include/vips/region.h +++ b/libvips/include/vips/region.h @@ -69,7 +69,7 @@ typedef struct _VipsRegion { */ /*< private >*/ RegionType type; /* What kind of attachment */ - PEL *data; /* Off here to get data */ + VipsPel *data; /* Off here to get data */ int bpl; /* Bytes-per-line for data */ void *seq; /* Sequence we are using to fill region */ @@ -109,7 +109,7 @@ int vips_region_equalsregion( VipsRegion *reg1, VipsRegion *reg2 ); int vips_region_position( VipsRegion *reg, int x, int y ); void vips_region_paint( VipsRegion *reg, VipsRect *r, int value ); -void vips_region_paint_pel( VipsRegion *reg, VipsRect *r, PEL *ink ); +void vips_region_paint_pel( VipsRegion *reg, VipsRect *r, VipsPel *ink ); void vips_region_black( VipsRegion *reg ); void vips_region_copy( VipsRegion *reg, VipsRegion *dest, VipsRect *r, int x, int y ); @@ -150,7 +150,7 @@ int vips_region_prepare_many( VipsRegion **reg, VipsRect *r ); (R)->valid.left, \ (R)->valid.top, \ (R)->valid.width, \ - (R)->valid.height ), abort(), (PEL *) NULL) \ + (R)->valid.height ), abort(), (VipsPel *) NULL) \ ) #else /*DEBUG*/ #define VIPS_REGION_ADDR( R, X, Y ) \ diff --git a/libvips/include/vips/type.h b/libvips/include/vips/type.h index d8242929..f0401917 100644 --- a/libvips/include/vips/type.h +++ b/libvips/include/vips/type.h @@ -37,6 +37,14 @@ extern "C" { #endif /*__cplusplus*/ +/** + * VipsPel: + * + * A picture element. Cast this to whatever the associated VipsBandFormat says + * to get the value. + */ +typedef unsigned char VipsPel; + /* Also used for eg. vips_local() and friends. */ typedef int (*VipsCallbackFn)( void *a, void *b ); diff --git a/libvips/include/vips/vips7compat.h b/libvips/include/vips/vips7compat.h index 57086a9c..dacbb611 100644 --- a/libvips/include/vips/vips7compat.h +++ b/libvips/include/vips/vips7compat.h @@ -40,6 +40,8 @@ extern "C" { /* Renamed types. */ +#define PEL VipsPel + #define IM_BANDFMT_NOTSET VIPS_FORMAT_NOTSET #define IM_BANDFMT_UCHAR VIPS_FORMAT_UCHAR #define IM_BANDFMT_CHAR VIPS_FORMAT_CHAR diff --git a/libvips/inplace/draw.c b/libvips/inplace/draw.c index 682bc607..4203b0c6 100644 --- a/libvips/inplace/draw.c +++ b/libvips/inplace/draw.c @@ -48,7 +48,7 @@ void im__draw_scanline( Draw *draw, int y, int x1, int x2 ) { - PEL *mp; + VipsPel *mp; int i; int len; @@ -63,7 +63,7 @@ im__draw_scanline( Draw *draw, int y, int x1, int x2 ) x1 = IM_CLIP( 0, x1, draw->im->Xsize - 1 ); x2 = IM_CLIP( 0, x2, draw->im->Xsize - 1 ); - mp = (PEL *) IM_IMAGE_ADDR( draw->im, x1, y ); + mp = IM_IMAGE_ADDR( draw->im, x1, y ); len = x2 - x1 + 1; for( i = 0; i < len; i++ ) { @@ -79,7 +79,7 @@ im__draw_free( Draw *draw ) } Draw * -im__draw_init( Draw *draw, IMAGE *im, PEL *ink ) +im__draw_init( Draw *draw, IMAGE *im, VipsPel *ink ) { if( im_rwcheck( im ) ) return( NULL ); @@ -92,7 +92,7 @@ im__draw_init( Draw *draw, IMAGE *im, PEL *ink ) draw->noclip = FALSE; if( ink ) { - if( !(draw->ink = (PEL *) im_malloc( NULL, draw->psize )) ) + if( !(draw->ink = (VipsPel *) im_malloc( NULL, draw->psize )) ) return( NULL ); memcpy( draw->ink, ink, draw->psize ); } diff --git a/libvips/inplace/draw.h b/libvips/inplace/draw.h index 34f508d9..0461eecf 100644 --- a/libvips/inplace/draw.h +++ b/libvips/inplace/draw.h @@ -33,7 +33,7 @@ typedef struct _Draw { /* Parameters. */ IMAGE *im; /* Draw here */ - PEL *ink; /* Copy of ink param */ + VipsPel *ink; /* Copy of ink param */ /* Derived stuff. */ @@ -49,7 +49,7 @@ typedef struct _Draw { #define DRAW(X) ((Draw *)(X)) static inline void -im__draw_pel( Draw *draw, PEL *q ) +im__draw_pel( Draw *draw, VipsPel *q ) { int j; @@ -69,13 +69,13 @@ im__draw_pel_clip( Draw *draw, int x, int y ) if( y < 0 || y >= draw->im->Ysize ) return; - im__draw_pel( draw, (PEL *) IM_IMAGE_ADDR( draw->im, x, y ) ); + im__draw_pel( draw, IM_IMAGE_ADDR( draw->im, x, y ) ); } /* Is p painted? */ static inline gboolean -im__draw_painted( Draw *draw, PEL *p ) +im__draw_painted( Draw *draw, VipsPel *p ) { int j; @@ -88,4 +88,4 @@ im__draw_painted( Draw *draw, PEL *p ) void im__draw_scanline( Draw *draw, int y, int x1, int x2 ); void im__draw_free( Draw *draw ); -Draw *im__draw_init( Draw *draw, IMAGE *im, PEL *ink ); +Draw *im__draw_init( Draw *draw, IMAGE *im, VipsPel *ink ); diff --git a/libvips/inplace/flood.c b/libvips/inplace/flood.c index 3f9a4078..394fe91c 100644 --- a/libvips/inplace/flood.c +++ b/libvips/inplace/flood.c @@ -109,7 +109,7 @@ typedef struct { /* Derived stuff. */ - PEL *edge; /* Boundary colour */ + VipsPel *edge; /* Boundary colour */ int equal; /* Fill to == edge, or != edge */ int tsize; /* sizeof( one pel in test ) */ int left, right; /* Record bounding box of modified pixels */ @@ -188,7 +188,7 @@ buffer_add( Buffer *buf, Flood *flood, int x1, int x2, int y, int dir ) * pixels. */ static inline gboolean -flood_connected( Flood *flood, PEL *tp ) +flood_connected( Flood *flood, VipsPel *tp ) { int j; @@ -210,19 +210,19 @@ flood_scanline( Flood *flood, int x, int y, int *x1, int *x2 ) Draw *draw = DRAW( flood ); const int width = flood->test->Xsize; - PEL *tp; + VipsPel *tp; int i; g_assert( flood_connected( flood, - (PEL *) IM_IMAGE_ADDR( flood->test, x, y ) ) ); + IM_IMAGE_ADDR( flood->test, x, y ) ) ); g_assert( !im__draw_painted( draw, - (PEL *) IM_IMAGE_ADDR( draw->im, x, y ) ) ); + IM_IMAGE_ADDR( draw->im, x, y ) ) ); /* Search to the right for the first non-connected pixel. If the start * pixel is unpainted, we know all the intervening pixels must be * unpainted too. */ - tp = (PEL *) IM_IMAGE_ADDR( flood->test, x + 1, y ); + tp = IM_IMAGE_ADDR( flood->test, x + 1, y ); for( i = x + 1; i < width; i++ ) { if( !flood_connected( flood, tp ) ) break; @@ -232,7 +232,7 @@ flood_scanline( Flood *flood, int x, int y, int *x1, int *x2 ) /* Search left. */ - tp = (PEL *) IM_IMAGE_ADDR( flood->test, x - 1, y ); + tp = IM_IMAGE_ADDR( flood->test, x - 1, y ); for( i = x - 1; i >= 0; i-- ) { if( !flood_connected( flood, tp ) ) break; @@ -260,12 +260,12 @@ flood_around( Flood *flood, Scan *scan ) { Draw *draw = DRAW( flood ); - PEL *tp; + VipsPel *tp; int x; g_assert( scan->dir == 1 || scan->dir == -1 ); - for( tp = (PEL *) IM_IMAGE_ADDR( flood->test, scan->x1, scan->y ), + for( tp = IM_IMAGE_ADDR( flood->test, scan->x1, scan->y ), x = scan->x1; x <= scan->x2; tp += flood->tsize, x++ ) { @@ -278,7 +278,7 @@ flood_around( Flood *flood, Scan *scan ) * connected loops. */ if( draw->im != flood->test ) { - PEL *mp = (PEL *) IM_IMAGE_ADDR( + VipsPel *mp = IM_IMAGE_ADDR( draw->im, x, scan->y ); if( im__draw_painted( draw, mp ) ) @@ -304,7 +304,7 @@ flood_around( Flood *flood, Scan *scan ) scan->dir ); x = x2a + 1; - tp = (PEL *) IM_IMAGE_ADDR( flood->test, x, scan->y ); + tp = IM_IMAGE_ADDR( flood->test, x, scan->y ); } } } @@ -317,7 +317,7 @@ flood_all( Flood *flood, int x, int y ) /* Test start pixel ... nothing to do? */ if( !flood_connected( flood, - (PEL *) IM_IMAGE_ADDR( flood->test, x, y ) ) ) + IM_IMAGE_ADDR( flood->test, x, y ) ) ) return; flood_scanline( flood, x, y, &x1, &x2 ); @@ -360,7 +360,7 @@ flood_free( Flood *flood ) } static Flood * -flood_new( IMAGE *image, IMAGE *test, int x, int y, PEL *ink, Rect *dout ) +flood_new( IMAGE *image, IMAGE *test, int x, int y, VipsPel *ink, Rect *dout ) { Flood *flood; @@ -385,7 +385,7 @@ flood_new( IMAGE *image, IMAGE *test, int x, int y, PEL *ink, Rect *dout ) flood->in = NULL; flood->out = NULL; - if( !(flood->edge = (PEL *) im_malloc( NULL, flood->tsize )) || + if( !(flood->edge = (VipsPel *) im_malloc( NULL, flood->tsize )) || !(flood->in = buffer_build()) || !(flood->out = buffer_build()) ) { flood_free( flood ); @@ -415,7 +415,7 @@ flood_new( IMAGE *image, IMAGE *test, int x, int y, PEL *ink, Rect *dout ) * Returns: 0 on success, or -1 on error. */ int -im_draw_flood( IMAGE *image, int x, int y, PEL *ink, Rect *dout ) +im_draw_flood( IMAGE *image, int x, int y, VipsPel *ink, Rect *dout ) { Flood *flood; @@ -455,7 +455,7 @@ im_draw_flood( IMAGE *image, int x, int y, PEL *ink, Rect *dout ) * Returns: 0 on success, or -1 on error. */ int -im_draw_flood_blob( IMAGE *image, int x, int y, PEL *ink, Rect *dout ) +im_draw_flood_blob( IMAGE *image, int x, int y, VipsPel *ink, Rect *dout ) { Flood *flood; int j; @@ -528,7 +528,7 @@ im_draw_flood_other( IMAGE *image, if( *m == serial ) return( 0 ); - if( !(flood = flood_new( image, test, x, y, (PEL *) &serial, dout )) ) + if( !(flood = flood_new( image, test, x, y, (VipsPel *) &serial, dout )) ) return( -1 ); /* Edge is set by colour of start pixel. diff --git a/libvips/inplace/im_draw_circle.c b/libvips/inplace/im_draw_circle.c index 336cbc56..76b81d27 100644 --- a/libvips/inplace/im_draw_circle.c +++ b/libvips/inplace/im_draw_circle.c @@ -69,7 +69,7 @@ typedef struct { /* Derived stuff. */ - PEL *centre; + VipsPel *centre; } Circle; static void @@ -89,7 +89,7 @@ circle_octants( Circle *circle, int x, int y ) else if( DRAW( circle )->noclip ) { const size_t lsize = draw->lsize; const size_t psize = draw->psize; - PEL *centre = circle->centre; + VipsPel *centre = circle->centre; im__draw_pel( draw, centre + lsize * y - psize * x ); im__draw_pel( draw, centre + lsize * y + psize * x ); @@ -123,7 +123,7 @@ circle_free( Circle *circle ) } static Circle * -circle_new( IMAGE *im, int cx, int cy, int radius, gboolean fill, PEL *ink ) +circle_new( IMAGE *im, int cx, int cy, int radius, gboolean fill, VipsPel *ink ) { Circle *circle; @@ -140,7 +140,7 @@ circle_new( IMAGE *im, int cx, int cy, int radius, gboolean fill, PEL *ink ) circle->cy = cy; circle->radius = radius; circle->fill = fill; - circle->centre = (PEL *) IM_IMAGE_ADDR( im, cx, cy ); + circle->centre = IM_IMAGE_ADDR( im, cx, cy ); if( cx - radius >= 0 && cx + radius < im->Xsize && cy - radius >= 0 && cy + radius < im->Ysize ) @@ -193,7 +193,7 @@ circle_draw( Circle *circle ) */ int im_draw_circle( VipsImage *image, - int x, int y, int radius, gboolean fill, PEL *ink ) + int x, int y, int radius, gboolean fill, VipsPel *ink ) { if( x + radius >= 0 && x - radius < image->Xsize && y + radius >= 0 && y - radius < image->Ysize ) { diff --git a/libvips/inplace/im_draw_image.c b/libvips/inplace/im_draw_image.c index 98ce5e97..3362c2b4 100644 --- a/libvips/inplace/im_draw_image.c +++ b/libvips/inplace/im_draw_image.c @@ -113,7 +113,7 @@ int im_draw_image( VipsImage *image, VipsImage *sub, int x, int y ) { Rect br, sr, clip; - PEL *p, *q; + VipsPel *p, *q; int z; /* Make rects for main and sub and clip. @@ -137,8 +137,8 @@ im_draw_image( VipsImage *image, VipsImage *sub, int x, int y ) /* Loop, memcpying sub to main. */ - p = (PEL *) IM_IMAGE_ADDR( sub, clip.left - x, clip.top - y ); - q = (PEL *) IM_IMAGE_ADDR( image, clip.left, clip.top ); + p = IM_IMAGE_ADDR( sub, clip.left - x, clip.top - y ); + q = IM_IMAGE_ADDR( image, clip.left, clip.top ); for( z = 0; z < clip.height; z++ ) { memcpy( (char *) q, (char *) p, clip.width * IM_IMAGE_SIZEOF_PEL( sub ) ); diff --git a/libvips/inplace/im_draw_line.c b/libvips/inplace/im_draw_line.c index 7df347a6..90cdb139 100644 --- a/libvips/inplace/im_draw_line.c +++ b/libvips/inplace/im_draw_line.c @@ -83,7 +83,7 @@ line_free( Line *line ) } static Line * -line_new( VipsImage *im, int x1, int y1, int x2, int y2, PEL *ink ) +line_new( VipsImage *im, int x1, int y1, int x2, int y2, VipsPel *ink ) { Line *line; @@ -325,7 +325,7 @@ line_plot_point( VipsImage *im, int x, int y, Draw *draw = (Draw *) a; if( draw->noclip ) - im__draw_pel( draw, (PEL *) IM_IMAGE_ADDR( draw->im, x, y ) ); + im__draw_pel( draw, IM_IMAGE_ADDR( draw->im, x, y ) ); else im__draw_pel_clip( draw, x, y ); @@ -352,7 +352,7 @@ line_plot_point( VipsImage *im, int x, int y, * Returns: 0 on success, or -1 on error. */ int -im_draw_line( VipsImage *image, int x1, int y1, int x2, int y2, PEL *ink ) +im_draw_line( VipsImage *image, int x1, int y1, int x2, int y2, VipsPel *ink ) { Line *line; diff --git a/libvips/inplace/im_draw_mask.c b/libvips/inplace/im_draw_mask.c index b6ca33d2..fd230b2f 100644 --- a/libvips/inplace/im_draw_mask.c +++ b/libvips/inplace/im_draw_mask.c @@ -81,7 +81,7 @@ mask_free( Mask *mask ) } static Mask * -mask_new( VipsImage *im, int x, int y, PEL *ink, VipsImage *mask_im ) +mask_new( VipsImage *im, int x, int y, VipsPel *ink, VipsImage *mask_im ) { Mask *mask; Rect area, image; @@ -183,9 +183,9 @@ mask_draw_labq( Mask *mask ) imb_LabQ2Lab( DRAW( mask )->ink, ink_buffer, 1 ); for( y = 0; y < mask->image_clip.height; y++ ) { - PEL *to = (PEL *) IM_IMAGE_ADDR( DRAW( mask )->im, + VipsPel *to = IM_IMAGE_ADDR( DRAW( mask )->im, mask->image_clip.left, y + mask->image_clip.top ); - PEL *mask_line = (PEL *) IM_IMAGE_ADDR( mask->mask_im, + VipsPel *mask_line = IM_IMAGE_ADDR( mask->mask_im, mask->mask_clip.left, y + mask->mask_clip.top ); imb_LabQ2Lab( to, lab_buffer, mask->image_clip.width ); @@ -204,10 +204,10 @@ mask_draw( Mask *mask ) int y; for( y = 0; y < mask->image_clip.height; y++ ) { - PEL *to = (PEL *) IM_IMAGE_ADDR( DRAW( mask )->im, + VipsPel *to = IM_IMAGE_ADDR( DRAW( mask )->im, mask->image_clip.left, y + mask->image_clip.top ); - PEL *mask_line = (PEL *) IM_IMAGE_ADDR( mask->mask_im, + VipsPel *mask_line = IM_IMAGE_ADDR( mask->mask_im, mask->mask_clip.left, y + mask->mask_clip.top ); @@ -281,7 +281,7 @@ mask_draw( Mask *mask ) * Returns: 0 on success, or -1 on error. */ int -im_draw_mask( VipsImage *image, VipsImage *mask_im, int x, int y, PEL *ink ) +im_draw_mask( VipsImage *image, VipsImage *mask_im, int x, int y, VipsPel *ink ) { Mask *mask; diff --git a/libvips/inplace/im_draw_point.c b/libvips/inplace/im_draw_point.c index 905cdf95..8a202e3b 100644 --- a/libvips/inplace/im_draw_point.c +++ b/libvips/inplace/im_draw_point.c @@ -77,7 +77,7 @@ typedef struct _Point { * Returns: 0 on success, or -1 on error. */ int -im_draw_point( VipsImage *image, int x, int y, PEL *ink ) +im_draw_point( VipsImage *image, int x, int y, VipsPel *ink ) { Point point; @@ -113,7 +113,7 @@ im_draw_point( VipsImage *image, int x, int y, PEL *ink ) * Returns: 0 on success, or -1 on error. */ int -im_read_point( VipsImage *image, int x, int y, PEL *ink ) +im_read_point( VipsImage *image, int x, int y, VipsPel *ink ) { REGION *reg; Rect area; diff --git a/libvips/inplace/im_draw_rect.c b/libvips/inplace/im_draw_rect.c index 70d9a428..8e10c437 100644 --- a/libvips/inplace/im_draw_rect.c +++ b/libvips/inplace/im_draw_rect.c @@ -77,7 +77,7 @@ */ int im_draw_rect( IMAGE *image, - int left, int top, int width, int height, int fill, PEL *ink ) + int left, int top, int width, int height, int fill, VipsPel *ink ) { Rect im, rect, clipped; Draw draw; @@ -91,8 +91,8 @@ im_draw_rect( IMAGE *image, im_draw_rect( image, left, top, 1, height, 1, ink ) ); int x, y; - PEL *to; - PEL *q; + VipsPel *to; + VipsPel *q; /* Find area we plot. */ @@ -118,7 +118,7 @@ im_draw_rect( IMAGE *image, /* We plot the first line pointwise, then memcpy() it for the * subsequent lines. */ - to = (PEL *) IM_IMAGE_ADDR( image, clipped.left, clipped.top ); + to = IM_IMAGE_ADDR( image, clipped.left, clipped.top ); q = to; for( x = 0; x < clipped.width; x++ ) { diff --git a/libvips/inplace/inplace_dispatch.c b/libvips/inplace/inplace_dispatch.c index dbe1338e..d51201b3 100644 --- a/libvips/inplace/inplace_dispatch.c +++ b/libvips/inplace/inplace_dispatch.c @@ -57,7 +57,7 @@ /* Calculate a pixel for an image from a vec of double. Valid while im is * valid. */ -PEL * +VipsPel * im__vector_to_ink( const char *domain, IMAGE *im, int n, double *vec ) { IMAGE *t[3]; @@ -77,11 +77,11 @@ im__vector_to_ink( const char *domain, IMAGE *im, int n, double *vec ) im_clip2fmt( t[1], t[2], im->BandFmt ) ) return( NULL ); - return( (PEL *) t[2]->data ); + return( t[2]->data ); } double * -im__ink_to_vector( const char *domain, IMAGE *im, PEL *ink ) +im__ink_to_vector( const char *domain, IMAGE *im, VipsPel *ink ) { double *vec; int i; @@ -208,7 +208,7 @@ draw_mask_vec( im_object *argv ) int y = *((int *) argv[3]); im_doublevec_object *dv = (im_doublevec_object *) argv[4]; - PEL *ink; + VipsPel *ink; if( !(ink = im__vector_to_ink( "im_draw_mask", image, dv->n, dv->vec )) ) @@ -247,7 +247,7 @@ draw_flood_blob_vec( im_object *argv ) int y = *((int *) argv[2]); im_doublevec_object *dv = (im_doublevec_object *) argv[3]; - PEL *ink; + VipsPel *ink; if( !(ink = im__vector_to_ink( "im_draw_flood_blob", image, dv->n, dv->vec )) ) @@ -286,7 +286,7 @@ draw_flood_vec( im_object *argv ) int y = *((int *) argv[2]); im_doublevec_object *dv = (im_doublevec_object *) argv[3]; - PEL *ink; + VipsPel *ink; if( !(ink = im__vector_to_ink( "im_draw_flood", image, dv->n, dv->vec )) ) @@ -360,7 +360,7 @@ draw_point_vec( im_object *argv ) int y = *((int *) argv[2]); im_doublevec_object *dv = (im_doublevec_object *) argv[3]; - PEL *ink; + VipsPel *ink; if( !(ink = im__vector_to_ink( "im_draw_point", image, dv->n, dv->vec )) ) @@ -399,9 +399,9 @@ read_point_vec( im_object *argv ) int y = *((int *) argv[2]); im_doublevec_object *dv = (im_doublevec_object *) argv[3]; - PEL *ink; + VipsPel *ink; - if( !(ink = IM_ARRAY( image, IM_IMAGE_SIZEOF_PEL( image ), PEL )) || + if( !(ink = IM_ARRAY( image, IM_IMAGE_SIZEOF_PEL( image ), VipsPel )) || im_read_point( image, x, y, ink ) || !(dv->vec = im__ink_to_vector( "im_read_point", image, ink )) ) return( -1 ); @@ -444,7 +444,7 @@ draw_line_vec( im_object *argv ) int y2 = *((int *) argv[4]); im_doublevec_object *dv = (im_doublevec_object *) argv[5]; - PEL *ink; + VipsPel *ink; if( !(ink = im__vector_to_ink( "im_draw_line", image, dv->n, dv->vec )) ) @@ -524,7 +524,7 @@ draw_rect_vec( im_object *argv ) int fill = *((int *) argv[5]); im_doublevec_object *dv = (im_doublevec_object *) argv[6]; - PEL *ink; + VipsPel *ink; if( !(ink = im__vector_to_ink( "im_draw_rect", image, dv->n, dv->vec )) ) @@ -567,7 +567,7 @@ draw_circle_vec( im_object *argv ) int fill = *((int *) argv[4]); im_doublevec_object *dv = (im_doublevec_object *) argv[5]; - PEL *ink; + VipsPel *ink; if( !(ink = im__vector_to_ink( "im_draw_circle", image, dv->n, dv->vec )) ) diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index 43235892..da75ecb1 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -1818,7 +1818,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, VipsPel *linebuffer ) { int linesize = VIPS_IMAGE_SIZEOF_LINE( image ); diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index eb7d7541..867f089e 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -285,6 +285,9 @@ vips_argument_instance_free( VipsArgumentInstance *argument_instance ) g_free( argument_instance ); } +/** + * vips__argument_table_lookup: (skip) + */ VipsArgument * vips__argument_table_lookup( VipsArgumentTable *table, GParamSpec *pspec ) { @@ -343,7 +346,10 @@ vips_argument_map( VipsObject *object, return( NULL ); } -/* And loop over a class. Same as ^^, but with no VipsArgumentInstance. +/** + * vips_argument_class_map: (skip) + * + * And loop over a class. Same as ^^, but with no VipsArgumentInstance. */ void * vips_argument_class_map( VipsObjectClass *object_class, @@ -425,7 +431,10 @@ vips_argument_init( VipsObject *object ) } } -/* Convenience ... given the VipsArgumentClass, get the VipsArgumentInstance. +/** + * vips__argument_get_instance: (skip) + * + * Convenience ... given the VipsArgumentClass, get the VipsArgumentInstance. */ VipsArgumentInstance * vips__argument_get_instance( VipsArgumentClass *argument_class, @@ -440,7 +449,10 @@ vips__argument_get_instance( VipsArgumentClass *argument_class, ((VipsArgument *) argument_class)->pspec ) ); } -/* Look up the three things you need to work with a vips argument. +/** + * vips_object_get_argument: (skip) + * + * Look up the three things you need to work with a vips argument. */ int vips_object_get_argument( VipsObject *object, const char *name, @@ -1874,7 +1886,10 @@ vips_type_map_all( GType base, VipsTypeMapFn fn, void *a ) return( result ); } -/* Loop over all the subclasses of a base type. Non-abtract classes only. +/** + * vips_class_map_all: (skip) + * + * Loop over all the subclasses of a base type. Non-abtract classes only. */ void * vips_class_map_all( GType type, VipsClassMapFn fn, void *a ) @@ -1991,7 +2006,7 @@ vips_object_local_array_cb( GObject *parent, VipsObjectLocal *local ) } /** - * vips_object_local_array: + * vips_object_local_array: (skip) * @parent: objects unref when this object unrefs * @n: array size * diff --git a/libvips/iofuncs/region.c b/libvips/iofuncs/region.c index e6877dca..cad3cbd5 100644 --- a/libvips/iofuncs/region.c +++ b/libvips/iofuncs/region.c @@ -859,7 +859,7 @@ vips_region_paint( VipsRegion *reg, VipsRect *r, int value ) vips_rect_intersectrect( r, ®->valid, &ovl ); if( !vips_rect_isempty( &ovl ) ) { - PEL *q = (PEL *) VIPS_REGION_ADDR( reg, ovl.left, ovl.top ); + VipsPel *q = VIPS_REGION_ADDR( reg, ovl.left, ovl.top ); int wd = ovl.width * VIPS_IMAGE_SIZEOF_PEL( reg->im ); int ls = VIPS_REGION_LSKIP( reg ); int y; @@ -886,7 +886,7 @@ vips_region_paint( VipsRegion *reg, VipsRect *r, int value ) * See also: vips_region_paint(). */ void -vips_region_paint_pel( VipsRegion *reg, VipsRect *r, PEL *ink ) +vips_region_paint_pel( VipsRegion *reg, VipsRect *r, VipsPel *ink ) { VipsRect ovl; @@ -896,13 +896,13 @@ vips_region_paint_pel( VipsRegion *reg, VipsRect *r, PEL *ink ) int ws = ovl.width * ps; int ls = VIPS_REGION_LSKIP( reg ); - PEL *to, *q; + VipsPel *to, *q; int x, y, z; /* We plot the first line pointwise, then memcpy() it for the * subsequent lines. */ - to = (PEL *) VIPS_REGION_ADDR( reg, ovl.left, ovl.top ); + to = VIPS_REGION_ADDR( reg, ovl.left, ovl.top ); q = to; for( x = 0; x < ovl.width; x++ ) { @@ -955,8 +955,8 @@ vips_region_copy( VipsRegion *reg, VipsRegion *dest, VipsRect *r, int x, int y ) { int z; int len = VIPS_IMAGE_SIZEOF_PEL( reg->im ) * r->width; - PEL *p = VIPS_REGION_ADDR( reg, r->left, r->top ); - PEL *q = VIPS_REGION_ADDR( dest, x, y ); + VipsPel *p = VIPS_REGION_ADDR( reg, r->left, r->top ); + VipsPel *q = VIPS_REGION_ADDR( dest, x, y ); int plsk = VIPS_REGION_LSKIP( reg ); int qlsk = VIPS_REGION_LSKIP( dest ); @@ -980,7 +980,7 @@ vips_region_copy( VipsRegion *reg, VipsRegion *dest, VipsRect *r, int x, int y ) */ g_assert( vips_rect_includesrect( ®->valid, r ) ); - /* PEL size must be the same. + /* VipsPel size must be the same. */ g_assert( VIPS_IMAGE_SIZEOF_PEL( reg->im ) == VIPS_IMAGE_SIZEOF_PEL( dest->im ) ); @@ -1113,7 +1113,7 @@ vips_region_prepare_to_generate( VipsRegion *reg, VipsRegion *dest, VipsRect *r, int x, int y ) { IMAGE *im = reg->im; - PEL *p; + VipsPel *p; if( !im->generate_fn ) { vips_error( "vips_region_prepare_to", diff --git a/libvips/iofuncs/sinkmemory.c b/libvips/iofuncs/sinkmemory.c index 595f701e..2e2eb209 100644 --- a/libvips/iofuncs/sinkmemory.c +++ b/libvips/iofuncs/sinkmemory.c @@ -105,7 +105,7 @@ sink_memory_work( VipsThreadState *state, void *a ) #ifdef VIPS_DEBUG { - PEL *p = (PEL *) VIPS_REGION_ADDR( state->reg, + VipsPel *p = VIPS_REGION_ADDR( state->reg, state->pos.left, state->pos.top ); int i; diff --git a/libvips/iofuncs/sinkscreen.c b/libvips/iofuncs/sinkscreen.c index 2612abc6..c3f9ace4 100644 --- a/libvips/iofuncs/sinkscreen.c +++ b/libvips/iofuncs/sinkscreen.c @@ -881,9 +881,9 @@ tile_copy( Tile *tile, VipsRegion *to ) tile, tile->area.left, tile->area.top ); for( y = ovlap.top; y < VIPS_RECT_BOTTOM( &ovlap ); y++ ) { - PEL *p = (PEL *) VIPS_REGION_ADDR( tile->region, + VipsPel *p = VIPS_REGION_ADDR( tile->region, ovlap.left, y ); - PEL *q = (PEL *) VIPS_REGION_ADDR( to, ovlap.left, y ); + VipsPel *q = VIPS_REGION_ADDR( to, ovlap.left, y ); memcpy( q, p, len ); } diff --git a/libvips/iofuncs/type.c b/libvips/iofuncs/type.c index 9fea03b3..246f2445 100644 --- a/libvips/iofuncs/type.c +++ b/libvips/iofuncs/type.c @@ -372,7 +372,7 @@ vips_save_string_get_type( void ) * * Get the C string held internally by the GValue. * - * Returns: The C string held by @value. This must not be freed. + * Returns: (transfer none): the C string held by @value. */ const char * vips_value_get_ref_string( const GValue *value, size_t *length ) @@ -505,7 +505,7 @@ vips_value_set_blob( GValue *value, /** * vips_value_get_blob: * @value: GValue to set - * @length: optionally return length of memory area + * @length: (out): optionally return length of memory area * * Returns the data pointer from a blob. Optionally returns the length too. * @@ -515,7 +515,7 @@ vips_value_set_blob( GValue *value, * * See also: vips_value_set_blob() * - * Returns: 0 on success, -1 otherwise. + * Returns: (transfer none): a pointer to the area */ void * vips_value_get_blob( const GValue *value, size_t *length ) @@ -633,7 +633,7 @@ vips_value_get_array( const GValue *value, * * See also: vips_array_double_set(). * - * Returns: The array address. + * Returns: (transfer none): The array address. */ double * vips_value_get_array_double( const GValue *value, int *n ) @@ -748,7 +748,7 @@ vips_array_double_get_type( void ) * * See also: vips_array_object_set(). * - * Returns: The array address. + * Returns: (transfer none): The array address. */ GObject ** vips_value_get_array_object( const GValue *value, int *n ) diff --git a/libvips/iofuncs/vector.c b/libvips/iofuncs/vector.c index fe8b8c15..927d72de 100644 --- a/libvips/iofuncs/vector.c +++ b/libvips/iofuncs/vector.c @@ -348,7 +348,7 @@ vips_executor_set_scanline( VipsExecutor *executor, VipsRegion *ir, int x, int y ) { VipsVector *vector = executor->vector; - PEL *base = (PEL *) VIPS_REGION_ADDR( ir, x, y ); + VipsPel *base = VIPS_REGION_ADDR( ir, x, y ); int lsk = VIPS_REGION_LSKIP( ir ); int i; diff --git a/libvips/iofuncs/window.c b/libvips/iofuncs/window.c index 8f7bcad1..4b620970 100644 --- a/libvips/iofuncs/window.c +++ b/libvips/iofuncs/window.c @@ -245,7 +245,7 @@ vips_window_set( VipsWindow *window, int top, int height ) window->baseaddr = baseaddr; window->length = pagelength; - window->data = (PEL *) baseaddr + (start - pagestart); + window->data = (VipsPel *) baseaddr + (start - pagestart); window->top = top; window->height = height; diff --git a/libvips/morphology/im_cntlines.c b/libvips/morphology/im_cntlines.c index fddf711e..58f2ca77 100644 --- a/libvips/morphology/im_cntlines.c +++ b/libvips/morphology/im_cntlines.c @@ -68,7 +68,7 @@ int im_cntlines( IMAGE *im, double *nolines, int flag ) { int x, y; - PEL *line; + VipsPel *line; int cnt; if( im_incheck( im ) || @@ -82,12 +82,12 @@ im_cntlines( IMAGE *im, double *nolines, int flag ) return( -1 ); } - line = (PEL *) im->data; + line = im->data; if( flag == 1 ) { /* Count vertical lines. */ for( cnt = 0, y = 0; y < im->Ysize; y++ ) { - PEL *p = line; + VipsPel *p = line; for( x = 0; x < im->Xsize - 1; x++ ) { if( p[0] < 128 && p[1] >= 128 ) @@ -107,8 +107,8 @@ im_cntlines( IMAGE *im, double *nolines, int flag ) /* Count horizontal lines. */ for( cnt = 0, y = 0; y < im->Ysize - 1; y++ ) { - PEL *p1 = line; - PEL *p2 = line + im->Xsize; + VipsPel *p1 = line; + VipsPel *p2 = line + im->Xsize; for( x = 0; x < im->Xsize; x++ ) { if( *p1 < 128 && *p2 >= 128 ) diff --git a/libvips/morphology/im_profile.c b/libvips/morphology/im_profile.c index adfd8d08..2ff40ff8 100644 --- a/libvips/morphology/im_profile.c +++ b/libvips/morphology/im_profile.c @@ -127,7 +127,7 @@ im_profile( IMAGE *in, IMAGE *out, int dir ) /* Find vertical lines. */ for( x = 0; x < sz; x++ ) { - PEL *p = (PEL *) IM_IMAGE_ADDR( in, 0, 0 ) + x; + VipsPel *p = IM_IMAGE_ADDR( in, 0, 0 ) + x; int lsk = IM_IMAGE_SIZEOF_LINE( in ); for( y = 0; y < in->Ysize; y++ ) { @@ -139,17 +139,17 @@ im_profile( IMAGE *in, IMAGE *out, int dir ) buf[x] = y; } - if( im_writeline( 0, out, (PEL *) buf ) ) + if( im_writeline( 0, out, (VipsPel *) buf ) ) return( -1 ); } else { /* Search horizontal lines. */ for( y = 0; y < in->Ysize; y++ ) { - PEL *p = (PEL *) IM_IMAGE_ADDR( in, 0, y ); + VipsPel *p = IM_IMAGE_ADDR( in, 0, y ); for( b = 0; b < in->Bands; b++ ) { - PEL *p1; + VipsPel *p1; p1 = p + b; for( x = 0; x < in->Xsize; x++ ) { @@ -161,7 +161,7 @@ im_profile( IMAGE *in, IMAGE *out, int dir ) buf[b] = x; } - if( im_writeline( y, out, (PEL *) buf ) ) + if( im_writeline( y, out, (VipsPel *) buf ) ) return( -1 ); } } diff --git a/libvips/morphology/im_rank.c b/libvips/morphology/im_rank.c index 66a0778b..d753ab74 100644 --- a/libvips/morphology/im_rank.c +++ b/libvips/morphology/im_rank.c @@ -74,7 +74,7 @@ typedef struct { */ typedef struct { REGION *ir; - PEL *sort; + VipsPel *sort; } SeqInfo; /* Free a sequence value. @@ -110,7 +110,7 @@ rank_start( IMAGE *out, void *a, void *b ) */ seq->ir = im_region_create( in ); seq->sort = IM_ARRAY( out, - IM_IMAGE_SIZEOF_ELEMENT( in ) * rnk->n, PEL ); + IM_IMAGE_SIZEOF_ELEMENT( in ) * rnk->n, VipsPel ); if( !seq->ir || !seq->sort ) { rank_stop( seq, in, rnk ); return( NULL ); diff --git a/libvips/morphology/im_rank_image.c b/libvips/morphology/im_rank_image.c index 0101e15e..516c3579 100644 --- a/libvips/morphology/im_rank_image.c +++ b/libvips/morphology/im_rank_image.c @@ -91,8 +91,8 @@ typedef struct { Rank *rank; REGION **ir; /* Input regions */ - PEL **pts; /* Per-input region data pointer */ - PEL *sort; /* Sort pixels here */ + VipsPel **pts; /* Per-input region data pointer */ + VipsPel *sort; /* Sort pixels here */ } RankSequence; /* Free a sequence value. @@ -135,9 +135,9 @@ rank_start( IMAGE *out, void *a, void *b ) /* Attach regions and arrays. */ seq->ir = IM_ARRAY( out, rank->n + 1, REGION * ); - seq->pts = IM_ARRAY( out, rank->n + 1, PEL * ); + seq->pts = IM_ARRAY( out, rank->n + 1, VipsPel * ); seq->sort = IM_ARRAY( out, - rank->n * IM_IMAGE_SIZEOF_ELEMENT( in[0] ), PEL ); + rank->n * IM_IMAGE_SIZEOF_ELEMENT( in[0] ), VipsPel ); if( !seq->ir || !seq->pts || !seq->sort ) { rank_stop( seq, in, rank ); return( NULL ); @@ -251,11 +251,10 @@ rank_gen( REGION *or, void *vseq, void *a, void *b ) /* Loop over output! */ for( y = to; y < bo; y++ ) { - PEL *q = (PEL *) IM_REGION_ADDR( or, le, y ); + VipsPel *q = IM_REGION_ADDR( or, le, y ); for( i = 0; i < rank->n; i++ ) - seq->pts[i] = (PEL *) - IM_REGION_ADDR( seq->ir[i], le, y ); + seq->pts[i] = IM_REGION_ADDR( seq->ir[i], le, y ); /* Special-case max and min. */ diff --git a/libvips/morphology/im_zerox.c b/libvips/morphology/im_zerox.c index 496bfa22..43095bb7 100644 --- a/libvips/morphology/im_zerox.c +++ b/libvips/morphology/im_zerox.c @@ -96,8 +96,8 @@ zerox_gen( REGION *or, void *seq, void *a, void *b ) return( -1 ); for( y = to; y < bo; y++ ) { - PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); - PEL *q = (PEL *) IM_REGION_ADDR( or, le, y ); + VipsPel *p = IM_REGION_ADDR( ir, le, y ); + VipsPel *q = IM_REGION_ADDR( or, le, y ); switch( in->BandFmt ) { case IM_BANDFMT_CHAR: LOOP( signed char ); break; diff --git a/libvips/morphology/morphology.c b/libvips/morphology/morphology.c index 4bbcef51..7b62d32c 100644 --- a/libvips/morphology/morphology.c +++ b/libvips/morphology/morphology.c @@ -407,8 +407,8 @@ morph_start( IMAGE *out, void *a, void *b ) seq->ir = im_region_create( in ); seq->soff = IM_ARRAY( out, n_mask, int ); seq->coff = IM_ARRAY( out, n_mask, int ); - seq->t1 = IM_ARRAY( NULL, sz, PEL ); - seq->t2 = IM_ARRAY( NULL, sz, PEL ); + seq->t1 = IM_ARRAY( NULL, sz, VipsPel ); + seq->t2 = IM_ARRAY( NULL, sz, VipsPel ); if( !seq->ir || !seq->soff || !seq->coff || !seq->t1 || !seq->t2 ) { morph_stop( seq, in, NULL ); return( NULL ); @@ -492,8 +492,8 @@ dilate_gen( REGION *or, void *vseq, void *a, void *b ) /* Dilate! */ for( y = to; y < bo; y++ ) { - PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); - PEL *q = (PEL *) IM_REGION_ADDR( or, le, y ); + VipsPel *p = IM_REGION_ADDR( ir, le, y ); + VipsPel *q = IM_REGION_ADDR( or, le, y ); /* Loop along line. */ @@ -604,8 +604,8 @@ erode_gen( REGION *or, void *vseq, void *a, void *b ) /* Erode! */ for( y = to; y < bo; y++ ) { - PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); - PEL *q = (PEL *) IM_REGION_ADDR( or, le, y ); + VipsPel *p = IM_REGION_ADDR( ir, le, y ); + VipsPel *q = IM_REGION_ADDR( or, le, y ); /* Loop along line. */ diff --git a/libvips/mosaicing/im_lrcalcon.c b/libvips/mosaicing/im_lrcalcon.c index 99e051ff..d41c16f9 100644 --- a/libvips/mosaicing/im_lrcalcon.c +++ b/libvips/mosaicing/im_lrcalcon.c @@ -107,11 +107,11 @@ all_black( IMAGE *im, int xpos, int ypos, int winsize ) const int ls = im->Xsize; int x, y; - PEL *line; + VipsPel *line; /* Loop over image. */ - line = (PEL *) im->data + top*ls + left; + line = im->data + top*ls + left; for( y = 0; y < winsize; y++ ) { for( x = 0; x < winsize; x++ ) if( line[x] ) @@ -138,10 +138,10 @@ calculate_contrast( IMAGE *im, int xpos, int ypos, int winsize ) const int ls = im->Xsize; int x, y; - PEL *line, *p; + VipsPel *line, *p; int total; - line = (PEL *) im->data + top*ls + left; + line = im->data + top*ls + left; for( total = 0, y = 0; y < winsize-1; y++ ) { p = line; diff --git a/libvips/mosaicing/im_lrmerge.c b/libvips/mosaicing/im_lrmerge.c index baeb17e5..61f8495c 100644 --- a/libvips/mosaicing/im_lrmerge.c +++ b/libvips/mosaicing/im_lrmerge.c @@ -177,7 +177,7 @@ im__make_blend_luts() static int find_first( REGION *ir, int *pos, int x, int y, int w ) { - PEL *pr = (PEL *) IM_REGION_ADDR( ir, x, y ); + VipsPel *pr = IM_REGION_ADDR( ir, x, y ); IMAGE *im = ir->im; int ne = w * im->Bands; int i; @@ -226,7 +226,7 @@ find_first( REGION *ir, int *pos, int x, int y, int w ) static int find_last( REGION *ir, int *pos, int x, int y, int w ) { - PEL *pr = (PEL *) IM_REGION_ADDR( ir, x, y ); + VipsPel *pr = IM_REGION_ADDR( ir, x, y ); IMAGE *im = ir->im; int ne = w * im->Bands; int i; @@ -568,9 +568,9 @@ lr_blend( REGION *or, MergeInfo *inf, Overlapping *ovlap, Rect *oreg ) */ for( y = oreg->top, yr = prr.top, ys = psr.top; y < IM_RECT_BOTTOM( oreg ); y++, yr++, ys++ ) { - PEL *pr = (PEL *) IM_REGION_ADDR( rir, prr.left, yr ); - PEL *ps = (PEL *) IM_REGION_ADDR( sir, psr.left, ys ); - PEL *q = (PEL *) IM_REGION_ADDR( or, oreg->left, y ); + VipsPel *pr = IM_REGION_ADDR( rir, prr.left, yr ); + VipsPel *ps = IM_REGION_ADDR( sir, psr.left, ys ); + VipsPel *q = IM_REGION_ADDR( or, oreg->left, y ); const int j = y - ovlap->overlap.top; const int first = ovlap->first[j]; @@ -647,9 +647,9 @@ lr_blend_labpack( REGION *or, MergeInfo *inf, Overlapping *ovlap, Rect *oreg ) */ for( y = oreg->top, yr = prr.top, ys = psr.top; y < IM_RECT_BOTTOM( oreg ); y++, yr++, ys++ ) { - PEL *pr = (PEL *) IM_REGION_ADDR( rir, prr.left, yr ); - PEL *ps = (PEL *) IM_REGION_ADDR( sir, psr.left, ys ); - PEL *q = (PEL *) IM_REGION_ADDR( or, oreg->left, y ); + VipsPel *pr = IM_REGION_ADDR( rir, prr.left, yr ); + VipsPel *ps = IM_REGION_ADDR( sir, psr.left, ys ); + VipsPel *q = IM_REGION_ADDR( or, oreg->left, y ); const int j = y - ovlap->overlap.top; const int first = ovlap->first[j]; diff --git a/libvips/mosaicing/im_tbmerge.c b/libvips/mosaicing/im_tbmerge.c index 0b8c8cff..f1f43008 100644 --- a/libvips/mosaicing/im_tbmerge.c +++ b/libvips/mosaicing/im_tbmerge.c @@ -120,7 +120,7 @@ static int find_top( REGION *ir, int *pos, int x, int y, int h ) { - PEL *pr = (PEL *) IM_REGION_ADDR( ir, x, y ); + VipsPel *pr = IM_REGION_ADDR( ir, x, y ); IMAGE *im = ir->im; int ls = IM_REGION_LSKIP( ir ) / IM_IMAGE_SIZEOF_ELEMENT( im ); int b = im->Bands; @@ -174,7 +174,7 @@ find_top( REGION *ir, int *pos, int x, int y, int h ) static int find_bot( REGION *ir, int *pos, int x, int y, int h ) { - PEL *pr = (PEL *) IM_REGION_ADDR( ir, x, y ); + VipsPel *pr = IM_REGION_ADDR( ir, x, y ); IMAGE *im = ir->im; int ls = IM_REGION_LSKIP( ir ) / IM_IMAGE_SIZEOF_ELEMENT( ir->im ); int b = im->Bands; @@ -501,9 +501,9 @@ tb_blend( REGION *or, MergeInfo *inf, Overlapping *ovlap, Rect *oreg ) */ for( y = oreg->top, yr = prr.top, ys = psr.top; y < IM_RECT_BOTTOM( oreg ); y++, yr++, ys++ ) { - PEL *pr = (PEL *) IM_REGION_ADDR( rir, prr.left, yr ); - PEL *ps = (PEL *) IM_REGION_ADDR( sir, psr.left, ys ); - PEL *q = (PEL *) IM_REGION_ADDR( or, oreg->left, y ); + VipsPel *pr = IM_REGION_ADDR( rir, prr.left, yr ); + VipsPel *ps = IM_REGION_ADDR( sir, psr.left, ys ); + VipsPel *q = IM_REGION_ADDR( or, oreg->left, y ); const int j = oreg->left - ovlap->overlap.left; const int *first = ovlap->first + j; @@ -579,9 +579,9 @@ tb_blend_labpack( REGION *or, MergeInfo *inf, Overlapping *ovlap, Rect *oreg ) */ for( y = oreg->top, yr = prr.top, ys = psr.top; y < IM_RECT_BOTTOM( oreg ); y++, yr++, ys++ ) { - PEL *pr = (PEL *) IM_REGION_ADDR( rir, prr.left, yr ); - PEL *ps = (PEL *) IM_REGION_ADDR( sir, psr.left, ys ); - PEL *q = (PEL *) IM_REGION_ADDR( or, oreg->left, y ); + VipsPel *pr = IM_REGION_ADDR( rir, prr.left, yr ); + VipsPel *ps = IM_REGION_ADDR( sir, psr.left, ys ); + VipsPel *q = IM_REGION_ADDR( or, oreg->left, y ); const int j = oreg->left - ovlap->overlap.left; const int *first = ovlap->first + j; diff --git a/libvips/other/im_eye.c b/libvips/other/im_eye.c index 65503ea0..8150b545 100644 --- a/libvips/other/im_eye.c +++ b/libvips/other/im_eye.c @@ -109,7 +109,7 @@ im_feye( IMAGE *out, const int xsize, const int ysize, const double factor ) for( y = 0; y < ysize; y++ ) { for( x = 0; x < xsize; x++ ) line[x] = y * y * lut[x]; - if( im_writeline( y, out, (PEL *) line ) ) + if( im_writeline( y, out, (VipsPel *) line ) ) return( -1 ); } diff --git a/libvips/resample/im_affine.c b/libvips/resample/im_affine.c index ec8b6cdc..9df7c7e0 100644 --- a/libvips/resample/im_affine.c +++ b/libvips/resample/im_affine.c @@ -315,7 +315,7 @@ affinei_gen( REGION *or, void *seq, void *a, void *b ) */ double ix, iy; - PEL *q; + VipsPel *q; /* To (3). */ @@ -327,7 +327,7 @@ affinei_gen( REGION *or, void *seq, void *a, void *b ) ix += iarea->left; iy += iarea->top; - q = (PEL *) IM_REGION_ADDR( or, le, y ); + q = IM_REGION_ADDR( or, le, y ); for( x = le; x < ri; x++ ) { int fx, fy; diff --git a/libvips/resample/interpolate.c b/libvips/resample/interpolate.c index e0b91460..fcd4969d 100644 --- a/libvips/resample/interpolate.c +++ b/libvips/resample/interpolate.c @@ -341,8 +341,8 @@ vips_interpolate_nearest_interpolate( VipsInterpolate *interpolate, const int xi = (int) x; const int yi = (int) y; - const PEL *p = (PEL *) IM_REGION_ADDR( in, xi, yi ); - PEL *q = (PEL *) out; + const VipsPel *p = IM_REGION_ADDR( in, xi, yi ); + VipsPel *q = (VipsPel *) out; int z; @@ -511,10 +511,10 @@ vips_interpolate_bilinear_interpolate( VipsInterpolate *interpolate, const int ix = (int) x; const int iy = (int) y; - const PEL *p1 = (PEL *) IM_REGION_ADDR( in, ix, iy ); - const PEL *p2 = p1 + ps; - const PEL *p3 = p1 + ls; - const PEL *p4 = p3 + ps; + const VipsPel *p1 = IM_REGION_ADDR( in, ix, iy ); + const VipsPel *p2 = p1 + ps; + const VipsPel *p3 = p1 + ls; + const VipsPel *p4 = p3 + ps; int z;