From 64eaeeb6c3a3d5f016149d9836291db9ed38384a Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 4 Nov 2009 15:04:12 +0000 Subject: [PATCH] stuff --- libvips/deprecated/Makefile.am | 1 + libvips/deprecated/deprecated_dispatch.c | 37 +++++++++++++++++ libvips/{inplace => deprecated}/im_line.c | 0 libvips/freq_filt/freq_dispatch.c | 11 +++++ libvips/histograms_lut/hist_dispatch.c | 9 +++++ libvips/include/vips/deprecated.h | 2 + libvips/include/vips/freq_filt.h | 12 +++--- libvips/include/vips/histograms_lut.h | 6 +-- libvips/include/vips/inplace.h | 24 ++++++----- libvips/inplace/Makefile.am | 1 - libvips/inplace/im_circle.c | 2 +- libvips/inplace/inplace_dispatch.c | 49 ++++++----------------- 12 files changed, 95 insertions(+), 59 deletions(-) rename libvips/{inplace => deprecated}/im_line.c (100%) diff --git a/libvips/deprecated/Makefile.am b/libvips/deprecated/Makefile.am index 982ec80e..b0fad69e 100644 --- a/libvips/deprecated/Makefile.am +++ b/libvips/deprecated/Makefile.am @@ -8,6 +8,7 @@ libdeprecated_la_SOURCES = \ im_cmulnorm.c \ im_printlines.c \ im_convsub.c \ + im_line.c \ im_debugim.c \ im_gfadd.c \ im_setbox.c \ diff --git a/libvips/deprecated/deprecated_dispatch.c b/libvips/deprecated/deprecated_dispatch.c index f5306467..d870efcc 100644 --- a/libvips/deprecated/deprecated_dispatch.c +++ b/libvips/deprecated/deprecated_dispatch.c @@ -687,6 +687,42 @@ static im_function bernd_desc = { bernd_args /* Arg list */ }; +/* Args for im_line. + */ +static im_arg_desc line_args[] = { + IM_RW_IMAGE( "im" ), + IM_INPUT_INT( "x1" ), + IM_INPUT_INT( "y1" ), + IM_INPUT_INT( "x2" ), + IM_INPUT_INT( "y2" ), + IM_INPUT_INT( "pelval" ) +}; + +/* Call im_line via arg vector. + */ +static int +line_vec( im_object *argv ) +{ + int x1 = *((int *) argv[1]); + int y1 = *((int *) argv[2]); + int x2 = *((int *) argv[3]); + int y2 = *((int *) argv[4]); + int pel = *((int *) argv[5]); + + return( im_line( argv[0], x1, y1, x2, y2, pel ) ); +} + +/* Description of im_line. + */ +static im_function line_desc = { + "im_line", /* Name */ + "draw line between points (x1,y1) and (x2,y2)", + 0, /* Flags */ + line_vec, /* Dispatch function */ + IM_NUMBER( line_args ), /* Size of arg list */ + line_args /* Arg list */ +}; + /* Package up all these functions. */ static im_function *deprecated_list[] = { @@ -710,6 +746,7 @@ static im_function *deprecated_list[] = { &print_desc, &slice_desc, &bernd_desc, + &line_desc, &thresh_desc, &similarity_area_desc, &similarity_desc diff --git a/libvips/inplace/im_line.c b/libvips/deprecated/im_line.c similarity index 100% rename from libvips/inplace/im_line.c rename to libvips/deprecated/im_line.c diff --git a/libvips/freq_filt/freq_dispatch.c b/libvips/freq_filt/freq_dispatch.c index cfb2d396..950d78cd 100644 --- a/libvips/freq_filt/freq_dispatch.c +++ b/libvips/freq_filt/freq_dispatch.c @@ -46,6 +46,17 @@ #include #endif /*WITH_DMALLOC*/ +/** + * SECTION: freq_filt + * @short_description: fourier transforms and frequency-domin filters + * @stability: Stable + * @see_also: image + * @include: vips/vips.h + * + * To and from Fourier space, filter in Fourier space, convert Fourier-space + * images to a displayable form. + */ + /* One image in, one out. */ static im_arg_desc one_in_one_out[] = { diff --git a/libvips/histograms_lut/hist_dispatch.c b/libvips/histograms_lut/hist_dispatch.c index 70b2e9db..317fcb7e 100644 --- a/libvips/histograms_lut/hist_dispatch.c +++ b/libvips/histograms_lut/hist_dispatch.c @@ -42,6 +42,15 @@ #include #endif /*WITH_DMALLOC*/ +/** + * SECTION: histograms_lut + * @short_description: find, manipulate and apply histograms and lookup tables + * @stability: Stable + * @see_also: image + * @include: vips/vips.h + * + */ + /* One image in, one out. */ static im_arg_desc one_in_one_out[] = { diff --git a/libvips/include/vips/deprecated.h b/libvips/include/vips/deprecated.h index 6c400f23..d3930f3f 100644 --- a/libvips/include/vips/deprecated.h +++ b/libvips/include/vips/deprecated.h @@ -347,6 +347,8 @@ int im_convsub( IMAGE *in, IMAGE *out, INTMASK *mask, int xskip, int yskip ); int im_bernd( const char *tiffname, int x, int y, int w, int h ); +int im_line( IMAGE *, int, int, int, int, int ); + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/include/vips/freq_filt.h b/libvips/include/vips/freq_filt.h index 609dbf40..f55d9f2a 100644 --- a/libvips/include/vips/freq_filt.h +++ b/libvips/include/vips/freq_filt.h @@ -38,12 +38,12 @@ extern "C" { #endif /*__cplusplus*/ int im_fractsurf( IMAGE *out, int size, double frd ); -int im_freqflt( IMAGE *, IMAGE *, IMAGE * ); -int im_disp_ps( IMAGE *, IMAGE * ); -int im_rotquad( IMAGE *, IMAGE * ); -int im_fwfft( IMAGE *, IMAGE * ); -int im_invfft( IMAGE *, IMAGE * ); -int im_invfftr( IMAGE *, IMAGE * ); +int im_freqflt( IMAGE *in, IMAGE *mask, IMAGE *out ); +int im_disp_ps( IMAGE *in, IMAGE *out ); +int im_rotquad( IMAGE *in, IMAGE *out ); +int im_fwfft( IMAGE *in, IMAGE *out ); +int im_invfft( IMAGE *in, IMAGE *out ); +int im_invfftr( IMAGE *in, IMAGE *out ); int im_phasecor_fft( IMAGE *in1, IMAGE *in2, IMAGE *out ); #ifdef __cplusplus diff --git a/libvips/include/vips/histograms_lut.h b/libvips/include/vips/histograms_lut.h index 33915b97..14c80509 100644 --- a/libvips/include/vips/histograms_lut.h +++ b/libvips/include/vips/histograms_lut.h @@ -37,8 +37,8 @@ extern "C" { #endif /*__cplusplus*/ -int im_maplut( IMAGE *, IMAGE *, IMAGE * ); -int im_gammacorrect( IMAGE *, IMAGE *, double ); +int im_maplut( IMAGE *in, IMAGE *out, IMAGE *lut ); +int im_gammacorrect( IMAGE *in, IMAGE *out, double exponent ); int im_heq( IMAGE *in, IMAGE *out, int bandno ); int im_hist( IMAGE *in, IMAGE *out, int bandno ); int im_hist_indexed( IMAGE *index, IMAGE *value, IMAGE *out ); @@ -72,7 +72,7 @@ int im_tone_analyse( IMAGE *in, IMAGE *lut, int im_ismonotonic( IMAGE *lut, int *out ); int im_tone_map( IMAGE *in, IMAGE *out, IMAGE *lut ); int im_project( IMAGE *in, IMAGE *hout, IMAGE *vout ); -int im_mpercent( IMAGE *, double, int * ); +int im_mpercent( IMAGE *in, double percent, int *out ); #ifdef __cplusplus } diff --git a/libvips/include/vips/inplace.h b/libvips/include/vips/inplace.h index 56fa1aab..c5187195 100644 --- a/libvips/include/vips/inplace.h +++ b/libvips/include/vips/inplace.h @@ -37,17 +37,19 @@ extern "C" { #endif /*__cplusplus*/ -int im_plotmask( IMAGE *, int, int, PEL *, PEL *, Rect * ); -int im_smear( IMAGE *, int, int, Rect * ); -int im_smudge( IMAGE *, int, int, Rect * ); -int im_paintrect( IMAGE *, Rect *, PEL * ); -int im_circle( IMAGE *, int, int, int, int ); -int im_insertplace( IMAGE *, IMAGE *, int, int ); -int im_line( IMAGE *, int, int, int, int, int ); -int im_fastlineuser(); -int im_readpoint( IMAGE *, int, int, PEL * ); -int im_flood( IMAGE *, int, int, PEL *, Rect * ); -int im_flood_blob( IMAGE *, int, int, PEL *, Rect * ); +int im_plotmask( IMAGE *im, int ix, int iy, PEL *ink, PEL *mask, Rect *r ); +int im_smear( IMAGE *im, int ix, int iy, Rect *r ); +int im_smudge( IMAGE *im, int ix, int iy, Rect *r ); +int im_paintrect( IMAGE *im, Rect *r, PEL *ink ); +int im_circle( IMAGE *im, int cx, int cy, int radius, int intensity ); +int im_insertplace( IMAGE *big, IMAGE *small, int x, int y ); +int im_fastline( IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel ); +int im_fastlineuser( IMAGE *im, + int x1, int y1, int x2, int y2, + int (*fn)(), void *client1, void *client2, void *client3 ); +int im_readpoint( IMAGE *im, int x, int y, PEL *pel ); +int im_flood( IMAGE *im, int x, int y, PEL *ink, Rect *dout ); +int im_flood_blob( IMAGE *im, int x, int y, PEL *ink, Rect *dout ); int im_flood_blob_copy( IMAGE *in, IMAGE *out, int x, int y, PEL *ink ); int im_flood_other( IMAGE *mask, IMAGE *test, int x, int y, int serial ); int im_flood_other_copy( IMAGE *mask, IMAGE *test, IMAGE *out, diff --git a/libvips/inplace/Makefile.am b/libvips/inplace/Makefile.am index c55736e7..c7785bd4 100644 --- a/libvips/inplace/Makefile.am +++ b/libvips/inplace/Makefile.am @@ -5,7 +5,6 @@ libinplace_la_SOURCES = \ im_flood.c \ im_flood_other.c \ im_insertplace.c \ - im_line.c \ im_paintrect.c \ im_plotmask.c \ inplace_dispatch.c \ diff --git a/libvips/inplace/im_circle.c b/libvips/inplace/im_circle.c index eab4f5ce..2a68f90a 100644 --- a/libvips/inplace/im_circle.c +++ b/libvips/inplace/im_circle.c @@ -62,7 +62,7 @@ #endif /*WITH_DMALLOC*/ int -im_circle( IMAGE *im, int cx, int cy, int radius, int intensity) +im_circle( IMAGE *im, int cx, int cy, int radius, int intensity ) { PEL *start; int size = 0; diff --git a/libvips/inplace/inplace_dispatch.c b/libvips/inplace/inplace_dispatch.c index a43ece59..49b8cd1b 100644 --- a/libvips/inplace/inplace_dispatch.c +++ b/libvips/inplace/inplace_dispatch.c @@ -42,6 +42,18 @@ #include #endif /*WITH_DMALLOC*/ +/** + * SECTION: inplace + * @short_description: in-place paintbox operations: flood, paste, line, + * circle + * @stability: Stable + * @include: vips/vips.h + * + * These operations modify the input image. You can't easily use them in + * pipelines, but they are useful for paintbox-style programs. + * + */ + /* Args for im_circle. */ static im_arg_desc circle_args[] = { @@ -107,42 +119,6 @@ static im_function insertplace_desc = { insertplace_args /* Arg list */ }; -/* Args for im_line. - */ -static im_arg_desc line_args[] = { - IM_RW_IMAGE( "im" ), - IM_INPUT_INT( "x1" ), - IM_INPUT_INT( "y1" ), - IM_INPUT_INT( "x2" ), - IM_INPUT_INT( "y2" ), - IM_INPUT_INT( "pelval" ) -}; - -/* Call im_line via arg vector. - */ -static int -line_vec( im_object *argv ) -{ - int x1 = *((int *) argv[1]); - int y1 = *((int *) argv[2]); - int x2 = *((int *) argv[3]); - int y2 = *((int *) argv[4]); - int pel = *((int *) argv[5]); - - return( im_line( argv[0], x1, y1, x2, y2, pel ) ); -} - -/* Description of im_line. - */ -static im_function line_desc = { - "im_line", /* Name */ - "draw line between points (x1,y1) and (x2,y2)", - 0, /* Flags */ - line_vec, /* Dispatch function */ - IM_NUMBER( line_args ), /* Size of arg list */ - line_args /* Arg list */ -}; - /* Args for im_lineset. */ static im_arg_desc lineset_args[] = { @@ -396,7 +372,6 @@ static im_function *inplace_list[] = { &segment_desc, &insertplace_desc, &insertplaceset_desc, - &line_desc, &lineset_desc };