Poster of Linux kernelThe best gift for a Linux geek
MACROS

MACROS

Section: C Library Functions (3) Updated: 11 April 1990
Local index Up
 

NAME

IM_REGION_ADDR, IM_REGION_LSKIP, IM_REGION_N_ELEMENTS, IM_REGION_SIZEOF_LINE - macros for regions  

SYNOPSIS

#include <vips/vips.h>

int IM_REGION_LSKIP( reg )
REGION *reg;

int IM_REGION_N_ELEMENTS( reg )
REGION *reg;

int IM_REGION_SIZEOF_LINE( reg )
REGION *reg;

char *IM_REGION_ADDR( reg, x, y )
REGION *reg;
int x, y;

 

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.

 

COPYRIGHT

National Gallery, 1993  

SEE ALSO

IM_IMAGE_ADDR(3), im_malloc(3), im_open_local(3).  

AUTHOR

J. Cupitt - 23/7/93


 

Index

NAME
SYNOPSIS
DESCRIPTION
COPYRIGHT
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 21:48:25 GMT, April 16, 2011