Tizen Native API
5.5
|
These functions provide rectangle management.
Functions | |
static int | eina_spans_intersect (int c1, int l1, int c2, int l2) |
Checks if the given spans intersect. | |
static Eina_Bool | eina_rectangle_is_empty (const Eina_Rectangle *rect) |
Checks if the given rectangle is empty. | |
static void | eina_rectangle_coords_from (Eina_Rectangle *rect, int x, int y, int w, int h) |
Sets the coordinates and size of a rectangle. | |
static Eina_Bool | eina_rectangles_intersect (const Eina_Rectangle *rect1, const Eina_Rectangle *rect2) |
Checks if two rectangles intersect. | |
static Eina_Bool | eina_rectangle_xcoord_inside (const Eina_Rectangle *rect, int x) |
Checks if the given X-coordinate is in the rectangle. | |
static Eina_Bool | eina_rectangle_ycoord_inside (const Eina_Rectangle *rect, int y) |
Checks if the given Y-coordinate is in the rectangle. | |
static Eina_Bool | eina_rectangle_coords_inside (const Eina_Rectangle *rect, int x, int y) |
Checks if the given point is inside the rectangle. | |
static void | eina_rectangle_union (Eina_Rectangle *dst, const Eina_Rectangle *src) |
Gets the union of two rectangles. | |
static Eina_Bool | eina_rectangle_intersection (Eina_Rectangle *dst, const Eina_Rectangle *src) |
Gets the intersection of two rectangles. | |
static void | eina_rectangle_rescale_in (const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) |
FIXME I am useless and used by no one. | |
static void | eina_rectangle_rescale_out (const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) |
FIXME I am useless and used by no one. | |
static Eina_Bool | eina_rectangle_is_valid (const Eina_Rectangle *rect) |
Tells whether a rectangle is valid. | |
static int | eina_rectangle_max_x (Eina_Rectangle *rect) |
Gets the rectangle's maximum X coordinate. | |
static int | eina_rectangle_max_y (Eina_Rectangle *rect) |
Gets the rectangle maximum Y coordinate. | |
static Eina_Bool | eina_rectangle_x_cut (Eina_Rectangle *rect, Eina_Rectangle *slice, Eina_Rectangle *remainder, int amount) |
Slices a rectangle vertically into two subrectangles. | |
static Eina_Bool | eina_rectangle_y_cut (Eina_Rectangle *rect, Eina_Rectangle *slice, Eina_Rectangle *remainder, int amount) |
Slices a rectangle horizontally into two subrectangles. | |
static Eina_Bool | eina_rectangle_width_cut (Eina_Rectangle *rect, Eina_Rectangle *slice, Eina_Rectangle *remainder, int amount) |
Slices a rectangle vertically starting from right edge. | |
static Eina_Bool | eina_rectangle_height_cut (Eina_Rectangle *rect, Eina_Rectangle *slice, Eina_Rectangle *remainder, int amount) |
Slices a rectangle horizontally starting from top edge. | |
static Eina_Bool | eina_rectangle_subtract (Eina_Rectangle *rect, Eina_Rectangle *other, Eina_Rectangle out[4]) |
Subtracts two rectangles and returns the differences. | |
Eina_Rectangle_Pool * | eina_rectangle_pool_new (int w, int h) |
Adds a rectangle in a new pool. | |
Eina_Rectangle_Pool * | eina_rectangle_pool_get (Eina_Rectangle *rect) |
Returns the pool of the given rectangle. | |
Eina_Bool | eina_rectangle_pool_geometry_get (Eina_Rectangle_Pool *pool, int *w, int *h) |
Returns the width and height of the given pool. | |
void * | eina_rectangle_pool_data_get (Eina_Rectangle_Pool *pool) |
Gets the data from the given pool. | |
void | eina_rectangle_pool_data_set (Eina_Rectangle_Pool *pool, const void *data) |
Sets the data to the given pool. | |
void | eina_rectangle_pool_free (Eina_Rectangle_Pool *pool) |
Frees the given pool. | |
int | eina_rectangle_pool_count (Eina_Rectangle_Pool *pool) |
Returns the number of rectangles in the given pool. | |
Eina_Rectangle * | eina_rectangle_pool_request (Eina_Rectangle_Pool *pool, int w, int h) |
Requests a rectangle of given size in the given pool. | |
void | eina_rectangle_pool_release (Eina_Rectangle *rect) |
Removes the given rectangle from the pool. | |
Eina_Rectangle * | eina_rectangle_new (int x, int y, int w, int h) |
Creates a new rectangle. | |
void | eina_rectangle_free (Eina_Rectangle *rect) |
Frees the given rectangle. | |
void | eina_rectangle_pool_packing_set (Eina_Rectangle_Pool *pool, Eina_Rectangle_Packing type) |
Sets the type of given rectangle pool. | |
Eina_Rectangle_Outside | eina_rectangle_outside_position (Eina_Rectangle *rect1, Eina_Rectangle *rect2) |
calculates where rect2 is outside of rect1. | |
static Eina_Bool | eina_rectangle_equal (const Eina_Rectangle *rect1, const Eina_Rectangle *rect2) |
Compares two rectangles for equality. | |
Typedefs | |
typedef struct _Eina_Position2D | Eina_Position2D |
A 2D position in pixel coordinates. | |
typedef struct _Eina_Size2D | Eina_Size2D |
A 2D size in pixel coordinates. | |
typedef struct _Eina_Rectangle | Eina_Rectangle |
typedef struct _Eina_Rectangle_Pool | Eina_Rectangle_Pool |
Defines | |
#define | EINA_SIZE2D_EQ(a, b) (((a).w == (b).w) && ((a).h == (b).h)) |
convenience macro for comparing two Eina_Size2D structs | |
#define | EINA_POSITION2D_EQ(a, b) (((a).x == (b).x) && ((a).y == (b).y)) |
convenience macro for comparing two Eina_Position2D structs | |
#define | EINA_RECTANGLE_SET(Rectangle, X, Y, W, H) |
Definition for the macro to set the values of a Eina_Rectangle. |
#define EINA_POSITION2D_EQ | ( | a, | |
b | |||
) | (((a).x == (b).x) && ((a).y == (b).y)) |
convenience macro for comparing two Eina_Position2D structs
[in] | a | An Eina_Position2D |
[in] | b | An Eina_Position2D |
#define EINA_RECTANGLE_SET | ( | Rectangle, | |
X, | |||
Y, | |||
W, | |||
H | |||
) |
{ \ (Rectangle)->x = X; \ (Rectangle)->y = Y; \ (Rectangle)->w = W; \ (Rectangle)->h = H; \ }
Definition for the macro to set the values of a Eina_Rectangle.
[out] | Rectangle | The rectangle. |
[in] | X | The X coordinate of the top left corner of the rectangle. |
[in] | Y | The Y coordinate of the top left corner of the rectangle. |
[in] | W | The width of the rectangle. |
[in] | H | The height of the rectangle. |
This macro set the values of Rectangle
. X
and Y
are the coordinates of the top left corner of Rectangle
, W
is its width and H
is its height.
#define EINA_SIZE2D_EQ | ( | a, | |
b | |||
) | (((a).w == (b).w) && ((a).h == (b).h)) |
convenience macro for comparing two Eina_Size2D structs
[in] | a | An Eina_Size2D |
[in] | b | An Eina_Size2D |
Simple rectangle structure.
Type for an opaque pool of rectangles.
Enumeration of the positions around a rectangle.
Type for an Eina Pool based on a packing algorithm.
static void eina_rectangle_coords_from | ( | Eina_Rectangle * | rect, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h | ||
) | [static] |
Sets the coordinates and size of a rectangle.
[out] | rect | The rectangle. |
[in] | x | The X coordinate of the rectangle's top-left corner. |
[in] | y | The Y coordinate of the rectangle's top-left corner. |
[in] | w | The width of the rectangle. |
[in] | h | The height of the rectangle. |
This function sets its top-left X coordinate to 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_rectangle_coords_inside | ( | const Eina_Rectangle * | rect, |
int | x, | ||
int | y | ||
) | [static] |
Checks if the given point is inside the rectangle.
[in] | rect | The rectangle. |
[in] | x | The x coordinate of the point. |
[in] | y | The y coordinate of the point. |
x
, y
) is within the edges of r
, EINA_FALSE otherwise.No check is done on r
, so it must be a valid rectangle.
static Eina_Bool eina_rectangle_equal | ( | const Eina_Rectangle * | rect1, |
const Eina_Rectangle * | rect2 | ||
) | [static] |
Compares two rectangles for equality.
[in] | rect1 | First rectangle. Must not be NULL. |
[in] | rect2 | Second rectangle. Must not be NULL. |
No check is made on the rectangles, so they should be valid and non NULL for this function to be meaningful.
void eina_rectangle_free | ( | Eina_Rectangle * | rect | ) |
Frees the given rectangle.
iin] | rect The rectangle to free. |
This function removes rect
from the rectangles pool.
static Eina_Bool eina_rectangle_height_cut | ( | Eina_Rectangle * | rect, |
Eina_Rectangle * | slice, | ||
Eina_Rectangle * | remainder, | ||
int | amount | ||
) | [static] |
Slices a rectangle horizontally starting from top edge.
[in] | rect | The rectangle to slice. |
[out] | slice | The sliced part of the rectangle. |
[out] | remainder | The left over part of the rectangle after slicing. |
[in] | amount | The slice location's vertical distance from the top. |
Cut a rectangle horizontally at a distance amount
from the rectangle's top edge. If the amount
value is greater than the rectangle width, no cut is performed and EINA_FALSE is returned.
static Eina_Bool eina_rectangle_intersection | ( | Eina_Rectangle * | dst, |
const Eina_Rectangle * | src | ||
) | [static] |
Gets the intersection of two rectangles.
[in,out] | dst | The first rectangle. |
[in] | src | The second rectangle. |
Changes dst
to be the rectangle represented by the intersection of dst
and src
. dst
is unchanged if the two rectangles do not intersect.
No check is done on dst
or src
, so they must be valid rectangles.
static Eina_Bool eina_rectangle_is_empty | ( | const Eina_Rectangle * | rect | ) | [static] |
Checks if the given rectangle is empty.
[in] | rect | The rectangle to check. |
r
is empty, EINA_FALSE otherwise.No check is done on r
, so it must be a valid rectangle.
static Eina_Bool eina_rectangle_is_valid | ( | const Eina_Rectangle * | rect | ) | [static] |
Tells whether a rectangle is valid.
[in] | rect | The rectangle. |
This function checks if both width and height attributes of the rectangle are positive integers. If so, the rectangle is considered valid, else the rectangle is invalid.
static int eina_rectangle_max_x | ( | Eina_Rectangle * | rect | ) | [static] |
Gets the rectangle's maximum X coordinate.
[in] | rect | The rectangle. |
This function calculates the maximum X coordinate of the rectangle by summing the width
with the current x
coordinate of the rectangle.
static int eina_rectangle_max_y | ( | Eina_Rectangle * | rect | ) | [static] |
Gets the rectangle maximum Y coordinate.
[in] | rect | The rectangle. |
This function calculates the maximum y coordinate of the rectangle by summing the height
with the current y
coordinate of the rectangle.
Eina_Rectangle* eina_rectangle_new | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Creates a new rectangle.
[in] | x | The X coordinate of the top left corner of the rectangle. |
[in] | y | The Y coordinate of the top left corner of the rectangle. |
[in] | w | The width of the rectangle. |
[in] | h | The height of the rectangle. |
This function creates a rectangle whose top left corner has the coordinates (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
otherwise.
Eina_Rectangle_Outside eina_rectangle_outside_position | ( | Eina_Rectangle * | rect1, |
Eina_Rectangle * | rect2 | ||
) |
calculates where rect2 is outside of rect1.
[in] | rect1 | The rect to use as anchor |
[in] | rect2 | The rect to look for outside positions |
int eina_rectangle_pool_count | ( | Eina_Rectangle_Pool * | pool | ) |
Returns the number of rectangles in the given pool.
[in] | pool | The pool. |
This function returns the number of rectangles in pool
.
void* eina_rectangle_pool_data_get | ( | Eina_Rectangle_Pool * | pool | ) |
Gets the data from the given pool.
[in] | pool | The pool. |
This function gets the data from pool
set by eina_rectangle_pool_data_set(). If pool
is NULL
, this function returns NULL
.
void eina_rectangle_pool_data_set | ( | Eina_Rectangle_Pool * | pool, |
const void * | data | ||
) |
Sets the data to the given pool.
[in,out] | pool | The pool. |
[in] | data | The data to set. |
This function sets data
to pool
. If pool
is NULL
, this function does nothing.
void eina_rectangle_pool_free | ( | Eina_Rectangle_Pool * | pool | ) |
Frees the given pool.
[in] | pool | The pool to free. |
This function frees the allocated data of pool
. If pool
is NULL
, this function returned immediately.
Eina_Bool eina_rectangle_pool_geometry_get | ( | Eina_Rectangle_Pool * | pool, |
int * | w, | ||
int * | h | ||
) |
Returns the width and height of the given pool.
[in] | pool | The pool. |
[out] | w | The returned width. |
[out] | h | The returned height. |
This function returns the width and height of 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.
Returns the pool of the given rectangle.
[in] | rect | The rectangle. |
This function returns the pool in which rect
is. If rect
is NULL
, NULL
is returned.
Eina_Rectangle_Pool* eina_rectangle_pool_new | ( | int | w, |
int | h | ||
) |
Adds a rectangle in a new pool.
[in] | w | The width of the rectangle. |
[in] | h | The height of the rectangle. |
NULL
otherwise.This function adds the rectangle of size (width
, height
) to a new pool. If the pool can not be created, NULL
is returned. Otherwise the newly allocated pool is returned.
void eina_rectangle_pool_packing_set | ( | Eina_Rectangle_Pool * | pool, |
Eina_Rectangle_Packing | type | ||
) |
Sets the type of given rectangle pool.
[in,out] | pool | The rectangle pool for which type is to be set. |
[in] | type | Type of Eina Pool based on packing algorithm. |
This function sets type
of pool
.
void eina_rectangle_pool_release | ( | Eina_Rectangle * | rect | ) |
Removes the given rectangle from the pool.
[in,out] | rect | The rectangle to remove from the pool. |
This function removes rect
from the pool. If rect
is NULL
, the function returns immediately. Otherwise it removes rect
from the pool.
Eina_Rectangle* eina_rectangle_pool_request | ( | Eina_Rectangle_Pool * | pool, |
int | w, | ||
int | h | ||
) |
Requests a rectangle of given size in the given pool.
[in,out] | pool | The pool. |
[in] | w | The width of the rectangle to request. |
[in] | h | The height of the rectangle to request. |
NULL
otherwise.This function retrieves from 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
.
static void eina_rectangle_rescale_in | ( | const Eina_Rectangle * | out, |
const Eina_Rectangle * | in, | ||
Eina_Rectangle * | res | ||
) | [static] |
FIXME I am useless and used by no one.
in | The inner rectangle. |
out | The outer rectangle. |
res | The resulting rectangle. |
static void eina_rectangle_rescale_out | ( | const Eina_Rectangle * | out, |
const Eina_Rectangle * | in, | ||
Eina_Rectangle * | res | ||
) | [static] |
FIXME I am useless and used by no one.
in | The inner rectangle. |
out | The outer rectangle. |
res | The resulting rectangle. |
static Eina_Bool eina_rectangle_subtract | ( | Eina_Rectangle * | rect, |
Eina_Rectangle * | other, | ||
Eina_Rectangle | out[4] | ||
) | [static] |
Subtracts two rectangles and returns the differences.
[in] | rect | The minuend rectangle. |
[in] | other | The subtrahend rectangle. |
[out] | out | An array of differences between the two rectangles. |
This function subtracts two rectangles and stores the resulting differences into the out
array. There will be at most four differences; use eina_rectangle_is_valid to confirm the exact number.
static void eina_rectangle_union | ( | Eina_Rectangle * | dst, |
const Eina_Rectangle * | src | ||
) | [static] |
Gets the union of two rectangles.
[in,out] | dst | The first rectangle. |
[in] | src | The second rectangle. |
Changes dst
to be the bounding box of both rectangles dst
and src
.
No check is done on dst
or src
, so they must be valid rectangles.
static Eina_Bool eina_rectangle_width_cut | ( | Eina_Rectangle * | rect, |
Eina_Rectangle * | slice, | ||
Eina_Rectangle * | remainder, | ||
int | amount | ||
) | [static] |
Slices a rectangle vertically starting from right edge.
[in] | rect | The rectangle to slice. |
[out] | slice | The sliced part of the rectangle. |
[out] | remainder | The left over part of the rectangle after slicing. |
[in] | amount | The slice location's horizontal distance from the right. |
Cut a rectangle vertically at a distance amount
from the rectangle's right edge. If the amount
value is greater than the rectangle's width, no cut is performed and EINA_FALSE is returned.
static Eina_Bool eina_rectangle_x_cut | ( | Eina_Rectangle * | rect, |
Eina_Rectangle * | slice, | ||
Eina_Rectangle * | remainder, | ||
int | amount | ||
) | [static] |
Slices a rectangle vertically into two subrectangles.
[in] | rect | The rectangle to slice. |
[out] | slice | The sliced part of the rectangle. |
[out] | remainder | The left over part of the rectangle after slicing. |
[in] | amount | The slice location's horizontal distance from the left. |
Cut a rectangle vertically at a distance amount
from the rectangle's left edge. If the amount
value is greater than the rectangle's width, no cut is performed and EINA_FALSE is returned.
static Eina_Bool eina_rectangle_xcoord_inside | ( | const Eina_Rectangle * | rect, |
int | x | ||
) | [static] |
Checks if the given X-coordinate is in the rectangle.
[in] | rect | The rectangle. |
[in] | x | The X coordinate. |
x
is between the rectangle's left and right edges, EINA_FALSE otherwise.No check is done on r
, so it must be a valid rectangle.
static Eina_Bool eina_rectangle_y_cut | ( | Eina_Rectangle * | rect, |
Eina_Rectangle * | slice, | ||
Eina_Rectangle * | remainder, | ||
int | amount | ||
) | [static] |
Slices a rectangle horizontally into two subrectangles.
[in] | rect | The rectangle to slice. |
[out] | slice | The sliced part of the rectangle. |
[out] | remainder | The left over part of the rectangle after slicing. |
[in] | amount | The slice location's vertical distance from the bottom. |
Cut a rectangle horizontally at a distance amount
from the rectangle's bottom edge. If the amount
value is greater than the rectangle's height, no cut is performed and EINA_FALSE is returned.
static Eina_Bool eina_rectangle_ycoord_inside | ( | const Eina_Rectangle * | rect, |
int | y | ||
) | [static] |
Checks if the given Y-coordinate is in the rectangle.
[in] | rect | The rectangle. |
[in] | y | The Y coordinate. |
y
is between the rectangle's top and bottom edges, EINA_FALSE otherwise.No check is done on r
, so it must be a valid rectangle.
static Eina_Bool eina_rectangles_intersect | ( | const Eina_Rectangle * | rect1, |
const Eina_Rectangle * | rect2 | ||
) | [static] |
Checks if two rectangles intersect.
[in] | rect1 | The first rectangle. |
[in] | rect2 | The second rectangle. |
rect1
and rect2
intersect, EINA_FALSE otherwise.No check is done on rect1
and rect2
, so they must be valid rectangles.
static int eina_spans_intersect | ( | int | c1, |
int | l1, | ||
int | c2, | ||
int | l2 | ||
) | [static] |
Checks if the given spans intersect.
[in] | c1 | The column of the first span. |
[in] | l1 | The length of the first span. |
[in] | c2 | The column of the second span. |
[in] | l2 | The length of the second span. |