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.
|
Eina_Tiler is a tool to facilitate calculations of areas that are damaged and thus need to be re-rendered.
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:
- See also:
- eina_tiler_new()
-
eina_tiler_rect_add()
-
eina_tiler_iterator_new()
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()
Function Documentation
Creates a new Eina_Iterator that iterates over a list of tiles.
- Since :
- 2.3.1
- 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.
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
- 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, otherwise EINA_FALSE
if there are no more rectangles to iterate over (and thus the current one isn't valid)
Sets up an Eina_Tile_Grid_Slicer struct.
- Since :
- 2.3.1
- 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.
Frees a tiler.
This function frees t. It does not free the memory allocated for the elements of t.
- Since :
- 2.3.1
- Parameters:
-
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
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()
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, otherwise EINA_FALSE
on failure
- See also:
- eina_tiler_rect_del()
Sets the size of the tiles for a tiler.
- Since :
- 2.3.1
- Parameters:
-
[in] | t | The tiler whose tile size are set |
[in] | w | The width of the tiles |
[in] | h | The height of the tiles |