efl.evas.Canvas
Class¶
- class efl.evas.Canvas(method=None, size=None, viewport=None)¶
Bases:
efl.eo.Eo
The Evas Canvas.
Canvas is the base drawing area and scene manager, it should have a number of objects (or actors) that will be managed. Object state is monitored and redraw is optimized based on changes.
- Variables
rect –
Rect
describing object geometry, for easy manipulation. Changing thisRect
will not affect current geometry, you have to set it again to have this behavior.
Attention
Canvas must be associated with an Input/Output system in order to be functional. So far it’s impossible to do this association directly from Python, so you should create Canvas indirectly using
efl.elementary
classes, likeefl.elementary.window.Window
.- Box(**kargs)¶
Factory of
efl.evas.Box
associated with this canvas.- Return type
- FilledImage(**kargs)¶
Factory of
efl.evas.FilledImage
associated with this canvas.- Return type
- Image(**kargs)¶
Factory of
efl.evas.Image
associated with this canvas.- Return type
- Line(**kargs)¶
Factory of
efl.evas.Line
associated with this canvas.- Return type
- Polygon(**kargs)¶
Factory of
efl.evas.Polygon
associated with this canvas.- Return type
- Rectangle(**kargs)¶
Factory of
efl.evas.Rectangle
associated with this canvas.- Return type
- Text(**kargs)¶
Factory of
efl.evas.Text
associated with this canvas.- Return type
- Textblock(**kargs)¶
Factory of
efl.evas.Textblock
associated with this canvas.- Return type
- bottom_get()¶
- Return type
- coord_screen_x_to_world(x)¶
- Return type
int
- coord_screen_y_to_world(y)¶
- Return type
int
- coord_world_x_to_screen(x)¶
- Return type
int
- coord_world_y_to_screen(y)¶
- Return type
int
- damage_rectangle_add(x, y, w, h)¶
- delete()¶
- engine_info_get()¶
Get the engine information pointer.
Note that given value is a pointer and is totally engine and platform dependent.
This call is very low level and is meant for extension to use, they usually do the machinery in C and just handle pointers as integers.
If in doubt, don’t mess with it.
- Returns
pointer as integer (uintptr_t).
- engine_info_set(ptr)¶
Set the engine information pointer.
Note that given value is a pointer, usually acquired with
engine_info_get()
and is totally engine and platform dependent.This call is very low level and is meant for extension to use, they usually do the machinery in C and just handle pointers as integers.
If in doubt, don’t mess with it.
- event_callback_add(type, func, *args, **kargs)¶
Add a new callback for the given event.
- Parameters
type – an integer with event type code, like EVAS_CALLBACK_CANVAS_FOCUS_IN, EVAS_CALLBACK_RENDER_FLUSH_PRE and other EVAS_CALLBACK_ constants.
func –
function to call back, this function will have one of the following signatures:
function(object, event, *args, **kargs) function(object, *args, **kargs)
The former is used by events that provide more data (none so far), while the second is used by events without. Parameters given at the end of event_callback_add() will be given to the callback. Note that the object passed to the callback in event parameter will only be valid during the callback, using it after callback returns will raise an ValueError.
- Raises
ValueError – if type is unknown.
TypeError – if func is not callable.
- event_callback_del(type, func)¶
Remove callback for the given event.
- Parameters
type – an integer with event type code.
func – function used with
event_callback_add()
.
- Precond
type and func must be used as parameter for
event_callback_add()
.- Raises
ValueError – if type is unknown or if there was no func connected with this type.
- event_freeze()¶
Pause event propagation for this object.
- event_freeze_count_get()¶
Get the event freeze count for this object.
- Returns
the freeze count
- Return type
int
- event_thaw()¶
Restart event propagation for this object.
- feed_hold(hold, timestamp)¶
Emit a feed_hold event in the canvas
- feed_key_down(*keyname, *key, *string, *compose, timestamp)¶
Emit a key_down event in the canvas
- feed_key_up(*keyname, *key, *string, *compose, timestamp)¶
Emit a key_up event in the canvas
- feed_mouse_cancel(timestamp)¶
Emit a mouse_cancel event in the canvas
- feed_mouse_down(b, flags, timestamp)¶
Emit a mouse_down event in the canvas
- feed_mouse_in(timestamp)¶
Emit a mouse_in event in the canvas
- feed_mouse_move(x, y, timestamp)¶
Emit a mouse_move event in the canvas
- feed_mouse_out(timestamp)¶
Emit a mouse_out event in the canvas
- feed_mouse_up(b, flags, timestamp)¶
Emit a mouse_up event in the canvas
- feed_mouse_wheel(direction, z, timestamp)¶
Emit a mouse_wheel event in the canvas
- feed_multi_down(d, x, y, rad, radx, rady, pres, ang, fx, fy, flags, timestamp)¶
Emit a multi_down event in the canvas
- feed_multi_move(d, x, y, rad, radx, rady, pres, ang, fx, fy, timestamp)¶
Emit a multi_move event in the canvas
- feed_multi_up(d, x, y, rad, radx, rady, pres, ang, fx, fy, flags, timestamp)¶
Emit a multi_up event in the canvas
- focus_get()¶
- Return type
- font_available_list()¶
- Return type
list of str
- font_cache_flush()¶
- font_cache_get()¶
- Return type
int
- font_cache_set(value)¶
- font_hinting_can_hint(flags)¶
- Return type
bool
- font_hinting_get()¶
- Return type
int
- font_hinting_set(flags)¶
- Parameters
flags –
One of
EVAS_FONT_HINTING_NONE
EVAS_FONT_HINTING_AUTO
EVAS_FONT_HINTING_BYTECODE
- font_path_append(path)¶
- font_path_clear()¶
- font_path_list()¶
- Return type
list of str
- font_path_prepend(path)¶
- freeze()¶
Freeze event processing
- freeze_get()¶
- Return type
int
- image_cache_flush()¶
- image_cache_get()¶
- Return type
int
- image_cache_reload()¶
- image_cache_set(size)¶
- is_deleted()¶
Check if the object has been deleted thus leaving the object shallow.
- Returns
True if the object has been deleted yet, False otherwise.
- Return type
bool
- key_modifier_is_set(modifier)¶
- Return type
bool
- norender()¶
- object_name_find(name)¶
Find object by name.
- Parameters
name –
- Return type
- objects_at_xy_get(x, y, include_pass_events_objects=False, include_hidden_objects=False)¶
Get all children at (x, y).
- Parameters
x –
y –
include_pass_events_objects – if to include objects passing events.
include_hidden_objects – if to include hidden objects.
- Returns
children objects.
- Return type
List of
efl.evas.Object
- objects_in_rectangle_get(x, y, w, h, include_pass_events_objects=False, include_hidden_objects=False)¶
Get all children at given geometry.
- Parameters
x –
y –
w –
h –
include_pass_events_objects – if to include objects passing events.
include_hidden_objects – if to include hidden objects.
- Returns
children objects.
- Return type
List of
efl.evas.Object
- obscured_clear()¶
- obscured_rectangle_add(x, y, w, h)¶
- on_canvas_focus_in_add(func, *a, **k)¶
Same as event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_IN, …)
Expected signature:
function(object, *args, **kargs)
- on_canvas_focus_in_del(func)¶
Same as event_callback_del(EVAS_CALLBACK_CANVAS_FOCUS_IN, …)
- on_canvas_focus_out_add(func, *a, **k)¶
Same as event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_OUT, …)
Expected signature:
function(object, *args, **kargs)
- on_canvas_focus_out_del(func)¶
Same as event_callback_del(EVAS_CALLBACK_CANVAS_FOCUS_OUT, …)
- on_render_flush_post_add(func, *a, **k)¶
Same as event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_POST, …)
Expected signature:
function(object, *args, **kargs)
- on_render_flush_post_del(func)¶
Same as event_callback_del(EVAS_CALLBACK_RENDER_FLUSH_POST, …)
- on_render_flush_pre_add(func, *a, **k)¶
Same as event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_PRE, …)
Expected signature:
function(object, *args, **kargs)
- on_render_flush_pre_del(func)¶
Same as event_callback_del(EVAS_CALLBACK_RENDER_FLUSH_PRE, …)
- output_method_get()¶
- output_method_set(method)¶
Set canvas render method, can be either a name or id.
- Parameters
method – name(str) or id(int) of the method to set
- parent¶
The parent object
- Type
Eo
- parent_get()¶
- parent_set(parent)¶
- pointer_button_down_mask_get()¶
Returns a bitmask with the mouse buttons currently pressed set to 1.
The least significant bit corresponds to the first mouse button (button 1) and the most significant bit corresponds to the last mouse button (button 32).
- Return type
int
- pointer_canvas_xy_get()¶
Returns the pointer’s (x, y) relative to canvas.
- pointer_inside_get()¶
Returns whether the mouse pointer is logically inside the canvas.
- Return type
bool
- pointer_output_xy_get()¶
Returns the pointer’s (x, y) relative to output.
- render()¶
Force canvas to redraw pending updates.
- render_updates()¶
- size_get()¶
- Returns
the tuple of int: (w, h)
- size_set(w, h)¶
Set canvas size.
- Parameters
w –
h –
- thaw()¶
Thaw (unfreeze) event processing
- top_at_pointer_get()¶
Get the topmost object at pointer position.
- Returns
child object.
- Return type
- top_at_xy_get(x, y, include_pass_events_objects=False, include_hidden_objects=False)¶
Get the topmost object at (x, y).
- Parameters
x –
y –
include_pass_events_objects – if to include objects passing events.
include_hidden_objects – if to include hidden objects.
- Returns
child object.
- Return type
- top_get()¶
- Return type
- top_in_rectangle_get(x, y, w, h, include_pass_events_objects=False, include_hidden_objects=False)¶
Get the topmost object at given geometry.
- Parameters
x –
y –
w –
h –
include_pass_events_objects – if to include objects passing events.
include_hidden_objects – if to include hidden objects.
- Returns
child object.
- Return type
- viewport_get()¶
- Returns
the tuple of int: (x, y, w, h)
- viewport_set(x, y, w, h)¶
Sets the output viewport of the given evas in evas units.
- Parameters
x –
y –
w –
h –
The output viewport is the area of the evas that will be visible to the viewer. The viewport will be stretched to fit the output target of the evas when rendering is performed.
Note
The coordinate values do not have to map 1-to-1 with the output target. However, it is generally advised that it is done for ease of use.