GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
AG_RECT(3) FreeBSD Library Functions Manual AG_RECT(3)

AG_Rectagar rectangle structure

#include <agar/core.h>
#include <agar/gui.h>

Many functions in Agar accept AG_Rect parameters. This structure describes 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 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:

typedef struct ag_rect2 {
	int x1, y1;
	int w, h;
	int x2, y2;
} AG_Rect2;

void
(AG_Rect *rd, int x, int y, int w, int h);


void
(AG_Rect2 *rd, int x, int y, int w, int h);


void
(AG_Rect *rd, AG_DataSource *ds);


void
(AG_Rect2 *rd, AG_DataSource *ds);


void
(AG_DataSource *ds, const AG_Rect *r);


void
(AG_DataSource *ds, const AG_Rect2 *r);


void
(AG_Rect *rd, AG_Rect2 r);


void
(AG_Rect2 *rd, AG_Rect *r);


int
(AG_Rect *rd, const AG_Rect *a, const AG_Rect *b);


int
(AG_Rect2 *rd, const AG_Rect2 *a, const AG_Rect2 *b);


int
(const AG_Rect *r, int x, int y);


int
(const AG_Rect2 *r, int x, int y);


int
(const AG_Rect *a, const AG_Rect *b);


int
(const AG_Rect2 *a, const AG_Rect2 *b);


void
(AG_Rect *r, int w, int h);


void
(AG_Rect2 *r, int w, int h);


void
(AG_Rect *r, int x, int y);


void
(AG_Rect2 *r, int x, int y);

() initializes an AG_Rect to coordinates x, y and dimensions w, h.

() initializes an AG_Rect2 to coordinates and dimensions and implicitely computes the endpoint x2, y2.

The () function loads a rectangle from the given AG_DataSource(3). AG_WriteRect() writes a rectangle to a data source.

() and AG_Rect2ToRect() convert between the AG_Rect and AG_Rect2 formats.

() and AG_RectIntersect2() return intersection of rectangles a and b.

() and AG_RectInside2() return 1 if the point x, y lies inside of rectangle r.

() and AG_RectCompare2() return 0 if both rectangles possess the same coordinates and dimensions.

() and AG_RectSize2() resize a rectangle to the specified dimensions.

() and AG_RectTranslate2() translate a rectangle by the specified amount.

AG_Intro(3), AG_Widget(3)

The AG_Rect structure first appeared in Agar 1.3.4.

December 21, 2022 Agar 1.7

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.