IM_REGION_ADDR, IM_REGION_LSKIP, IM_REGION_N_ELEMENTS,
IM_REGION_SIZEOF_LINE - macros for regions
int IM_REGION_LSKIP( reg )
int IM_REGION_N_ELEMENTS( reg )
int IM_REGION_SIZEOF_LINE( reg )
char *IM_REGION_ADDR( reg, x, y )
int x, y;
These macros help to simplify address arithmetic for regions.
returns the number of *bytes* you should add to move
down a scan line. Remember that if your pointer has been cast to the
type of the image pels, this will not be the correct amount to add! The
value lskip returns can be changed by a call to im_prepare(3).
IM_REGION_N_ELEMENTS(3) returns the number of band elements across the
IM_REGION_SIZEOF_LINE(3) returns sizeof( horizontal line across region
IM_REGION_ADDR(3) returns a pointer to the pixel at position (x,y) in
the image on which reg has been defined. The point (x,y) should lie
within the valid area for this region.
If the macro DEBUG has been defined, then IM_REGION_ADDR(3) will also
perform bounds checking. If you ask for the address of a pel outside
the rect reg->valid, then IM_REGION_ADDR(3) will print an error message
of the form:
IM_REGION_ADDR: point out of bounds, file "test.c", line 18
(point x=50, y=0
should have been within Rect left=0, top=0, width=50, height=50)
and call abort(3).
DEBUG needs to be defined *before* region.h is included. Either define
DEBUG with -D in your Makefile, or have a #define DEBUG right at the
top of your file.
National Gallery, 1993
IM_IMAGE_ADDR(3), im_malloc(3), im_open_local(3).
J. Cupitt - 23/7/93
11 April 1990 MACROS(3)