Tizen Native API
|
Eina_Tiler is a tool to facilitate calculations of areas that are damaged and thus need to be re-rendered.
- Remarks:
- This is a very low level tool, in most situations(for example if you're using evas) you won't need this.
Basic usage
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 tells you an efficient way to re-render in the form of a set of non-overlapping rectangles that cover the whole area that needs re-rendering.
The following is a pseudo-code showing some simple uses 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);
- Remarks:
- There is no guarantee that this is 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 into tiles, which is useful in certain applications to divide the area that is rendered into tiles. It's customary to, then create one Eina_Tiler for each tile.
The following is a pseudo-code showing a very simplified use of a 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()
Functions | |
Eina_Tiler * | eina_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 the 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 the tiles. | |
Eina_Iterator * | eina_tiler_iterator_new (const Eina_Tiler *t) |
Creates an iterator to access the tiler's calculated rectangles. | |
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. | |
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) |
Sets up an Eina_Tile_Grid_Slicer struct. | |
Typedefs | |
typedef struct _Eina_Tiler | Eina_Tiler |
The structure type for the tiler type. | |
typedef struct Eina_Tile_Grid_Info | Eina_Tile_Grid_Info |
The structure type for the grid type of a tiler. |
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.1
- Remarks:
- The region defined by x, y, w, and h is divided into a grid of tiles of width tile_w and height tile_h, the returned iterator then iterates over every tile in the grid having Eina_Tile_Grid_Info as its data.
-
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() until it returns
EINA_FALSE
.
- Parameters:
-
[in] x The x axis coordinate [in] y The y axis coordinate [in] w The width [in] h The height [in] tile_w The tile width [in] tile_h The tile height
- Returns:
- A pointer to the Eina_Iterator
NULL
on failure.
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().
This function 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.
- Since :
- 2.3.1
- Remarks:
- Consider using eina_tile_grid_slicer_iterator_new() instead.
- Parameters:
-
[in] slc A pointer to an Eina_Tile_Grid_Slicer struct [out] rect A pointer to a struct Eina_Tile_Grid_Info
- Returns:
EINA_TRUE
if the current rectangle is valid, otherwiseEINA_FALSE
if there are no more rectangles to iterate over (and thus the current one isn't valid)
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] |
Sets up an Eina_Tile_Grid_Slicer struct.
- Since :
- 2.3.1
- Remarks:
- The region defined by x, y, w, and h is divided into 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.
- Parameters:
-
[in] slc A pointer to an Eina_Tile_Grid_Slicer struct [in] x The x axis coordinate [in] y The y axis coordinate [in] w The width [in] h The height [in] tile_w The tile width [in] tile_h The tile height
- Returns:
- A pointer to the Eina_Iterator
NULL
on failure.
void eina_tiler_clear | ( | Eina_Tiler * | t | ) |
Removes all rectangles from the tiles.
- Since :
- 2.3.1
- Parameters:
-
[in] t The tiler to clear
- See also:
- eina_tiler_rect_del()
void eina_tiler_free | ( | Eina_Tiler * | t | ) |
Frees a tiler.
This function frees t. It does not free the memory allocated for the elements of t.
- Since :
- 2.3.1
- Parameters:
-
[in] t The tiler to free
Eina_Iterator* eina_tiler_iterator_new | ( | const Eina_Tiler * | t | ) |
Creates an iterator to access the tiler's calculated rectangles.
- Since :
- 2.3.1
- Parameters:
-
[in] t The tiler to iterate over
- Returns:
- An 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.1
- Parameters:
-
[in] w The width of the tiler [in] h The height of the tiler
- Returns:
- The newly created tiler
- See also:
- eina_tiler_free()
Eina_Bool eina_tiler_rect_add | ( | Eina_Tiler * | t, |
const Eina_Rectangle * | r | ||
) |
Adds a rectangle to a tiler.
- Since :
- 2.3.1
- Parameters:
-
[in] t The tiler in which to add a container [in] r The rectangle to be added
- Returns:
EINA_TRUE
on success, otherwiseEINA_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.1
- Parameters:
-
[in] t The tiler in which to add a container [in] r The 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 the tiles for a tiler.
- Since :
- 2.3.1
- Remarks:
- w and h must be greater than zero, otherwise the tile size won't be changed.
- The tile size is not used.
- Parameters:
-
[in] t The tiler whose tile size are set [in] w The width of the tiles [in] h The height of the tiles