Tizen Native API
|
Evas provide a clean display canvas API.
See Evas for more details
Typedefs | |
typedef struct _Evas_Version | Evas_Version |
The version of Evas. | |
typedef enum _Evas_Callback_Type | Evas_Callback_Type |
Identifier of callbacks to be set for Evas canvases or Evas objects. | |
typedef short | Evas_Callback_Priority |
Callback priority value. Range is -32k to 32k. The lower the number, the higher the priority. | |
typedef enum _Evas_Button_Flags | Evas_Button_Flags |
Enumeration for Mouse Button events. | |
typedef enum _Evas_Event_Flags | Evas_Event_Flags |
Enumeration for events. | |
typedef enum _Evas_Touch_Point_State | Evas_Touch_Point_State |
Enumeration for touch point states. | |
typedef enum _Evas_Font_Hinting_Flags | Evas_Font_Hinting_Flags |
Enumeration for font hinting. | |
typedef struct _Evas_Coord_Rectangle | Evas_Coord_Rectangle |
A generic rectangle handle. | |
typedef struct _Evas_Point | Evas_Point |
Integer point. | |
typedef struct _Evas_Coord_Point | Evas_Coord_Point |
Evas_Coord point. | |
typedef struct _Evas_Coord_Precision_Point | Evas_Coord_Precision_Point |
Evas_Coord point with sub-pixel precision. | |
typedef struct _Evas_Coord_Size | Evas_Coord_Size |
Evas_Coord size. | |
typedef struct _Evas_Position | Evas_Position |
Associates the given point in Canvas and Output. | |
typedef struct _Evas_Precision_Position | Evas_Precision_Position |
Associates the given point in Canvas and Output, with sub-pixel precision. | |
typedef struct _Evas_Smart_Class | Evas_Smart_Class |
A smart object base class definition. | |
typedef struct _Evas_Smart_Interface | Evas_Smart_Interface |
A smart object base interface definition. | |
typedef struct _Evas_Smart_Cb_Description | Evas_Smart_Cb_Description |
A smart object callback description, used to provide introspection. | |
typedef void | Evas_Performance |
Evas Performance handle. | |
typedef struct _Evas_Modifier | Evas_Modifier |
Opaque type containing information on which modifier keys are registered in an Evas canvas. | |
typedef struct _Evas_Lock | Evas_Lock |
Opaque type containing information on which lock keys are registered in an Evas canvas. | |
typedef struct _Evas_Smart | Evas_Smart |
Evas Smart Object handle. | |
typedef struct _Evas_Native_Surface | Evas_Native_Surface |
Generic datatype for engine specific native surface information. | |
typedef struct _Evas_Video_Surface | Evas_Video_Surface |
A generic data type for video specific surface information. | |
typedef unsigned long long | Evas_Modifier_Mask |
An Evas modifier mask type. | |
typedef int | Evas_Coord |
Evas x y coordinates. | |
typedef int | Evas_Font_Size |
Evas Font Sizes. | |
typedef int | Evas_Angle |
Evas angle. | |
typedef enum _Evas_Aspect_Control | Evas_Aspect_Control |
Enumeration for aspect types or policies for scaling size hints, used for evas_object_size_hint_aspect_set(). | |
typedef enum _Evas_Display_Mode | Evas_Display_Mode |
Enumeration for object's display modes. | |
typedef struct _Evas_Pixel_Import_Source | Evas_Pixel_Import_Source |
A source description of pixels for importing pixels. | |
typedef struct _Evas_Engine_Info | Evas_Engine_Info |
A generic Evas Engine information structure. | |
typedef struct _Evas_Device | Evas_Device |
A source device handle - where the event came from. | |
typedef struct _Evas_Event_Mouse_Down | Evas_Event_Mouse_Down |
Event structure for EVAS_CALLBACK_MOUSE_DOWN event callbacks. | |
typedef struct _Evas_Event_Mouse_Up | Evas_Event_Mouse_Up |
Event structure for EVAS_CALLBACK_MOUSE_UP event callbacks. | |
typedef struct _Evas_Event_Mouse_In | Evas_Event_Mouse_In |
Event structure for EVAS_CALLBACK_MOUSE_IN event callbacks. | |
typedef struct _Evas_Event_Mouse_Out | Evas_Event_Mouse_Out |
Event structure for EVAS_CALLBACK_MOUSE_OUT event callbacks. | |
typedef struct _Evas_Event_Mouse_Move | Evas_Event_Mouse_Move |
Event structure for EVAS_CALLBACK_MOUSE_MOVE event callbacks. | |
typedef struct _Evas_Event_Mouse_Wheel | Evas_Event_Mouse_Wheel |
Event structure for EVAS_CALLBACK_MOUSE_WHEEL event callbacks. | |
typedef struct _Evas_Event_Multi_Down | Evas_Event_Multi_Down |
Event structure for EVAS_CALLBACK_MULTI_DOWN event callbacks. | |
typedef struct _Evas_Event_Multi_Up | Evas_Event_Multi_Up |
Event structure for EVAS_CALLBACK_MULTI_UP event callbacks. | |
typedef struct _Evas_Event_Multi_Move | Evas_Event_Multi_Move |
Event structure for EVAS_CALLBACK_MULTI_MOVE event callbacks. | |
typedef struct _Evas_Event_Key_Down | Evas_Event_Key_Down |
Event structure for EVAS_CALLBACK_KEY_DOWN event callbacks. | |
typedef struct _Evas_Event_Key_Up | Evas_Event_Key_Up |
Event structure for EVAS_CALLBACK_KEY_UP event callbacks. | |
typedef struct _Evas_Event_Hold | Evas_Event_Hold |
Event structure for EVAS_CALLBACK_HOLD event callbacks. | |
typedef enum _Evas_Load_Error | Evas_Load_Error |
Enumeration for load errors. | |
typedef enum _Evas_Alloc_Error | Evas_Alloc_Error |
Enumeration for allocation errors. | |
typedef enum _Evas_Fill_Spread | Evas_Fill_Spread |
Enumeration for spread of image fill. | |
typedef enum _Evas_Pixel_Import_Pixel_Format | Evas_Pixel_Import_Pixel_Format |
Enumeration for aspect types or policies. | |
typedef enum _Evas_Native_Surface_Type | Evas_Native_Surface_Type |
Native surface types that image object supports. | |
typedef enum _Evas_Border_Fill_Mode | Evas_Border_Fill_Mode |
Enumeration for border fill mode. | |
typedef enum _Evas_Image_Scale_Hint | Evas_Image_Scale_Hint |
Enumeration for image scale hints. | |
typedef enum _Evas_Image_Animated_Loop_Hint | Evas_Image_Animated_Loop_Hint |
Enumeration for animated loop hints. | |
typedef enum _Evas_Engine_Render_Mode | Evas_Engine_Render_Mode |
Enumeration for engine rendering modes. | |
typedef enum _Evas_Image_Content_Hint | Evas_Image_Content_Hint |
Enumeration for image content hints. | |
typedef enum _Evas_Device_Class | Evas_Device_Class |
Enumeration for device class. | |
typedef void(* | Evas_Async_Events_Put_Cb )(void *target, Evas_Callback_Type type, void *event_info) |
Evas Async events put function signature. | |
Defines | |
#define | EVAS_CALLBACK_PRIORITY_BEFORE -100 |
Slightly more prioritized than default. | |
#define | EVAS_CALLBACK_PRIORITY_DEFAULT 0 |
Default callback priority level. | |
#define | EVAS_CALLBACK_PRIORITY_AFTER 100 |
Slightly less prioritized than default. | |
#define | EVAS_VIDEO_SURFACE_VERSION 1 |
Definition of the magic version number to know what the video surf struct looks like. | |
#define | EVAS_LAYER_MIN -32768 |
Bottom-most layer number. | |
#define | EVAS_LAYER_MAX 32767 |
Top-most layer number. | |
#define | EVAS_COLOR_SPACE_ARGB 0 |
Not used for anything. | |
#define | EVAS_COLOR_SPACE_AHSV 1 |
Not used for anything. | |
#define | EVAS_TEXT_INVALID -1 |
Not used for anything. | |
#define | EVAS_TEXT_SPECIAL -2 |
Not used for anything. | |
#define | EVAS_HINT_EXPAND 1.0 |
Use with evas_object_size_hint_weight_set(), evas_object_size_hint_weight_get(), evas_object_size_hint_expand_set(), evas_object_size_hint_expand_get() | |
#define | EVAS_HINT_FILL -1.0 |
Use with evas_object_size_hint_align_set(), evas_object_size_hint_align_get(), evas_object_size_hint_fill_set(), evas_object_size_hint_fill_get() |
Evas
- Date:
- 2000 (created)
Table of Contents
Introduction
Evas is a clean display canvas API for several target display systems that can draw anti-aliased text, smooth super and sub-sampled scaled images, alpha-blend objects, and much more.
It abstracts any need to know much about what the characteristics of your display system are or what graphics calls are used to draw them and how. It deals on an object level where all you do is create and manipulate objects in a canvas, set their properties, and the rest is done for you.
Evas optimises the rendering pipeline to minimise effort in redrawing changes made to the canvas and so takes this work out of the programmers hand, saving a lot of time and energy.
It is small and lean, and is designed to work on embedded systems all the way to large and powerful multi-CPU workstations. It can be compiled to only have the features you need for your target platform if you so wish, thus keeping it small and lean. It has several display back-ends, letting it display on several display systems, making it portable for cross-device and cross-platform development.
What Evas is not?
Evas is not a widget set or widget toolkit, however it is their base. See Elementary for a toolkit based on Evas, Edje, Ecore and other Enlightenment technologies.
It is not dependent or aware of main loops, input or output systems. Input should be polled from various sources and fed to Evas. Similarly, it does not create windows or report windows updates to your system, but just draws the pixels and report to the user the areas that were changed.
How does Evas work?
Evas is a canvas display library. This is markedly different from most display and windowing systems as a canvas is structural and is also a state engine, whereas most display and windowing systems are immediate mode display targets. Evas handles the logic between a structural display via its state engine, and controls the target windowing system in order to produce rendered results of the current canvas' state on the display.
Immediate mode display systems retain very little, or no state. A program executes a series of commands, as in the pseudo code:
* draw line from position (0, 0) to position (100, 200); * * draw rectangle from position (10, 30) to position (50, 500); * * bitmap_handle = create_bitmap(); * scale bitmap_handle to size 100 x 100; * draw image bitmap_handle at position (10, 30); *
The series of commands is executed by the windowing system and the results are displayed on the screen (normally). Once the commands are executed the display system has little or no idea of how to reproduce this image again, and so has to be instructed by the application on how to redraw sections of the screen whenever needed. Each successive command is executed as instructed by the application and either emulated by software or sent to the graphics hardware on the device to be performed.
The advantage of such a system is that it is simple, and gives a program tight control over how something looks and is drawn. Given the increasing complexity of displays and demands by users to have better looking interfaces, more and more work is needing to be done at this level by the internals of widget sets, custom display widgets and other programs. This means that more and more logic and display rendering code needs to be written each time the application needs to figure out how to minimise redraws so that display is fast and interactive, and keeps track of redraw logic. The power comes at a high-price, with lots of extra code and work. Programmers not very familiar with graphics programming often make mistakes at this level and produce code that is sub optimal. Those familiar with this kind of programming simply get bored by writing the same code again and again.
For example, if in the above scene, the windowing system requires the application to redraw the area from 0, 0 to 50, 50 (also referred as "expose event"), then the programmer must calculate manually the updates and repaint it again:
* Redraw from position (0, 0) to position (50, 50): * * // what is in area (0, 0, 50, 50)? * * // 1. intersection part of line (0, 0) to (100, 200)? * draw line from position (0, 0) to position (25, 50); * * // 2. intersection part of rectangle (10, 30) to (50, 500)? * draw rectangle from position (10, 30) to position (50, 50) * * // 3. intersection part of image at (10, 30), size 100 x 100? * bitmap_subimage = subregion from position (0, 0) to position (40, 20) * draw image bitmap_subimage at position (10, 30); *
You might have noticed that, if all elements in the above scene are opaque, then the system is doing useless paints: part of the line is behind the rectangle, and part of the rectangle is behind the image. These useless paints tend to be very costly, as pixels tend to be 4 bytes in size; thus an overlapping region of 100 x 100 pixels is around 40000 useless writes! You could write code to calculate the overlapping areas and avoid painting then, but then it should be mixed with the "expose event" handling mentioned above and you quickly realize that the initially simpler method became really complex.
Evas is a structural system in which the programmer creates and manages display objects and their properties, and as a result of this higher level state management, the canvas is able to redraw the set of objects when needed to represent the current state of the canvas.
For example, the pseudo code:
* line_handle = create_line(); * set line_handle from position (0, 0) to position (100, 200); * show line_handle; * * rectangle_handle = create_rectangle(); * move rectangle_handle to position (10, 30); * resize rectangle_handle to size 40 x 470; * show rectangle_handle; * * bitmap_handle = create_bitmap(); * scale bitmap_handle to size 100 x 100; * move bitmap_handle to position (10, 30); * show bitmap_handle; * * render scene; *
This may look longer, but when the display needs to be refreshed or updated, you move, resize, show, or hide the objects that need to change. You can simply think at the object logic level, and the canvas software does the rest of the work for you, figuring out what actually changed in the canvas since it had been last drawn, how to most efficiently redraw the canvas and its contents to reflect the current state, and then it can go off and do the actual drawing of the canvas.
This lets you think in a more natural way when dealing with a display, and saves time and effort of working out how to load and display images, render given the current display system, and so on. Since Evas also is portable across different display systems, this also gives you the ability to have their code ported and displayed on different display systems with very little work.
Evas can be seen as a display system that stands somewhere between a widget set and an immediate mode display system. It retains basic display logic, but does very little high-level logic such as scrollbars, sliders, and push buttons.
Next Steps
After you understood what Evas is and installed it in your system you should proceed to understand the programming interface for all objects, and then see the specifics for the most used elements. You should take a while to learn Ecore and Edje as they likely save you tons of work compared to using just Evas directly.
Recommended reading:
- Generic Object Functions, where you get information on how to basically manipulate generic objects lying on an Evas canvas, handle canvas and object events, and so on.
- Rectangle Object Functions, to learn about the most basic object type on Evas -- the rectangle.
- Polygon Object Functions, to learn how to create polygon elements on the canvas.
- Line Object Functions, to learn how to create line elements on the canvas.
- Image Object Functions, to learn about image objects, over which Evas can do a plethora of operations.
- Text Object Functions, to learn how to create textual elements on the canvas.
- Textblock Object Functions, to learn how to create multiline textual elements on the canvas.
Define Documentation
#define EVAS_CALLBACK_PRIORITY_AFTER 100 |
Slightly less prioritized than default.
- Since (EFL) :
- 1.1
#define EVAS_CALLBACK_PRIORITY_BEFORE -100 |
Slightly more prioritized than default.
- Since (EFL) :
- 1.1
#define EVAS_CALLBACK_PRIORITY_DEFAULT 0 |
Default callback priority level.
- Since (EFL) :
- 1.1
#define EVAS_VIDEO_SURFACE_VERSION 1 |
Definition of the magic version number to know what the video surf struct looks like.
- Since (EFL) :
- 1.1
Typedef Documentation
typedef enum _Evas_Alloc_Error Evas_Alloc_Error |
Enumeration for allocation errors.
Possible allocation errors returned.
typedef enum _Evas_Aspect_Control Evas_Aspect_Control |
Enumeration for aspect types or policies for scaling size hints, used for evas_object_size_hint_aspect_set().
Aspect types or policies for scaling size hints, used for evas_object_size_hint_aspect_set()
typedef void(* Evas_Async_Events_Put_Cb)(void *target, Evas_Callback_Type type, void *event_info) |
Evas Async events put function signature.
- Since :
- 2.3.1
typedef enum _Evas_Border_Fill_Mode Evas_Border_Fill_Mode |
Enumeration for border fill mode.
How an image's center region (the complement to the border region) should be rendered by Evas
typedef enum _Evas_Button_Flags Evas_Button_Flags |
Enumeration for Mouse Button events.
Flags for Mouse Button events
Callback priority value. Range is -32k to 32k. The lower the number, the higher the priority.
- Since (EFL) :
- 1.1
typedef enum _Evas_Callback_Type Evas_Callback_Type |
Identifier of callbacks to be set for Evas canvases or Evas objects.
The following figure illustrates some Evas callbacks:
- See also:
- evas_object_event_callback_add()
- evas_event_callback_add() The types of events triggering a callback
typedef struct _Evas_Coord_Size Evas_Coord_Size |
Evas_Coord size.
- Since (EFL) :
- 1.8
typedef enum _Evas_Display_Mode Evas_Display_Mode |
Enumeration for object's display modes.
Object display mode type related with compress and expand or etc mode
typedef enum _Evas_Event_Flags Evas_Event_Flags |
Enumeration for events.
Flags for Events
typedef enum _Evas_Fill_Spread Evas_Fill_Spread |
Enumeration for spread of image fill.
Fill types used for evas_object_image_fill_spread_set()
typedef enum _Evas_Font_Hinting_Flags Evas_Font_Hinting_Flags |
Enumeration for font hinting.
Flags for Font Hinting
typedef enum _Evas_Image_Content_Hint Evas_Image_Content_Hint |
Enumeration for image content hints.
How an image's data is to be treated by Evas, for optimization
typedef enum _Evas_Image_Scale_Hint Evas_Image_Scale_Hint |
Enumeration for image scale hints.
How an image's data is to be treated by Evas, with regard to scaling cache
typedef enum _Evas_Load_Error Evas_Load_Error |
Enumeration for load errors.
Evas image load error codes one can get - see evas_load_error_str()
typedef enum _Evas_Native_Surface_Type Evas_Native_Surface_Type |
Native surface types that image object supports.
Enumeration for aspect types or policies.
Pixel format for import call. See evas_object_image_pixels_import()
A smart object base interface definition.
- Since (EFL) :
- 1.7
- Remarks:
- An Evas interface is exactly like the OO-concept: It is a 'contract' or API that the object is declared to support. A smart object may have more than one interface, thus extending the behavior it gets from sub-classing.
A generic data type for video specific surface information.
- Since (EFL) :
- 1.1
Enumeration Type Documentation
enum _Evas_Alloc_Error |
enum _Evas_Aspect_Control |
Enumeration for aspect types or policies for scaling size hints, used for evas_object_size_hint_aspect_set().
- Enumerator:
Enumeration for border fill mode.
- Enumerator:
enum _Evas_Button_Flags |
enum _Evas_Callback_Type |
Identifier of callbacks to be set for Evas canvases or Evas objects.
The following figure illustrates some Evas callbacks:
- Enumerator:
enum _Evas_Device_Class |
Enumeration for device class.
- Enumerator:
enum _Evas_Display_Mode |
Enumeration for object's display modes.
- Enumerator:
enum _Evas_Event_Flags |
Enumeration for events.
- Enumerator:
enum _Evas_Fill_Spread |
Enumeration for spread of image fill.
- Enumerator:
Enumeration for image scale hints.
enum _Evas_Load_Error |
Enumeration for load errors.
- Enumerator:
Native surface types that image object supports.
- Enumerator:
Enumeration for aspect types or policies.