2.2. Evas objects

Evas has a selection of different objects that can be placed on your canvas.

2.2.1. Lines, Rectangles and Polygons

Lines are the most simple primitive - it's simply a line between two points with a given thickness and colour. The colour is defined as a full 32-bit RGBA value. The red, green and blue components are fairly self-explanatory, but it's the 'A' that's most important - this is the object's alpha value. The alpha value defines how transparent an object is, ranging from 0, or fully transparent, through to 255, which is fully opaque.

Rectangles are defined by the position of their upper-left corner, adn their width and height. Like lines, (and, in fact every other Evas object), the colour of a rectangle has an alpha component, which means that rectangles can easily be made transparent. Rectangles are always filled. Polygons are the same as rectangles, except that they're defined by their corners.

2.2.2. Text

Text objects in Evas are strings with a given font, size and colour. They're rendered using TrueType fonts with full anti-aliasing to make sure they look their smoothest. Once you've created a text object, you can find out various bits of information about it, such as it's width and height, to make building higher-level GUI elements possible. Just like any other Evas object, they can have their size, position, colour and transparency changed at will.

2.2.3. Images

Images work in a similar way to rectangles in that they can be positioned and resized at will, except (of course) that they contain an image. By default the image is stretched so that it's top-left and bottom-right corners match those of the rectangle. However you can scale the image to be bigger or smaller than the rectangle, displaying a subset of the image or tiling it across the rectangle accordingly.

Images also have a colour, which changes the colours of the image. By default, images have full R, G, B and A values, which causes the image to be rendered using it's normal colours and full opacity. By changing the alpha value, the image can be made transparent, and by changing the colour values, the image is tinted accordingly.

Evas also handles transparency in images. Many images have a single colour defined as being fully transparent, and when Evas renders such images it renders these regions transparently. Images can also have an alpha channel, a fourth colour channel that defines how transparent each pixel of the image is. Evas also handles this correctly, blending the image with objects behind it.

2.2.4. Gradient Boxes

A gradient box is a rectangle that is filled with a gradient instead of a solid colour, which is great for creating things like gradient backgrounds. The gradient can be composed of any number of colours, any of which can also be partly or fully transparent, and the gradient can also be applied to the box at any angle.