blob: b1bf406bf1f689951576b28a0a20f653091c829f [file] [log] [blame]
.TH MACROS 3 "11 April 1990"
.SH NAME
IM_REGION_ADDR,
IM_REGION_LSKIP,
IM_REGION_N_ELEMENTS, IM_REGION_SIZEOF_LINE \-
macros for regions
.SH SYNOPSIS
.B #include <vips/vips.h>
int IM_REGION_LSKIP( reg )
.br
REGION *reg;
int IM_REGION_N_ELEMENTS( reg )
.br
REGION *reg;
int IM_REGION_SIZEOF_LINE( reg )
.br
REGION *reg;
char *IM_REGION_ADDR( reg, x, y )
.br
REGION *reg;
.br
int x, y;
.SH DESCRIPTION
These macros help to simplify address arithmetic for regions.
IM_REGION_LSKIP(3) 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 region.
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.
.SH COPYRIGHT
National Gallery, 1993
.SH SEE ALSO
IM_IMAGE_ADDR(3), im_malloc(3), im_open_local(3).
.SH AUTHOR
J. Cupitt \- 23/7/93