Now that you are familiar with the Evas development model, it is time to delve a bit deeper. This section outlines the general capabilities of Evas. It helps you understand what is available and what is not. Since Evas is not released officially yet, the complete details are a moving target.
The following table lists the Evas primitives at the disposal of the programmer. These are offered in the form of "Evas Objects" in the code.
Table 3.2. Evas primitives
Primitive | Short description |
---|---|
Rect | Typical rectangle; useful for clipping too |
Image | The most common Evas object |
Text | Text object; one line only |
TextBlock | Multi-line text object |
Line | Line object with start and end points |
Polygon | General-purpose shape |
Gradient | Linear, radial, rectangular, etc. |
Many times you may have found yourself writing several lines of code in order to accomplish something, only to find out that your library already implements it. Avoiding this is easy. Reading beforehand what a library offers, rather than just diving into the code as soon as possible is the obvious solution. For example, Evas implements some basic data structures, so writing an Evas-only application does not mean that you will have to implement them yourself.
Clipping means showing only the parts of an object that are contained (constrained) by a second object. Currently Evas supports clipping only to Rectangles.
You can attach and retrieve any type of data to an Evas primitive. Storage is performed on a key-data pair fashion.
Objects can have different Z-ordering. The layer number is not fixed. Transparency works as expected. That is, creating a transparent object on the upper layer will make objects on the lower level layer visible. Evas makes transparent interfaces really easy, and more importantly fast.
Evas allows you to detect if the (mouse) pointer is within the Canvas, and what are its coordinates. You can even get the state of mouse buttons (if they are pressed or not). You can also translate from screen to Canvas coordinates and vice-versa.
Since Evas knows the state of its objects as already explained, it gives you access to a lot of functions for retrieving currently drawn objects. You can search object by name, coordinates, and pointer position. You can even get a list of objects which are contained in a specific rectangular area of the Canvas.
For your own convenience Evas comes with some useful Data Structures. Currently a hash-table implementation and a linked-list one are offered. Even if you use your own or exploit external third-party libraries, you should at least learn the linked List API. This is because all Evas functions which deal with collections of objects, strings, etc. actually return an Evas List.
Since Evas is a Canvas, it also offers the usual callback binding facilities. These are employed in order to respond to several external events including resizing and moving the canvas, using the mouse, or typing on the keyboard.
Evas allows you to create you own Evas objects and have them implement the same API used for built-in objects too. Naturally, this is a great way to group several different primitives to form more complex objects without the need of custom glue and wrapper code. Not to be confused with the EFL Smart library.
Most programmers will use the X11 back-end in general. Evas runs on other devices too. The framebuffer is another good candidate found on embedded systems (which do not run an X server).
The Text object of Evas is not as limited as you might think. Evas includes some built-in styles, which will make text appear on screen a little more appealing. Shadows, outlines, and glows including combinations among them are already there.
As always, you should look into the code if you want to know everything that Evas offers. Not all features are documented yet and some of course are more experimental than others.