Rectangle
[Tools]
These functions provide rectangle management.
More...Data Structures | |
| struct | _Eina_Rectangle |
Defines | |
| #define | EINA_RECTANGLE_SET(Rectangle, X, Y, W, H) |
| Macro to set the values of a Eina_Rectangle. | |
Typedefs | |
| typedef struct _Eina_Rectangle | Eina_Rectangle |
| Simple rectangle structure. | |
| typedef struct _Eina_Rectangle_Pool | Eina_Rectangle_Pool |
| Type for an opaque pool of rectangle. | |
Functions | |
| static int | eina_spans_intersect (int c1, int l1, int c2, int l2) |
| Check if the given spans intersect. | |
| static Eina_Bool | eina_rectangle_is_empty (const Eina_Rectangle *r) |
| Check if the given rectangle is empty. | |
| static void | eina_rectangle_coords_from (Eina_Rectangle *r, int x, int y, int w, int h) |
| Set the coordinates and size of the given rectangle. | |
| static Eina_Bool | eina_rectangles_intersect (const Eina_Rectangle *r1, const Eina_Rectangle *r2) |
| Check if the given rectangles intersect. | |
| static Eina_Bool | eina_rectangle_xcoord_inside (const Eina_Rectangle *r, int x) |
| Check if the given x-coordinate is in the rectangle . | |
| static Eina_Bool | eina_rectangle_ycoord_inside (const Eina_Rectangle *r, int y) |
| Check if the given y-coordinate is in the rectangle . | |
| static Eina_Bool | eina_rectangle_coords_inside (const Eina_Rectangle *r, int x, int y) |
| Check if the given point is in the rectangle . | |
| static void | eina_rectangle_union (Eina_Rectangle *dst, const Eina_Rectangle *src) |
| Get the union of two rectangles. | |
| static Eina_Bool | eina_rectangle_intersection (Eina_Rectangle *dst, const Eina_Rectangle *src) |
| Get the intersection of two rectangles. | |
| static void | eina_rectangle_rescale_in (const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) |
| static void | eina_rectangle_rescale_out (const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) |
| static void static void EAPI Eina_Rectangle_Pool * | eina_rectangle_pool_new (int w, int h) |
| Add a rectangle in a new pool. | |
| EAPI Eina_Rectangle_Pool * | eina_rectangle_pool_get (Eina_Rectangle *rect) |
| Return the pool of the given rectangle. | |
| EAPI Eina_Bool | eina_rectangle_pool_geometry_get (Eina_Rectangle_Pool *pool, int *w, int *h) |
| Return the width and height of the given pool. | |
| EAPI void * | eina_rectangle_pool_data_get (Eina_Rectangle_Pool *pool) |
| Get the data from the given pool. | |
| EAPI void | eina_rectangle_pool_data_set (Eina_Rectangle_Pool *pool, const void *data) |
| Set the data to the given pool. | |
| EAPI void | eina_rectangle_pool_free (Eina_Rectangle_Pool *pool) |
| Free the given pool. | |
| EAPI int | eina_rectangle_pool_count (Eina_Rectangle_Pool *pool) |
| Return the number of rectangles in the given pool. | |
| EAPI Eina_Rectangle * | eina_rectangle_pool_request (Eina_Rectangle_Pool *pool, int w, int h) |
| Request a rectangle of given size in the given pool. | |
| EAPI void | eina_rectangle_pool_release (Eina_Rectangle *rect) |
| Remove the given rectangle from the pool. | |
| EAPI Eina_Rectangle * | eina_rectangle_new (int x, int y, int w, int h) |
| Create a new rectangle. | |
| EAPI void | eina_rectangle_free (Eina_Rectangle *rect) |
| Free the given rectangle. | |
Variables | |
| static Eina_Bool | EINA_WARN_UNUSED_RESULT |
Detailed Description
These functions provide rectangle management.
Define Documentation
| #define EINA_RECTANGLE_SET | ( | Rectangle, | |||
| X, | |||||
| Y, | |||||
| W, | |||||
| H | ) |
Value:
(Rectangle)->x = X; \
(Rectangle)->y = Y; \
(Rectangle)->w = W; \
(Rectangle)->h = H;
- Parameters:
-
Rectangle The rectangle to set the values. X The X coordinate of the top left corner of the rectangle. Y The Y coordinate of the top left corner of the rectangle. W The width of the rectangle. H The height of the rectangle.
Rectangle. (X, Y) is the coordinates of the top left corner of Rectangle, W is its width and H is its height.
Function Documentation
| static int eina_spans_intersect | ( | int | c1, | |
| int | l1, | |||
| int | c2, | |||
| int | l2 | |||
| ) | [inline, static] |
Check if the given spans intersect.
- Parameters:
-
c1 The column of the first span. l1 The length of the first span. c2 The column of the second span. l2 The length of the second span.
- Returns:
- EINA_TRUE on success, EINA_FALSE otherwise.
| static Eina_Bool eina_rectangle_is_empty | ( | const Eina_Rectangle * | r | ) | [inline, static] |
Check if the given rectangle is empty.
- Parameters:
-
r The rectangle to check.
- Returns:
- EINA_TRUE if the rectangle is empty, EINA_FALSE otherwise.
r is empty, EINA_FALSE otherwise. No check is done on r, so it must be a valid rectangle.
| static void eina_rectangle_coords_from | ( | Eina_Rectangle * | r, | |
| int | x, | |||
| int | y, | |||
| int | w, | |||
| int | h | |||
| ) | [inline, static] |
Set the coordinates and size of the given rectangle.
- Parameters:
-
r The rectangle. x The top-left x coordinate of the rectangle. y The top-left y coordinate of the rectangle. w The width of the rectangle. h The height of the rectangle.
x, its top-left y coordinate to y, its width to w and its height to h. No check is done on r, so it must be a valid rectangle.
| static Eina_Bool eina_rectangles_intersect | ( | const Eina_Rectangle * | r1, | |
| const Eina_Rectangle * | r2 | |||
| ) | [inline, static] |
Check if the given rectangles intersect.
- Parameters:
-
r1 The first rectangle. r2 The second rectangle.
- Returns:
- EINA_TRUE if the rectangles intersect, EINA_FALSE otherwise.
r1 and r2 intersect, EINA_FALSE otherwise. No check is done on r1 and r2, so they must be valid rectangles.
| static Eina_Bool eina_rectangle_xcoord_inside | ( | const Eina_Rectangle * | r, | |
| int | x | |||
| ) | [inline, static] |
Check if the given x-coordinate is in the rectangle .
- Parameters:
-
r The rectangle. x The x coordinate.
- Returns:
- EINA_TRUE on success, EINA_FALSE otherwise.
x is in r with respect to the horizontal direction, EINA_FALSE otherwise. No check is done on r, so it must be a valid rectangle.
| static Eina_Bool eina_rectangle_ycoord_inside | ( | const Eina_Rectangle * | r, | |
| int | y | |||
| ) | [inline, static] |
Check if the given y-coordinate is in the rectangle .
- Parameters:
-
r The rectangle. y The y coordinate.
- Returns:
- EINA_TRUE on success, EINA_FALSE otherwise.
y is in r with respect to the vertical direction, EINA_FALSE otherwise. No check is done on r, so it must be a valid rectangle.
| static Eina_Bool eina_rectangle_coords_inside | ( | const Eina_Rectangle * | r, | |
| int | x, | |||
| int | y | |||
| ) | [inline, static] |
Check if the given point is in the rectangle .
- Parameters:
-
r The rectangle. x The x coordinate of the point. y The y coordinate of the point.
- Returns:
- EINA_TRUE on success, EINA_FALSE otherwise.
x, y) is in r, EINA_FALSE otherwise. No check is done on r, so it must be a valid rectangle.
| static void eina_rectangle_union | ( | Eina_Rectangle * | dst, | |
| const Eina_Rectangle * | src | |||
| ) | [inline, static] |
Get the union of two rectangles.
- Parameters:
-
dst The first rectangle. src The second rectangle.
dst and src. The result is stored in dst. No check is done on dst or src, so they must be valid rectangles.
| static void static Eina_Bool eina_rectangle_intersection | ( | Eina_Rectangle * | dst, | |
| const Eina_Rectangle * | src | |||
| ) | [inline, static] |
Get the intersection of two rectangles.
- Parameters:
-
dst The first rectangle. src The second rectangle.
- Returns:
- EINA_TRUE if the rectangles intersect, EINA_FALSE otherwise.
dst and src. The result is stored in dst. No check is done on dst or src, so they must be valid rectangles.
| EAPI Eina_Rectangle_Pool * eina_rectangle_pool_new | ( | int | w, | |
| int | h | |||
| ) |
Add a rectangle in a new pool.
- Parameters:
-
w The width of the rectangle. h The height of the rectangle.
- Returns:
- A newly allocated pool on success,
NULLotherwise.
width, height) to a new pool. If the pool can not be created, NULL is returned. Otherwise the newly allocated pool is returned.
| EAPI Eina_Rectangle_Pool * eina_rectangle_pool_get | ( | Eina_Rectangle * | rect | ) |
Return the pool of the given rectangle.
- Parameters:
-
rect The rectangle.
- Returns:
- The pool of the given rectangle.
rect is. If rect is NULL, NULL is returned.
| EAPI Eina_Bool eina_rectangle_pool_geometry_get | ( | Eina_Rectangle_Pool * | pool, | |
| int * | w, | |||
| int * | h | |||
| ) |
Return the width and height of the given pool.
- Parameters:
-
pool The pool. w The returned width. h The returned height.
- Returns:
- EINA_TRUE on success, EINA_FALSE otherwise.
pool and store them in respectively w and h if they are not NULL. If pool is NULL, EINA_FALSE is returned. Otherwise EINA_TRUE is returned.
| EAPI void * eina_rectangle_pool_data_get | ( | Eina_Rectangle_Pool * | pool | ) |
Get the data from the given pool.
- Parameters:
-
pool The pool.
- Returns:
- The returned data.
pool set by eina_rectangle_pool_data_set(). If pool is NULL, this function returns NULL.
| EAPI void eina_rectangle_pool_data_set | ( | Eina_Rectangle_Pool * | pool, | |
| const void * | data | |||
| ) |
Set the data to the given pool.
- Parameters:
-
pool The pool. data The data to set.
data to pool. If pool is NULL, this function does nothing.
| EAPI void eina_rectangle_pool_free | ( | Eina_Rectangle_Pool * | pool | ) |
Free the given pool.
- Parameters:
-
pool The pool to free.
pool. If pool is NULL, ths function returned immediately.
| EAPI int eina_rectangle_pool_count | ( | Eina_Rectangle_Pool * | pool | ) |
Return the number of rectangles in the given pool.
- Parameters:
-
pool The pool.
- Returns:
- The number of rectangles in the pool.
pool.
| EAPI Eina_Rectangle * eina_rectangle_pool_request | ( | Eina_Rectangle_Pool * | pool, | |
| int | w, | |||
| int | h | |||
| ) |
Request a rectangle of given size in the given pool.
- Parameters:
-
pool The pool. w The width of the rectangle to request. h The height of the rectangle to request.
- Returns:
- The requested rectangle on success,
NULLotherwise.
pool the rectangle of width w and height h. If pool is NULL, or w or h are non-positive, the function returns NULL. If w or h are greater than the pool size, the function returns NULL. On success, the function returns the rectangle which matches the size (w, h). Otherwise it returns NULL.
| EAPI void eina_rectangle_pool_release | ( | Eina_Rectangle * | rect | ) |
Remove the given rectangle from the pool.
- Parameters:
-
rect The rectangle to remove from the pool.
rect from the pool. If rect is NULL, the function returns immediately. Otherwise it remoes rect from the pool.
| EAPI Eina_Rectangle * eina_rectangle_new | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h | |||
| ) |
Create a new rectangle.
- Parameters:
-
x The X coordinate of the top left corner of the rectangle. y The Y coordinate of the top left corner of the rectangle. w The width of the rectangle. h The height of the rectangle.
- Returns:
- The new rectangle on success, @ NULL otherwise.
x, y), with height w and height h and adds it to the rectangles pool. No check is done on w and h. This function returns a new rectangle on success, NULL otherwhise.
| EAPI void eina_rectangle_free | ( | Eina_Rectangle * | rect | ) |
Free the given rectangle.
- Parameters:
-
rect The rectangle to free.
rect from the rectangles pool.
