1WRAPPERS(3)                Library Functions Manual                WRAPPERS(3)
2
3
4

NAME

6       im_wrapone, im_wrapmany - easy interface to partial image IO system
7

SYNOPSIS

9       #include <vips/vips.h>
10       #include <vips/region.h>
11
12       int im_wrapone( IMAGE *in, IMAGE *out,
13           im_wrapone_fn fn, void *a, void *b )
14       int im_wrapmany( IMAGE **in, IMAGE *out,
15           im_wrapmany_fn fn, void *a, void *b )
16
17       where
18
19       typedef void (*im_wrapone_fn)( void *in, void *out, int n,
20           void *a, void *b )
21       typedef void (*im_wrapmany_fn)( void **in, void *out, int n,
22           void *a, void *b )
23
24

DESCRIPTION

26       These  functions  provide a simple way to use the VIPS partial image IO
27       system, provided that your image processing function involves no  coor‐
28       dinate transformations, that is, that each output PEL depends only upon
29       the corresponding PEL(s) in the input image(s).
30
31       You should write your operation as a buffer processing function --- for
32       example:
33
34           static void
35           invert_buffer( unsigned char *in, unsigned char *out,
36               int width )
37           {
38               int x;
39
40               for( x = 0; x < width; x++ )
41                   *out++ = 255 - *in++;
42           }
43
44       This can now be turned into a full PIO image processing function by:
45
46           int
47           invert( IMAGE *in, IMAGE *out )
48           {
49               if( in->BandFmt != FMTUCHAR ||
50                   in->Coding != NOCODING ||
51                   in->Bands != 1 ) {
52                   im_errormsg( "invert: bad input" );
53                   return( -1 );
54               }
55               if( im_cp_desc( out, in ) )
56                   return( -1 );
57               if( im_wrapone( in, out,
58                   (im_wrapone_fn) invert_buffer, NULL, NULL ) )
59               return( 0 );
60           }
61
62       im_wrapmany(3)  works  as  im_wrapone(3), but allows many input images.
63       All the inputs should be same Xsize and Ysize, but may  vary  in  type.
64       The   array   of   input  images  should  be  NULL-terminated,  as  for
65       im_start_many(3).
66
67       See the `VIPS Library Programmers' Guide' for more examples.
68
69

RETURN VALUE

71       All int-valued functions return zero on success and non-zero on error.
72
74       National Gallery, 1995
75

SEE ALSO

77       `VIPS Library Programmers' Guide,' in accompanying documentation.
78

AUTHOR

80       J. Cupitt - 9/2/95
81
82
83
84                                 11 April 1990                     WRAPPERS(3)
Impressum