![]() |
![]() |
![]() |
VIPS Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <vips/vips.h> VipsRect; #define VIPS_RECT_RIGHT (R) #define VIPS_RECT_BOTTOM (R) #define VIPS_RECT_HCENTRE (R) #define VIPS_RECT_VCENTRE (R) gboolean vips_rect_isempty (const VipsRect *r
); gboolean vips_rect_includespoint (const VipsRect *r
,int x
,int y
); gboolean vips_rect_includesrect (const VipsRect *r1
,const VipsRect *r2
); gboolean vips_rect_equalsrect (const VipsRect *r1
,const VipsRect *r2
); void vips_rect_marginadjust (VipsRect *r
,int n
); void vips_rect_intersectrect (const VipsRect *r1
,const VipsRect *r2
,VipsRect *out
); void vips_rect_unionrect (const VipsRect *r1
,const VipsRect *r2
,VipsRect *out
); VipsRect * vips_rect_dup (const VipsRect *r
); void vips_rect_normalise (VipsRect *r
);
typedef struct { int left; int top; int width; int height; } VipsRect;
A VipsRect is a rectangular area of pixels. This is a struct for performing simple rectangle algebra.
gboolean vips_rect_isempty (const VipsRect *r
);
Is r
empty? ie. zero width or height.
|
rectangle to test |
Returns : |
TRUE if r contains no pixels. |
gboolean vips_rect_includespoint (const VipsRect *r
,int x
,int y
);
Does r
contain point (x
, y
)?
|
rectangle to test |
|
position to test for |
|
position to test for |
Returns : |
TRUE if r contains (x , y ). |
gboolean vips_rect_includesrect (const VipsRect *r1
,const VipsRect *r2
);
Is r2
a subset of r1
?
|
outer rectangle |
|
inner rectangle |
Returns : |
TRUE if r2 is a subset of r1 . |
gboolean vips_rect_equalsrect (const VipsRect *r1
,const VipsRect *r2
);
Is r1
equal to r2
?
|
first rectangle |
|
second rectangle |
Returns : |
TRUE if r1 is equal to r2 . |
void vips_rect_marginadjust (VipsRect *r
,int n
);
Enlarge r
by n
. +1 means out one pixel.
|
rectangle to adjust |
|
enlarge by |
void vips_rect_intersectrect (const VipsRect *r1
,const VipsRect *r2
,VipsRect *out
);
Fill out
with the intersection of r1
and r2
. out
can equal r1
or r2
.
|
input rectangle 1 |
|
input rectangle 2 |
|
output rectangle |
void vips_rect_unionrect (const VipsRect *r1
,const VipsRect *r2
,VipsRect *out
);
Fill out
with the bounding box of r1
and r2
. out
can equal r1
or r2
.
|
input rectangle 1 |
|
input rectangle 2 |
|
output rectangle |
VipsRect * vips_rect_dup (const VipsRect *r
);
Duplicate a rect to the heap. You need to free the result with vips_free()
.
|
rectangle to duplicate |
Returns : |
a pointer to copy of r allocated on the heap. |
void vips_rect_normalise (VipsRect *r
);
Make sure width and height are >0 by moving the origin and flipping the rect.
|
rect to normalise |