Macros | |
#define | RECT_BLOCK 128 |
#define | STASH(t) |
Functions | |
void | VRect_Delete (vrect_t *rect) |
Free one rectangle. More... | |
vrect_t * | VRect_Difference (const vrect_t *r, const vrect_t *s) |
Return up to four rectangles representing the result of carving rectangle s out of rectangle r. More... | |
vrect_t * | VRect_HSplit (const vrect_t *r, int y) |
Return two rectangles representing the portions of r above and below y. More... | |
vrect_t * | VRect_Intersect (const vrect_t *r1, const vrect_t *r2) |
Return a rectangle representing the intersection of r1 and r2. More... | |
vrect_t * | VRect_Merge (const vrect_t *r1, const vrect_t *r2) |
Return the rectangle representing the merge of the two given rectangles. More... | |
vrect_t * | VRect_New (int x, int y, int width, int height) |
Create a new rectangle of the specified shape. More... | |
vrect_t * | VRect_Union (const vrect_t *r1, const vrect_t *r2) |
Return the union of the two rectangles. More... | |
vrect_t * | VRect_VSplit (const vrect_t *r, int x) |
Return two rectangles representing the portions of r to the left and right of y. More... | |
#define RECT_BLOCK 128 |
#define STASH | ( | t | ) |
void VRect_Delete | ( | vrect_t * | rect | ) |
Free one rectangle.
This function will not free any other rectangles linked to the specified rectangle.
rect | The rectangle to be freed. |
Return up to four rectangles representing the result of carving rectangle s out of rectangle r.
None of the returned rectangles will be empty. If the difference is empty, null will be returned.
r | The rectangle to be carved. |
s | The rectangle used to carve r. |
Return two rectangles representing the portions of r above and below y.
One of the returned rectangles may be empty. Use VRect_IsEmpty to check. The first rectangle represents the portion of r that is above y, and the second rectangle repesents the portion of r that is below y. The second rectangle is linked to the first via the first's vrect_t::next pointer.
r | The rectangle to split. |
y | The horizontal line by which r will be split. |
Return a rectangle representing the intersection of r1 and r2.
The returned rectangle may be empty. Use VRect_IsEmpty to check.
r1 | The first rectangle. |
r2 | The second rectangle. |
Return the rectangle representing the merge of the two given rectangles.
If the two given rectangles cannot be perfectly joined (either they intesect or subtracting them from the merged rectangle would result in scrap rectangles, null will be returned. Two empty rectangles will result in null being returned, but only one empty rectangle will result in a copy of the non-empty rectangle.
r1 | The first rectangle to be merged. |
r2 | The second rectangle to be merged. |
Create a new rectangle of the specified shape.
Other VRect functions will return a rectangle (or chain of rectangles) created by this function.
x | The X coordinate of the top-left corner. |
y | The Y coordinate of the top-left corner. |
width | The width of the rectangle. |
height | The height of the rectangle. |
Return the union of the two rectangles.
The union rectangle will be big enough to entirely contain both r1 and r2. An empty rectangle will be returned if both rectangles are empty.
r1 | The first rectangle. |
r2 | The second rectangle. |
Return two rectangles representing the portions of r to the left and right of y.
One of the returned rectangles may be empty. Use VRect_IsEmpty to check. The first rectangle represents the portion of r that is to the left of y, and the second rectangle repesents the portion of r that is to the right of y. The second rectangle is linked to the first via the first's vrect_t::next pointer.
r | The rectangle to split. |
x | The vertical line by which r will be split. |