Render Engine Functions

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Functions
Render Engine Functions
Evas » Canvas Functions

Functions that are used to set the render engine for a given function, and then get that engine working. More...

## Functions
EVAS_API int | evas_render_method_lookup (const char *name)
| Look up a numeric ID from a string name of a rendering engine.
EVAS_API Eina_List * | evas_render_method_list (void)
| List all the rendering engines compiled into the copy of the Evas library.
EVAS_API void | evas_render_method_list_free (Eina_List *list)
| This function should be called to free a list of engine names.

## Detailed Description

Functions that are used to set the render engine for a given function, and then get that engine working.

The following code snippet shows how they can be used to initialise an evas that uses the X11 software engine:

Evas *evas;
Evas_Engine_Info_Software_X11 *einfo;
extern Display *display;
extern Window win;
evas_init();
evas = evas_new();
evas_output_method_set(evas, evas_render_method_lookup("software_x11"));
evas_output_size_set(evas, 640, 480);
evas_output_viewport_set(evas, 0, 0, 640, 480);
einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas);
einfo->info.display = display;
einfo->info.visual = DefaultVisual(display, DefaultScreen(display));
einfo->info.colormap = DefaultColormap(display, DefaultScreen(display));
einfo->info.drawable = win;
einfo->info.depth = DefaultDepth(display, DefaultScreen(display));
evas_engine_info_set(evas, (Evas_Engine_Info *)einfo);
evas_engine_info_get
EVAS_API Evas_Engine_Info * evas_engine_info_get(const Evas *obj)
Retrieves the current render engine info struct from the given evas.
Definition: evas_main.c:677
Evas
Eo Evas
An opaque handle to an Evas canvas.
Definition: Evas_Common.h:163
evas_output_method_set
EVAS_API void evas_output_method_set(Evas *eo_e, int render_method)
Sets the output engine for the given evas.
Definition: evas_main.c:1292
evas_output_size_set
EVAS_API void evas_output_size_set(Evas *eo_e, int w, int h)
Sets the output size of the render engine of the given evas.
Definition: evas_main.c:1374
evas_engine_info_set
EVAS_API Eina_Bool evas_engine_info_set(Evas *obj, Evas_Engine_Info *info)
Applies the engine settings for the given evas from the given Evas_Engine_Info structure.
Definition: evas_main.c:696
evas_output_viewport_set
EVAS_API void evas_output_viewport_set(Evas *eo_e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
Sets the output viewport of the given evas in evas units.
Definition: evas_main.c:1413
evas_new
EVAS_API Evas * evas_new(void)
Creates a new empty evas.
Definition: evas_main.c:309
evas_init
EVAS_API int evas_init(void)
Directly initialize Evas and its required dependencies.
Definition: evas_main.c:152
evas_render_method_lookup
EVAS_API int evas_render_method_lookup(const char *name)
Look up a numeric ID from a string name of a rendering engine.
Definition: evas_main.c:754
_Evas_Engine_Info
Generic engine information.
Definition: Evas_Legacy.h:48

## Function Documentation

## ◆ evas_render_method_lookup()

EVAS_API int evas_render_method_lookup | ( | const char * | name | ) |

Look up a numeric ID from a string name of a rendering engine.

Parameters

  name | the name string of an engine

Returns
  A numeric (opaque) ID for the rendering engine

This function looks up a numeric return value for the named engine in the string `name`. This is a normal C string, NUL byte terminated. The name is case sensitive. If the rendering engine is available, a numeric ID for that engine is returned that is not 0. If the engine is not available, 0 is returned, indicating an invalid engine.

The programmer should NEVER rely on the numeric ID of an engine unless it is returned by this function. Programs should NOT be written accessing render method ID's directly, without first obtaining it from this function.

Attention
  it is mandatory that one calls evas_init() before looking up the render method.

Example:

int engine_id;
Evas *evas;
evas_init();
evas = evas_new();
if (!evas)
{
fprintf(stderr, "ERROR: Canvas creation failed. Fatal error.\n");
exit(-1);
}
engine_id = evas_render_method_lookup("software_x11");
if (!engine_id)
{
fprintf(stderr, "ERROR: Requested rendering engine is absent.\n");
exit(-1);
}
evas_output_method_set(evas, engine_id);

Referenced by ecore_evas_buffer_allocfunc_new(), and ecore_evas_object_image_new().

## ◆ evas_render_method_list()

EVAS_API Eina_List * evas_render_method_list | ( | void |  | ) |

List all the rendering engines compiled into the copy of the Evas library.

Returns
  A linked list whose data members are C strings of engine names

Calling this will return a handle (pointer) to an Evas linked list. Each node in the linked list will have the data pointer be a (char *) pointer to the name string of the rendering engine available. The strings should never be modified, neither should the list be modified. This list should be cleaned up as soon as the program no longer needs it using evas_render_method_list_free(). If no engines are available from Evas, `NULL` will be returned.

Example:

Eina_List *engine_list, *l;
char *engine_name;
engine_list = evas_render_method_list();
if (!engine_list)
{
fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
exit(-1);
}
printf("Available Evas Engines:\n");
EINA_LIST_FOREACH(engine_list, l, engine_name)
printf("%s\n", engine_name);
evas_render_method_list_free(engine_list);
EINA_LIST_FOREACH
#define EINA_LIST_FOREACH(list, l, _data)
Definition for the macro to iterate over a list.
Definition: eina_list.h:1415
evas_render_method_list_free
EVAS_API void evas_render_method_list_free(Eina_List *list)
This function should be called to free a list of engine names.
Definition: evas_main.c:773
evas_render_method_list
EVAS_API Eina_List * evas_render_method_list(void)
List all the rendering engines compiled into the copy of the Evas library.
Definition: evas_main.c:767
_Eina_List
Type for a generic double linked list.
Definition: eina_list.h:318

## ◆ evas_render_method_list_free()

EVAS_API void evas_render_method_list_free | ( | Eina_List * | list | ) |

This function should be called to free a list of engine names.

Parameters

  list | The Eina_List base pointer for the engine list to be freed

When this function is called it will free the engine list passed in as `list`. The list should only be a list of engines generated by calling evas_render_method_list(). If `list` is NULL, nothing will happen.

Example:

Eina_List *engine_list, *l;
char *engine_name;
engine_list = evas_render_method_list();
if (!engine_list)
{
fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
exit(-1);
}
printf("Available Evas Engines:\n");
EINA_LIST_FOREACH(engine_list, l, engine_name)
printf("%s\n", engine_name);
evas_render_method_list_free(engine_list);

References EINA_LIST_FREE, and eina_stringshare_del().