SYNOPSIS
|
DESCRIPTION
Many functions in Agar accept
AG_Rect parameters.
This structure describes a two-dimensional integer rectangle:
Normalized rectangles have non-negative w and h. Rectangles are serialized 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:
|
INTERFACE
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 rectangles 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 possess 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. |