80 lines
2.2 KiB
Groff
80 lines
2.2 KiB
Groff
|
.TH Rect 3 "2 May 1991"
|
||
|
.SH 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
|
||
|
.SH SYNOPSIS
|
||
|
#include <vips/vips.h>
|
||
|
|
||
|
typedef struct {
|
||
|
.br
|
||
|
int left, top, width, height;
|
||
|
.br
|
||
|
} Rect;
|
||
|
|
||
|
#define IM_RECT_RIGHT(R) ((R)->left + (R)->width)
|
||
|
.br
|
||
|
#define IM_RECT_BOTTOM(R) ((R)->top + (R)->height)
|
||
|
.br
|
||
|
#define IM_RECT_HCENTRE(R) ((R)->left + (R)->width / 2)
|
||
|
.br
|
||
|
#define IM_RECT_VCENTRE(R) ((R)->top + (R)->height / 2)
|
||
|
|
||
|
void im_rect_marginadjust( Rect *r, int n );
|
||
|
.br
|
||
|
int im_rect_includespoint( Rect *r, int x, int y );
|
||
|
.br
|
||
|
int im_rect_includesrect( Rect *r1, Rect *r2 );
|
||
|
.br
|
||
|
void im_rect_intersectrect( Rect *r1, Rect *r2, Rect *r3 );
|
||
|
.br
|
||
|
int im_rect_isempty( Rect *r );
|
||
|
.br
|
||
|
void im_rect_unionrect( Rect *r1, Rect *r2, Rect *r3 );
|
||
|
.br
|
||
|
int im_rect_equalsrect( Rect *r1, Rect *r2 );
|
||
|
.br
|
||
|
Rect *im_rect_dup( Rect *r );
|
||
|
.br
|
||
|
void im_rect_normalise( Rect *r );
|
||
|
.SH 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.
|
||
|
|
||
|
.SH SEE ALSO
|
||
|
im_prepare(3), im_region_create(3)
|
||
|
.SH COPYRIGHT
|
||
|
National Gallery, 1992
|
||
|
.SH AUTHOR
|
||
|
J. Cupitt
|