Tizen Native API  4.0

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 *r)
 Checks if the given rectangle is empty.
static void eina_rectangle_coords_from (Eina_Rectangle *r, int x, int y, int w, int h)
 Sets the coordinates and size of the given rectangle.
static Eina_Bool eina_rectangles_intersect (const Eina_Rectangle *r1, const Eina_Rectangle *r2)
 Checks if the given rectangles intersect.
static Eina_Bool eina_rectangle_xcoord_inside (const Eina_Rectangle *r, int x)
 Checks if the given x-coordinate is in the rectangle .
static Eina_Bool eina_rectangle_ycoord_inside (const Eina_Rectangle *r, int y)
 Checks if the given y-coordinate is in the rectangle .
static Eina_Bool eina_rectangle_coords_inside (const Eina_Rectangle *r, int x, int y)
 Checks if the given point is in 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 *r)
 Tells whether a rectangle is valid or not.
static int eina_rectangle_max_x (Eina_Rectangle *thiz)
 Gives the rectangle maximum x coordinate.
static int eina_rectangle_max_y (Eina_Rectangle *thiz)
 Gives the rectangle maximum y coordinate.
static Eina_Bool eina_rectangle_x_cut (Eina_Rectangle *thiz, Eina_Rectangle *slice, Eina_Rectangle *remainder, int amount)
 Slices a rectangle vertically into two subrectangles starting from left edge.
static Eina_Bool eina_rectangle_y_cut (Eina_Rectangle *thiz, Eina_Rectangle *slice, Eina_Rectangle *remainder, int amount)
 Slices a rectangle horizontally into two subrectangles starting from bottom edge.
static Eina_Bool eina_rectangle_width_cut (Eina_Rectangle *thiz, 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 *thiz, Eina_Rectangle *slice, Eina_Rectangle *remainder, int amount)
 Slices a rectangle horizontally starting from top edge.
static Eina_Bool eina_rectangle_subtract (Eina_Rectangle *thiz, Eina_Rectangle *other, Eina_Rectangle out[4])
 Subtracts two rectangles.
Eina_Rectangle_Pooleina_rectangle_pool_new (int w, int h)
 Adds a rectangle in a new pool.
Eina_Rectangle_Pooleina_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_Rectangleeina_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_Rectangleeina_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.

Typedefs

typedef struct _Eina_Rectangle Eina_Rectangle
typedef struct _Eina_Rectangle_Pool Eina_Rectangle_Pool

Defines

#define EINA_RECTANGLE_SET(Rectangle, X, Y, W, H)
 Definition for the macro to set the values of a Eina_Rectangle.

Define Documentation

#define EINA_RECTANGLE_SET (   Rectangle,
  X,
  Y,
  W,
 
)
Value:
{                         \
      (Rectangle)->x = X;             \
      (Rectangle)->y = Y;             \
      (Rectangle)->w = W;             \
      (Rectangle)->h = H;             \
    }

Definition for the macro to set the values of a Eina_Rectangle.

Parameters:
RectangleThe rectangle to set the values.
XThe X coordinate of the top left corner of the rectangle.
YThe Y coordinate of the top left corner of the rectangle.
WThe width of the rectangle.
HThe height of the rectangle.

This macro set the values of Rectangle. (X, Y) is the coordinates of the top left corner of Rectangle, W is its width and H is its height.


Typedef Documentation

Simple rectangle structure.

Type for an opaque pool of rectangle.


Enumeration Type Documentation

Type for an Eina Pool based on packing algorithm.

Since (EFL) :
1.11
Enumerator:
Eina_Packing_Descending 

Current

Eina_Packing_Ascending 

sorting in ascending order

Eina_Packing_Bottom_Left 

sorting in bottom left fashion

Eina_Packing_Bottom_Left_Skyline 

bottom left skyline

Eina_Packing_Bottom_Left_Skyline_Improved 

optimized bottom left skyline


Function Documentation

static void eina_rectangle_coords_from ( Eina_Rectangle r,
int  x,
int  y,
int  w,
int  h 
) [static]

Sets the coordinates and size of the given rectangle.

Parameters:
rThe rectangle.
xThe top-left x coordinate of the rectangle.
yThe top-left y coordinate of the rectangle.
wThe width of the rectangle.
hThe 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 r,
int  x,
int  y 
) [static]

Checks if the given point is in the rectangle .

Parameters:
rThe rectangle.
xThe x coordinate of the point.
yThe y coordinate of the point.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.

This function returns EINA_TRUE if the point of coordinate (x, y) is in r, EINA_FALSE otherwise. No check is done on r, so it must be a valid rectangle.

Frees the given rectangle.

Parameters:
rectThe rectangle to free.

This function removes rect from the rectangles pool.

Since :
2.3.1
static Eina_Bool eina_rectangle_height_cut ( Eina_Rectangle thiz,
Eina_Rectangle slice,
Eina_Rectangle remainder,
int  amount 
) [static]

Slices a rectangle horizontally starting from top edge.

Parameters:
thizThe rectangle to slice
sliceThe sliced part of the rectangle
remainderThe left over part of the original rectangle after slice
amountThe amount to cut off the rectangle starting from the top edge
Returns:
EINA_TRUE if the cut succeeds, EINA_FALSE otherwise

Use this function if we must cut a rectangle horizontally. The amount parameter defines the inner y coordinate where to do the cut, starting from the top edge of the rectangle. If the amount value is greater than the rectangle width, there will be not cut possible and EINA_FALSE will be returned.

static Eina_Bool eina_rectangle_intersection ( Eina_Rectangle dst,
const Eina_Rectangle src 
) [static]

Gets the intersection of two rectangles.

Parameters:
dstThe first rectangle.
srcThe second rectangle.
Returns:
EINA_TRUE if the rectangles intersect, EINA_FALSE otherwise.

This function get the intersection of the rectangles dst and src. The result is stored in dst. No check is done on dst or src, so they must be valid rectangles.

static Eina_Bool eina_rectangle_is_empty ( const Eina_Rectangle r) [static]

Checks if the given rectangle is empty.

Parameters:
rThe rectangle to check.
Returns:
EINA_TRUE if the rectangle is empty, EINA_FALSE otherwise.

This function returns EINA_TRUE if 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 r) [static]

Tells whether a rectangle is valid or not.

Parameters:
rThe rectangle
Returns:
EINA_TRUE if the rectangle is valid, EINA_FALSE otherwise.

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 thiz) [static]

Gives the rectangle maximum x coordinate.

Parameters:
thizThe rectangle
Returns:
The maximum x coordinate

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 thiz) [static]

Gives the rectangle maximum y coordinate.

Parameters:
thizThe rectangle
Returns:
The maximum y coordinate

This function calculates the maximum y coordinate of the rectangle by summing the height with the current y coodinate of the rectangle.

Eina_Rectangle* eina_rectangle_new ( int  x,
int  y,
int  w,
int  h 
)

Creates a new rectangle.

Parameters:
xThe X coordinate of the top left corner of the rectangle.
yThe Y coordinate of the top left corner of the rectangle.
wThe width of the rectangle.
hThe height of the rectangle.
Returns:
The new rectangle on success, @ NULL otherwise.

This function creates a rectangle which 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.

Since :
2.3.1

Returns the number of rectangles in the given pool.

Parameters:
poolThe pool.
Returns:
The number of rectangles in the pool.

This function returns the number of rectangles in pool.

Since :
2.3.1

Gets the data from the given pool.

Parameters:
poolThe pool.
Returns:
The returned data.

This function gets the data from pool set by eina_rectangle_pool_data_set(). If pool is NULL, this function returns NULL.

Since :
2.3.1
void eina_rectangle_pool_data_set ( Eina_Rectangle_Pool pool,
const void *  data 
)

Sets the data to the given pool.

Parameters:
poolThe pool.
dataThe data to set.

This function sets data to pool. If pool is NULL, this function does nothing.

Since :
2.3.1

Frees the given pool.

Parameters:
poolThe pool to free.

This function frees the allocated data of pool. If pool is NULL, this function returned immediately.

Since :
2.3.1
Eina_Bool eina_rectangle_pool_geometry_get ( Eina_Rectangle_Pool pool,
int *  w,
int *  h 
)

Returns the width and height of the given pool.

Parameters:
poolThe pool.
wThe returned width.
hThe returned height.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.

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.

Since :
2.3.1

Returns the pool of the given rectangle.

Parameters:
rectThe rectangle.
Returns:
The pool of the given rectangle.

This function returns the pool in which rect is. If rect is NULL, NULL is returned.

Since :
2.3.1

Adds a rectangle in a new pool.

Parameters:
wThe width of the rectangle.
hThe height of the rectangle.
Returns:
A newly allocated pool on success, 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.

Since :
2.3.1

Sets the type of given rectangle pool.

Parameters:
poolThe rectangle pool for which type is to be set.
typeType of Eina Pool based on packing algorithm.

This function sets type of pool.

See also:
Eina_Rectangle_Packing
Since (EFL) :
1.11
Since :
2.3.1

Removes the given rectangle from the pool.

Parameters:
rectThe 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.

Since :
2.3.1

Requests a rectangle of given size in the given pool.

Parameters:
poolThe pool.
wThe width of the rectangle to request.
hThe height of the rectangle to request.
Returns:
The requested rectangle on success, NULL otherwise.

This function retrieve 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.

Since :
2.3.1
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.

Parameters:
inThe inner rectangle.
outThe outer rectangle.
resThe 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.

Parameters:
inThe inner rectangle.
outThe outer rectangle.
resThe resulting rectangle.
static Eina_Bool eina_rectangle_subtract ( Eina_Rectangle thiz,
Eina_Rectangle other,
Eina_Rectangle  out[4] 
) [static]

Subtracts two rectangles.

Parameters:
thizThe minuend rectangle.
otherThe subtrahend rectangle.
outStored the difference between two rectangles.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.

This function subtract two rectangles. The difference is stored on out There will be at most four differences, use eina_rectangle_is_valid to confirm the number of differences.

static void eina_rectangle_union ( Eina_Rectangle dst,
const Eina_Rectangle src 
) [static]

Gets the union of two rectangles.

Parameters:
dstThe first rectangle.
srcThe second rectangle.

This function get the union of the rectangles dst and src. The result is stored in dst. No check is done on dst or src, so they must be valid rectangles.

static Eina_Bool eina_rectangle_width_cut ( Eina_Rectangle thiz,
Eina_Rectangle slice,
Eina_Rectangle remainder,
int  amount 
) [static]

Slices a rectangle vertically starting from right edge.

Parameters:
thizThe rectangle to slice
sliceThe sliced part of the rectangle
remainderThe left over part of the original rectangle after slice
amountThe amount to cut off the rectangle starting from the right edge
Returns:
EINA_TRUE if the cut succeeds, EINA_FALSE otherwise

Use this function if we must cut a rectangle vertically. The amount parameter defines the inner x coordinate where to do the cut, starting from the right edge of the rectangle. If the amount value is greater than the rectangle width, there will be not cut possible and EINA_FALSE will be returned.

static Eina_Bool eina_rectangle_x_cut ( Eina_Rectangle thiz,
Eina_Rectangle slice,
Eina_Rectangle remainder,
int  amount 
) [static]

Slices a rectangle vertically into two subrectangles starting from left edge.

Parameters:
thizThe rectangle to slice
sliceThe sliced part of the rectangle
remainderThe left over part of the original rectangle after slice
amountThe x inner coordinate of the rectangle where to perform the slicing.
Returns:
EINA_TRUE if the cut succeeds, EINA_FALSE otherwise

Use this function if we must cut a rectangle vertically. The amount parameter defines the x inner coordinate where to do the cut, starting from the left edge of the rectangle. If the amount value is greater than the rectangle width, there will be not cut possible and EINA_FALSE will be returned.

static Eina_Bool eina_rectangle_xcoord_inside ( const Eina_Rectangle r,
int  x 
) [static]

Checks if the given x-coordinate is in the rectangle .

Parameters:
rThe rectangle.
xThe x coordinate.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.

This function returns EINA_TRUE if 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_y_cut ( Eina_Rectangle thiz,
Eina_Rectangle slice,
Eina_Rectangle remainder,
int  amount 
) [static]

Slices a rectangle horizontally into two subrectangles starting from bottom edge.

Parameters:
thizThe rectangle to slice
sliceThe sliced part of the rectangle
remainderThe left over part of the original rectangle after slice
amountThe y inner coordinate of the rectangle where to perform the slicing.
Returns:
EINA_TRUE if the cut succeeds, EINA_FALSE otherwise

Use this function if we must cut a rectangle horizontally. The amount parameter defines the y inner coordinate where to do the cut, starting from the bottom edge of the rectangle. If the amount value is greater than the rectangle width, there will be not cut possible and EINA_FALSE will be returned.

static Eina_Bool eina_rectangle_ycoord_inside ( const Eina_Rectangle r,
int  y 
) [static]

Checks if the given y-coordinate is in the rectangle .

Parameters:
rThe rectangle.
yThe y coordinate.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.

This function returns EINA_TRUE if 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_rectangles_intersect ( const Eina_Rectangle r1,
const Eina_Rectangle r2 
) [static]

Checks if the given rectangles intersect.

Parameters:
r1The first rectangle.
r2The second rectangle.
Returns:
EINA_TRUE if the rectangles intersect, EINA_FALSE otherwise.

This function returns EINA_TRUE if r1 and r2 intersect, EINA_FALSE otherwise. No check is done on r1 and r2, 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.

Parameters:
c1The column of the first span.
l1The length of the first span.
c2The column of the second span.
l2The length of the second span.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.

This function returns EINA_TRUE if the given spans intersect, EINA_FALSE otherwise.