|
XenevaOS
|

Macros | |
| #define | CLIP_MAX_RECTS 100 |
Functions | |
| bool | ClipValueInRange (int value, int min, int max) |
| void | clip_emit (Rect *list, int *n, int cap, int l, int t, int r, int b) |
| bool | ClipCheckIntersect (Rect *r1, Rect *r2) |
| Check if two rectangle intersects. | |
| void | ClipCalculateRect (Rect *sub_rect, Rect *cut_rect, Rect *list, int *count) |
| ClipCalculateRect – calculate visible rectanlges of current window. | |
| void | ClipSubtractRect (Rect *sub_rect, Rect *cut_rect, Rect *list, int r_count) |
| ClipSubtractRect – calculate visible rectanlges of current window. | |
| void | ClipGetBehindRect (Rect *sub_rect, Rect *cut_rect, Rect *list, int *r_count) |
| void | ClipSubtractRectList (Rect *inputList, int *inputCount, Rect *cut_rect) |
BSD 2-Clause License
Copyright (c) 2022-2026, Manas Kamal Choudhury All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| #define CLIP_MAX_RECTS 100 |
| void clip_emit | ( | Rect * | list, |
| int * | n, | ||
| int | cap, | ||
| int | l, | ||
| int | t, | ||
| int | r, | ||
| int | b | ||
| ) |
ClipCalculateRect – calculate visible rectanlges of current window.
| sub_rect | – subject rectangle |
| cut_rect | – cutting rectangle |
| list | – pointer to the list, where to store all visible rectangles |
| count | – number of rectangles stored in the list |
int r_count = *count;
Rect subcopy; subcopy.x = sub_rect->x; subcopy.y = sub_rect->y; subcopy.w = sub_rect->w; subcopy.h = sub_rect->h;
if (RectGetLeft(cut_rect) >= RectGetLeft(&subcopy) && RectGetLeft(cut_rect) <= RectGetRight(&subcopy)) { Rect r; memcpy(&r, &subcopy, sizeof(Rect)); int top = RectSetTop(&r, RectGetTop(&subcopy)); int left = RectSetLeft(&r, RectGetLeft(&subcopy)); int bottom = RectSetBottom(&r, RectGetBottom(&subcopy)); int right = RectSetRight(&r, RectGetLeft(cut_rect));
list[r_count].x = left; list[r_count].y = top; list[r_count].w = right - left; list[r_count].h = bottom - top; r_count++;
int n_l = RectSetLeft(&subcopy, RectGetLeft(cut_rect)); subcopy.x = n_l; }
if (RectGetTop(cut_rect) >= RectGetTop(&subcopy) && RectGetTop(cut_rect) <= RectGetBottom(&subcopy)) { Rect r; memcpy(&r, &subcopy, sizeof(Rect)); int top = RectSetTop(&r, RectGetTop(&subcopy)); int left = RectSetLeft(&r, RectGetLeft(&subcopy)); int bottom = RectSetBottom(&r, RectGetTop(cut_rect)); int right = RectSetRight(&r, RectGetRight(&subcopy));
list[r_count].x = left; list[r_count].y = top; list[r_count].w = right - left; list[r_count].h = bottom - top; r_count++; int n_t = RectSetTop(&subcopy, RectGetTop(cut_rect)); subcopy.y = n_t; }
if (RectGetRight(cut_rect) >= RectGetLeft(&subcopy) && RectGetRight(cut_rect) < RectGetRight(&subcopy)) { Rect r; memcpy(&r, &subcopy, sizeof(Rect)); int top = RectSetTop(&r, RectGetTop(&subcopy)); int left = RectSetLeft(&r, RectGetRight(cut_rect)); int bottom = RectSetBottom(&r, RectGetBottom(&subcopy)); int right = RectSetRight(&r, RectGetRight(&subcopy));
list[r_count].x = left; list[r_count].y = top; list[r_count].w = right - left; list[r_count].h = bottom - top; r_count++;
RectSetRight(&subcopy, RectGetRight(cut_rect)); }
if (RectGetBottom(cut_rect) >= RectGetTop(&subcopy) && RectGetBottom(cut_rect) <= RectGetBottom(&subcopy)) { Rect r; memcpy(&r, &subcopy, sizeof(Rect)); int top = RectSetTop(&r, RectGetBottom(cut_rect)); int left = RectSetLeft(&r, RectGetLeft(&subcopy)); int bottom = RectSetBottom(&r, RectGetBottom(&subcopy)); int right = RectSetRight(&r, RectGetRight(&subcopy));
list[r_count].x = left; list[r_count].y = top; list[r_count].w = right - left; list[r_count].h = bottom - top; r_count++; RectSetBottom(&subcopy, RectGetBottom(cut_rect)); }
count = r_count;
Check if two rectangle intersects.
| r1 | – rectangle one |
| r2 | – rectangle two |
ClipSubtractRect – calculate visible rectanlges of current window.
| sub_rect | – subject rectangle |
| cut_rect | – cutting rectangle |
| list | – pointer to the list, where to store all visible rectangles |
| count | – number of rectangles stored in the list |
| bool ClipValueInRange | ( | int | value, |
| int | min, | ||
| int | max | ||
| ) |