FreeBSD Manual Pages
AG_RECT(3) Library Functions Manual AG_RECT(3) NAME AG_Rect -- agar rectangle structure SYNOPSIS #include <agar/core.h> #include <agar/gui.h> DESCRIPTION Many functions in Agar accept AG_Rect parameters. This structure de- scribes a two-dimensional integer rectangle: typedef struct ag_rect { int x, y; int w, h; } AG_Rect; Normalized rectangles have non-negative w and h. Rectangles are seri- alized using signed 16-bit coordinates, and unsigned 16-bit sizes. The AG_Rect2 variant includes a redundant endpoint (or alternatively, a redundant size implied by the two endpoints). This uses more space, but allows for faster intersection tests: typedef struct ag_rect2 { int x1, y1; int w, h; int x2, y2; } AG_Rect2; INTERFACE void AG_RectInit(AG_Rect *rd, int x, int y, int w, int h) void AG_Rect2Init(AG_Rect2 *rd, int x, int y, int w, int h) void AG_ReadRect(AG_Rect *rd, AG_DataSource *ds) void AG_ReadRect2(AG_Rect2 *rd, AG_DataSource *ds) void AG_WriteRect(AG_DataSource *ds, const AG_Rect *r) void AG_WriteRect2(AG_DataSource *ds, const AG_Rect2 *r) void AG_Rect2ToRect(AG_Rect *rd, AG_Rect2 r) void AG_RectToRect2(AG_Rect2 *rd, AG_Rect *r) int AG_RectIntersect(AG_Rect *rd, const AG_Rect *a, const AG_Rect *b) int AG_RectIntersect2(AG_Rect2 *rd, const AG_Rect2 *a, const AG_Rect2 *b) int AG_RectInside(const AG_Rect *r, int x, int y) int AG_RectInside2(const AG_Rect2 *r, int x, int y) int AG_RectCompare(const AG_Rect *a, const AG_Rect *b) int AG_RectCompare2(const AG_Rect2 *a, const AG_Rect2 *b) void AG_RectSize(AG_Rect *r, int w, int h) void AG_RectSize2(AG_Rect2 *r, int w, int h) void AG_RectTranslate(AG_Rect *r, int x, int y) void AG_RectTranslate2(AG_Rect2 *r, int x, int y) AG_RectInit() initializes an AG_Rect to coordinates x, y and dimensions w, h. AG_Rect2Init() initializes an AG_Rect2 to coordinates and dimensions and implicitely computes the endpoint x2, y2. The AG_ReadRect() function loads a rectangle from the given AG_DataSource(3). AG_WriteRect() writes a rectangle to a data source. AG_RectToRect2() and AG_Rect2ToRect() convert between the AG_Rect and AG_Rect2 formats. AG_RectIntersect() and AG_RectIntersect2() return intersection of rec- tangles a and b. AG_RectInside() and AG_RectInside2() return 1 if the point x, y lies inside of rectangle r. AG_RectCompare() and AG_RectCompare2() return 0 if both rectangles pos- sess the same coordinates and dimensions. AG_RectSize() and AG_RectSize2() resize a rectangle to the specified dimensions. AG_RectTranslate() and AG_RectTranslate2() translate a rectangle by the specified amount. SEE ALSO AG_Intro(3), AG_Widget(3) HISTORY The AG_Rect structure first appeared in Agar 1.3.4. Agar 1.7 December 21, 2022 AG_RECT(3)
NAME | SYNOPSIS | DESCRIPTION | INTERFACE | SEE ALSO | HISTORY
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=AG_Rect&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>
