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

NAME

6       im_rect_marginadjust,    im_rect_includespoint,   im_rect_includesrect,
7       im_rect_intersectrect, im_rect_isempty, im_rect_unionrect, im_rect_nor‐
8       malise, im_rect_equalsrect, im_rect_dup, IM_RECT_RIGHT, IM_RECT_BOTTOM,
9       IM_RECT_HCENTRE, IM_RECT_VCENTRE - rectangle algebra functions
10

SYNOPSIS

12       #include <vips/vips.h>
13       #include <vips/rect.h>
14
15       typedef struct {
16            int left, top, width, height;
17       } Rect;
18
19       #define IM_RECT_RIGHT(R) ((R)->left + (R)->width)
20       #define IM_RECT_BOTTOM(R) ((R)->top + (R)->height)
21       #define IM_RECT_HCENTRE(R) ((R)->left + (R)->width / 2)
22       #define IM_RECT_VCENTRE(R) ((R)->top + (R)->height / 2)
23
24       void im_rect_marginadjust( Rect *r, int n );
25       int im_rect_includespoint( Rect *r, int x, int y );
26       int im_rect_includesrect( Rect *r1, Rect *r2 );
27       void im_rect_intersectrect( Rect *r1, Rect *r2, Rect *r3 );
28       int im_rect_isempty( Rect *r );
29       void im_rect_unionrect( Rect *r1, Rect *r2, Rect *r3 );
30       int im_rect_equalsrect( Rect *r1, Rect *r2 );
31       Rect *im_rect_dup( Rect *r );
32       void im_rect_normalise( Rect *r );
33

DESCRIPTION

35       These functions perform simple algebra on Rect  structs.  There  should
36       also be a set of functions to do rectlist algebra.
37
38       im_rect_marginadjust(3)  expands  a  Rect by n units up, down, left and
39       right.  Negative expansions shrink the Rect.
40
41       im_rect_includespoint(3) returns non-zero if point  (x,y)  lies  within
42       Rect r.
43
44       im_rect_includesrect(3)  returns  non-zero  if  Rect r2 lies completely
45       within Rect r1.
46
47       im_rect_intersectrect(3) fills Rect r3 with the intersection  of  Rects
48       r1 and r2.
49
50       im_rect_isempty(3)  returns  non-zero  if  Rect r has either width less
51       than or equal to 0 or height less than or equal to 0.
52
53       im_rect_unionrect(3) fills Rect r3 with the bounding box of Rect r1 and
54       Rect r2. A proper union operation requires lists of rectangles, sadly.
55
56       im_rect_equalsrect(3) returns non-zero if r1 and r2 are identical.
57
58       im_rect_dup(3) allocates memory for a new Rect structure and copies the
59       elements of r into it. It returns a pointer to the new struct, or  NULL
60       on error.
61
62       im_rect_normalise(3)  flips r so that the same pixels are enclosed, but
63       width and height are guaranteed >=0.
64
65

SEE ALSO

67       im_prepare(3), im_region_create(3)
68
70       National Gallery, 1992
71

AUTHOR

73       J. Cupitt
74
75
76
77                                  2 May 1991                           Rect(3)
Impressum