This is an example that illustrates how Eina_Tiler works for a given set of rectangles. The rectangles must be given in the command line in the form: <width>x<height>+<x offset>="">+<y offset>=""> The example will show two panels, the first(input) will show the given rectangles(in different colors) and in the seconds(output) it will show the rectangles given by the tiler. The rectangles will be added one by one every two seconds. A lot of the example deals with actually painting the rectangles so we'll skip over quite a bit of code, but you can see all of it in eina_tiler_01.c.

The first thing of note in our example is the creation of the tiler:

Note:
maxw and maxh are calculated such that the tiler's size will fully encompass all given rectangles.
We'll now look at the function that actually adds rectangles to our tiler. It first checks if we added all rectangles already and if so stops right there:

Our function then clears all rectangles given to us by tiler from the last execution. It does this because each rectangle we add may change everything about the output of eina_tiler:

Next we get another rectangle, print it and show it in the input panel:

We now come to the tiler stuff, we add our new rectangle to it and get a new iterator for the tiler:

We now iterate over our tiler printing every rect it gives us and sowing it in the output panel:

We of course must remember to free our iterator and that's it for this function:

You should try many different inputs to see how the tiler works, here are a few suggestions:

  • 100x100+0+0 100x100+200+200
  • 100x100+0+0 100x100+5+5 100x100+10+10 100x100+15+15 100x100+20+20
  • 100x100+0+0 100x100+100+100 100x100+200+0 100x100+0+200 100x100+200+200
  • 10x10+0+0 10x10+10+10 10x10+20+0 10x10+0+20 10x10+20+20