Tizen Native API

Functions

Eina_Tilereina_tiler_new (int w, int h)
 Creates a new tiler with w width and h height.
void eina_tiler_free (Eina_Tiler *t)
 Frees a tiler.
void eina_tiler_tile_size_set (Eina_Tiler *t, int w, int h)
 Sets the size of tiles for a tiler.
Eina_Bool eina_tiler_rect_add (Eina_Tiler *t, const Eina_Rectangle *r)
 Adds a rectangle to a tiler.
void eina_tiler_rect_del (Eina_Tiler *t, const Eina_Rectangle *r)
 Removes a rectangle from a tiler.
void eina_tiler_clear (Eina_Tiler *t)
 Removes all rectangles from tiles.
Eina_Iteratoreina_tiler_iterator_new (const Eina_Tiler *t)
 Create a iterator to access the tilers calculated rectangles.
Eina_Iteratoreina_tile_grid_slicer_iterator_new (int x, int y, int w, int h, int tile_w, int tile_h)
 Creates a new Eina_Iterator that iterates over a list of tiles.
static Eina_Bool eina_tile_grid_slicer_next (Eina_Tile_Grid_Slicer *slc, const Eina_Tile_Grid_Info **rect)
 Iterates over the tiles set by eina_tile_grid_slicer_setup().
static Eina_Bool eina_tile_grid_slicer_setup (Eina_Tile_Grid_Slicer *slc, int x, int y, int w, int h, int tile_w, int tile_h)
 Setup an Eina_Tile_Grid_Slicer struct.

Typedefs

typedef struct _Eina_Tiler Eina_Tiler
typedef struct Eina_Tile_Grid_Info Eina_Tile_Grid_Info

Warning:
This is a very low level tool, in most situations(for example if you're using evas) you won't need this.

Basic usage

Eina_Tiler is a tool to facilitate calculations of which areas are damaged and thus need to be re-rendered. The basic usage of Eina_Tiler is to give it the size of your canvas and a set of rectangular areas that need re-rendering, from that and using heuristics it'll tell you an efficient way to re-render in the form of a set of non-overlapping rectangles that covers the whole area that needs re-rendering.

The following is pseudo-code showing some simple use of Eina_Tiler:

 tiler = eina_tiler_new(MY_CANVAS_WIDTH, MY_CANVAS_HEIGHT);
 EINA_LIST_FOREACH(list_of_areas_that_need_re_rendering, l, rect)
   eina_tiler_add(tiler, rect);
 itr = eina_tiler_iterator_new(tiler);
 EINA_ITERATOR_FOREACH(itr, rect)
   my_function_that_repaints_areas_of_the_canvas(rect);
See also:
eina_tiler_new()
eina_tiler_rect_add()
eina_tiler_iterator_new()
Warning:
There are no guarantees that this will be the most efficient way to re-render for any particular case.

Grid Slicer

Grid slicer and Eina_Tiler are usually used together, that is however not necessary, they can be used independently. Grid slicer provides an easy API to divide an area in tiles which is useful in certain applications to divide the area that will be rendered into tiles. It's customary to, then create one Eina_Tiler for each tile.

The following is pseudo-code showing a very simplified use of grid slicer together with Eina_Tiler:

 itr = eina_tile_grid_slicer_iterator_new(0, 0, MY_CANVAS_WIDTH, MY_CANVAS_HEIGHT, TILE_WIDTH, TILE_HEIGHT);
 EINA_ITERATOR_FOREACH(itr, grid_info)
   {
      tiler = eina_tiler_new(grid_info->rect.w, grid_info->rect.w);
      EINA_LIST_FOREACH(list_of_areas_that_need_re_rendering_in_this_tile, l, rect)
        eina_tiler_add(tiler, rect);
      itr = eina_tiler_iterator_new(tiler);
      EINA_ITERATOR_FOREACH(itr, rect)
      my_function_that_repaints_areas_of_the_canvas(rect);
   }
See also:
eina_tiler_new()
eina_tiler_rect_add()
eina_tile_grid_slicer_setup()
eina_tile_grid_slicer_next()
eina_tile_grid_slicer_iterator_new()

Typedef Documentation

Grid type of a tiler.

Tiler type.


Function Documentation

Eina_Iterator* eina_tile_grid_slicer_iterator_new ( int  x,
int  y,
int  w,
int  h,
int  tile_w,
int  tile_h 
)

Creates a new Eina_Iterator that iterates over a list of tiles.

Since :
2.3
Parameters:
[in]xX axis coordinate.
[in]yY axis coordinate.
[in]wwidth.
[in]hheight.
[in]tile_wtile width.
[in]tile_htile height.
Returns:
A pointer to the Eina_Iterator. NULL on failure.
Remarks:
The region defined by x, y, w, h will be divided in to a grid of tiles of width tile_w and height tile_h, the returned iterator will iterate over every tile in the grid having as its data a Eina_Tile_Grid_Info.
This is a convenience function, iterating over the returned iterator is equivalent to calling eina_tile_grid_slicer_setup() and calling eina_tile_grid_slicer_next() untill it returns EINA_FALSE.
static Eina_Bool eina_tile_grid_slicer_next ( Eina_Tile_Grid_Slicer *  slc,
const Eina_Tile_Grid_Info **  rect 
) [static]

Iterates over the tiles set by eina_tile_grid_slicer_setup().

Since :
2.3
Parameters:
[in]slcPointer to an Eina_Tile_Grid_Slicer struct.
[out]rectPointer to a struct Eina_Tile_Grid_Info *.
Returns:
EINA_TRUE if the current rect is valid. EINA_FALSE if there is no more rects to iterate over (and thus the current one isn't valid).
Remarks:
This functions iterates over each Eina_Tile_Grid_Info *rect of the grid. eina_tile_grid_slicer_setup() must be called first, and *rect is only valid if this function returns EINA_TRUE. Its content shouldn't be modified.
Consider using eina_tile_grid_slicer_iterator_new() instead.
static Eina_Bool eina_tile_grid_slicer_setup ( Eina_Tile_Grid_Slicer *  slc,
int  x,
int  y,
int  w,
int  h,
int  tile_w,
int  tile_h 
) [static]

Setup an Eina_Tile_Grid_Slicer struct.

Since :
2.3
Parameters:
[in]slcPointer to an Eina_Tile_Grid_Slicer struct.
[in]xX axis coordinate.
[in]yY axis coordinate.
[in]wwidth.
[in]hheight.
[in]tile_wtile width.
[in]tile_htile height.
Returns:
A pointer to the Eina_Iterator. NULL on failure.
Remarks:
The region defined by x, y, w, h will be divided in to a grid of tiles of width tile_w and height tile_h, slc can then be used with eina_tile_grid_slicer_next() to access each tile.
Consider using eina_tile_grid_slicer_iterator_new() instead.

Removes all rectangles from tiles.

Since :
2.3
Parameters:
[in]tThe tiler to clear.
See also:
eina_tiler_rect_del()
void eina_tiler_free ( Eina_Tiler t)

Frees a tiler.

Since :
2.3
Parameters:
[in]tThe tiler to free.
Remarks:
This function frees t. It does not free the memory allocated for the elements of t.

Create a iterator to access the tilers calculated rectangles.

Since :
2.3
Parameters:
[in]tThe tiler to iterate over.
Returns:
A iterator containing Eina_Rectangle.
Eina_Tiler* eina_tiler_new ( int  w,
int  h 
)

Creates a new tiler with w width and h height.

Since :
2.3
Parameters:
[in]wWidth of the tiler
[in]hHeight of the tiler
Returns:
The newly created tiler
See also:
eina_tiler_free()

Adds a rectangle to a tiler.

Since :
2.3
Parameters:
[in]tThe tiler in which to add a container.
[in]rThe rectangle to be added.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.
See also:
eina_tiler_rect_del()
void eina_tiler_rect_del ( Eina_Tiler t,
const Eina_Rectangle r 
)

Removes a rectangle from a tiler.

Since :
2.3
Parameters:
tThe tiler in which to add a container.
rThe rectangle to be removed.
See also:
eina_tiler_rect_add()
eina_tiler_clear()
void eina_tiler_tile_size_set ( Eina_Tiler t,
int  w,
int  h 
)

Sets the size of tiles for a tiler.

Since :
2.3
Parameters:
[in]tThe tiler whose tile size will be set.
[in]wWidth of the tiles.
[in]hHeight of the tiles.
Warning:
w and h must be greater than zero, otherwise tile size won't be changed.
Tile size is not used!