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

NAME

6       IM_REGION_ADDR,          IM_REGION_LSKIP,         IM_REGION_N_ELEMENTS,
7       IM_REGION_SIZEOF_LINE - macros for regions
8

SYNOPSIS

10       #include <vips/vips.h>
11       #include <vips/region.h>
12
13       int IM_REGION_LSKIP( reg )
14       REGION *reg;
15
16       int IM_REGION_N_ELEMENTS( reg )
17       REGION *reg;
18
19       int IM_REGION_SIZEOF_LINE( reg )
20       REGION *reg;
21
22       char *IM_REGION_ADDR( reg, x, y )
23       REGION *reg;
24       int x, y;
25
26

DESCRIPTION

28       These macros help to simplify address arithmetic for regions.
29
30       IM_REGION_LSKIP(3) returns the number of *bytes* you should add to move
31       down  a  scan line.  Remember that if your pointer has been cast to the
32       type of the image pels, this will not be the correct amount to add! The
33       value lskip returns can be changed by a call to im_prepare(3).
34
35       IM_REGION_N_ELEMENTS(3)  returns the number of band elements across the
36       region.
37
38       IM_REGION_SIZEOF_LINE(3) returns sizeof( horizontal line across  region
39       ).
40
41       IM_REGION_ADDR(3)  returns  a pointer to the pixel at position (x,y) in
42       the image on which reg has been defined. The  point  (x,y)  should  lie
43       within the valid area for this region.
44
45       If  the  macro DEBUG has been defined, then IM_REGION_ADDR(3) will also
46       perform bounds checking. If you ask for the address of  a  pel  outside
47       the rect reg->valid, then IM_REGION_ADDR(3) will print an error message
48       of the form:
49
50           IM_REGION_ADDR: point out of bounds, file "test.c", line 18
51           (point x=50, y=0
52            should have been within Rect left=0, top=0, width=50, height=50)
53
54       and call abort(3).
55
56       DEBUG needs to be defined *before* region.h is included. Either  define
57       DEBUG  with  -D  in your Makefile, or have a #define DEBUG right at the
58       top of your file.
59
60
62       National Gallery, 1993
63

SEE ALSO

65       im_malloc(3), im_open_local(3), `VIPS Library  Programmers'  Guide'  in
66       accompanying documentation.
67

AUTHOR

69       J. Cupitt - 23/7/93
70
71
72
73                                 11 April 1990                       MACROS(3)
Impressum