Render Engine Functions

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

Functions

int evas_render_method_lookup (const char *name)
 Look up a numeric ID from a string name of a rendering engine. More...
 
Eina_Listevas_render_method_list (void)
 List all the rendering engines compiled into the copy of the Evas library. More...
 
void evas_render_method_list_free (Eina_List *list)
 This function should be called to free a list of engine names. More...
 
void evas_output_method_set (Evas *e, int render_method)
 Sets the output engine for the given evas. More...
 
int evas_output_method_get (const Evas *e)
 Retrieves the number of the output engine used for the given evas. More...
 
Evas_Engine_Infoevas_engine_info_get (const Evas *e)
 Retrieves the current render engine info struct from the given evas. More...
 
Eina_Bool evas_engine_info_set (Evas *e, Evas_Engine_Info *info)
 Applies the engine settings for the given evas from the given Evas_Engine_Info structure. More...
 

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 = evas_new();
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));

Function Documentation

int evas_render_method_lookup ( const char *  name)

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

Parameters
namethe 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:

1 int engine_id;
2 Evas *evas;
3 
4 evas_init();
5 
6 evas = evas_new();
7 if (!evas)
8  {
9  fprintf(stderr, "ERROR: Canvas creation failed. Fatal error.\n");
10  exit(-1);
11  }
12 engine_id = evas_render_method_lookup("software_x11");
13 if (!engine_id)
14  {
15  fprintf(stderr, "ERROR: Requested rendering engine is absent.\n");
16  exit(-1);
17  }
18 evas_output_method_set(evas, engine_id);

Referenced by ecore_evas_buffer_allocfunc_new(), ecore_evas_ews_new(), and ecore_evas_object_image_new().

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:

1 Eina_List *engine_list, *l;
2 char *engine_name;
3 
4 engine_list = evas_render_method_list();
5 if (!engine_list)
6  {
7  fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
8  exit(-1);
9  }
10 printf("Available Evas Engines:\n");
11 EINA_LIST_FOREACH(engine_list, l, engine_name)
12  printf("%s\n", engine_name);
13 evas_render_method_list_free(engine_list);
void evas_render_method_list_free ( Eina_List list)

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

Parameters
listThe 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:

1 Eina_List *engine_list, *l;
2 char *engine_name;
3 
4 engine_list = evas_render_method_list();
5 if (!engine_list)
6  {
7  fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
8  exit(-1);
9  }
10 printf("Available Evas Engines:\n");
11 EINA_LIST_FOREACH(engine_list, l, engine_name)
12  printf("%s\n", engine_name);
13 evas_render_method_list_free(engine_list);

References EINA_LIST_FREE, and eina_stringshare_del().

void evas_output_method_set ( Evas e,
int  render_method 
)

Sets the output engine for the given evas.

Once the output engine for an evas is set, any attempt to change it will be ignored. The value for render_method can be found using evas_render_method_lookup .

Parameters
eThe given evas.
render_methodThe numeric engine value to use.
Attention
it is mandatory that one calls evas_init() before setting the output method.

References evas_canvas_output_method_set.

Referenced by ecore_evas_buffer_allocfunc_new(), ecore_evas_ews_new(), and ecore_evas_object_image_new().

int evas_output_method_get ( const Evas e)

Retrieves the number of the output engine used for the given evas.

Parameters
eThe given evas.
Returns
The ID number of the output engine being used. 0 is returned if there is an error.

References evas_canvas_output_method_get.

Evas_Engine_Info* evas_engine_info_get ( const Evas e)

Retrieves the current render engine info struct from the given evas.

The returned structure is publicly modifiable. The contents are valid until either evas_engine_info_set or evas_render are called.

This structure does not need to be freed by the caller.

Parameters
eThe given evas.
Returns
A pointer to the Engine Info structure. NULL is returned if an engine has not yet been assigned.

References evas_canvas_engine_info_get.

Referenced by ecore_evas_buffer_allocfunc_new(), ecore_evas_ews_new(), and ecore_evas_object_image_new().

Eina_Bool evas_engine_info_set ( Evas e,
Evas_Engine_Info info 
)

Applies the engine settings for the given evas from the given Evas_Engine_Info structure.

To get the Evas_Engine_Info structure to use, call evas_engine_info_get . Do not try to obtain a pointer to an Evas_Engine_Info structure in any other way.

You will need to call this function at least once before you can create objects on an evas or render that evas. Some engines allow their settings to be changed more than once.

Once called, the info pointer should be considered invalid.

Parameters
eThe pointer to the Evas Canvas
infoThe pointer to the Engine Info to use
Returns
EINA_TRUE if no error occurred, EINA_FALSE otherwise.

References EINA_FALSE, and evas_canvas_engine_info_set.

Referenced by ecore_evas_buffer_allocfunc_new(), ecore_evas_ews_new(), and ecore_evas_object_image_new().