NAME
im_rect_marginadjust, im_rect_includespoint, im_rect_includesrect,
im_rect_intersectrect, im_rect_isempty, im_rect_unionrect,
im_rect_normalise, im_rect_equalsrect, im_rect_dup, IM_RECT_RIGHT,
IM_RECT_BOTTOM, IM_RECT_HCENTRE, IM_RECT_VCENTRE - rectangle algebra
functions
SYNOPSIS
#include <vips/vips.h>
typedef struct {
int left, top, width, height;
} Rect;
#define IM_RECT_RIGHT(R) ((R)->left + (R)->width)
#define IM_RECT_BOTTOM(R) ((R)->top + (R)->height)
#define IM_RECT_HCENTRE(R) ((R)->left + (R)->width / 2)
#define IM_RECT_VCENTRE(R) ((R)->top + (R)->height / 2)
void im_rect_marginadjust( Rect *r, int n );
int im_rect_includespoint( Rect *r, int x, int y );
int im_rect_includesrect( Rect *r1, Rect *r2 );
void im_rect_intersectrect( Rect *r1, Rect *r2, Rect *r3 );
int im_rect_isempty( Rect *r );
void im_rect_unionrect( Rect *r1, Rect *r2, Rect *r3 );
int im_rect_equalsrect( Rect *r1, Rect *r2 );
Rect *im_rect_dup( Rect *r );
void im_rect_normalise( Rect *r );
DESCRIPTION
These functions perform simple algebra on Rect structs. There should
also be a set of functions to do rectlist algebra.
im_rect_marginadjust(3) expands a Rect by n units up, down, left and
right. Negative expansions shrink the Rect.
im_rect_includespoint(3) returns non-zero if point (x,y) lies within
Rect r.
im_rect_includesrect(3) returns non-zero if Rect r2 lies completely
within Rect r1.
im_rect_intersectrect(3) fills Rect r3 with the intersection of Rects
r1 and r2.
im_rect_isempty(3) returns non-zero if Rect r has either width less
than or equal to 0 or height less than or equal to 0.
im_rect_unionrect(3) fills Rect r3 with the bounding box of Rect r1 and
Rect r2. A proper union operation requires lists of rectangles, sadly.
im_rect_equalsrect(3) returns non-zero if r1 and r2 are identical.
im_rect_dup(3) allocates memory for a new Rect structure and copies the
elements of r into it. It returns a pointer to the new struct, or NULL
on error.
im_rect_normalise(3) flips r so that the same pixels are enclosed, but
width and height are guaranteed >=0.
SEE ALSO
im_prepare(3), im_region_create(3)
COPYRIGHT
National Gallery, 1992
AUTHOR
J. Cupitt
2 May 1991 Rect(3)