/** * Sets alpha data for the given evas gradient object. * * If alpha data is so set, any existing gradient stops will be cleared, * The data is not copied, so if it was allocated, do not free it while it's set. * * @param obj The given evas gradient object. * @param data The alpha data to be set, in a8 format. * @param len The length of the data pointer - multiple of the pixel size. */ EAPI void evas_object_gradient_alpha_data_set(Evas_Object *obj, void *data, int len) { Evas_Object_Gradient *o; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); o = (Evas_Object_Gradient *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); if (o->engine_data) { #ifdef EVAS_FRAME_QUEUING evas_common_pipe_op_grad_flush(o->engine_data); #endif obj->layer->evas->engine.func->gradient_alpha_data_set(obj->layer->evas->engine.data.output, o->engine_data, data, len); } o->gradient_changed = 1; o->changed = 1; evas_object_change(obj); }
static void _evas_map_calc_geom_change(Evas_Object *obj) { int is, was = 0, pass = 0; evas_object_change(obj); evas_object_clip_dirty(obj); if (obj->layer->evas->events_frozen <= 0) { evas_object_recalc_clippees(obj); if (!pass) { if (!obj->smart.smart) { is = evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, 1, 1); if ((is ^ was) && obj->cur.visible) evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, obj->layer->evas->last_timestamp, NULL); } } } evas_object_inform_call_move(obj); evas_object_inform_call_resize(obj); }
static void _evas_map_calc_geom_change(Evas_Object *eo_obj) { int is, was = 0; Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); evas_object_change(eo_obj, obj); evas_object_clip_dirty(eo_obj, obj); if (!(obj->layer->evas->is_frozen)) { evas_object_recalc_clippees(eo_obj, obj); if (!obj->is_smart) { is = evas_object_is_in_output_rect(eo_obj, obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, 1, 1); if ((is ^ was) && obj->cur.visible) evas_event_feed_mouse_move(obj->layer->evas->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, obj->layer->evas->last_timestamp, NULL); } } evas_object_inform_call_move(eo_obj, obj); evas_object_inform_call_resize(eo_obj); }
/** * Sets the rectangle on the gradient object that the gradient will be * drawn to. * * Note that the gradient may be tiled around this one rectangle, * according to its spread value - restrict, repeat, or reflect. To have * only one 'cycle' of the gradient drawn, the spread value must be set * to restrict, or @p x and @p y must be 0 and @p w and @p h need to be * the width and height of the gradient object respectively. * * The default values for the fill parameters is @p x = 0, @p y = 0, * @p w = 32 and @p h = 32. * * @param obj The given evas gradient object. * @param x The X coordinate for the top left corner of the rect. * @param y The Y coordinate for the top left corner of the rect. * @param w The width of the rect. * @param h The height of the rect. */ EAPI void evas_object_gradient_fill_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { Evas_Object_Gradient *o; if (w < 0) w = -w; if (h < 0) h = -h; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); o = (Evas_Object_Gradient *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); if ((o->cur.fill.x == x) && (o->cur.fill.y == y) && (o->cur.fill.w == w) && (o->cur.fill.h == h)) return; o->cur.fill.x = x; o->cur.fill.y = y; o->cur.fill.w = w; o->cur.fill.h = h; o->gradient_changed = 1; o->changed = 1; evas_object_change(obj); }
/** * Adds a color stop to the given evas gradient object. * * The @p delta parameter determines the proportion of the gradient * object that is to be set to the color. For instance, if red is * added with @p delta set to 2, and green is added with @p * delta set to 1, two-thirds will be red or reddish and one-third * will be green or greenish. * * Colors are added from the top downwards. * * @param obj The given evas gradient object. * @param r Red component of the given color. * @param g Green component of the given color. * @param b Blue component of the given color. * @param a Alpha component of the given color. * @param delta Proportion of the gradient object that is this color. */ EAPI void evas_object_gradient_color_stop_add(Evas_Object *obj, int r, int g, int b, int a, int delta) { Evas_Object_Gradient *o; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); o = (Evas_Object_Gradient *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); if (o->engine_data) { #ifdef EVAS_FRAME_QUEUING evas_common_pipe_op_grad_flush(o->engine_data); #endif obj->layer->evas->engine.func->gradient_color_stop_add(obj->layer->evas->engine.data.output, o->engine_data, r, g, b, a, delta); } o->gradient_changed = 1; o->changed = 1; evas_object_change(obj); }
EOLIAN static void _efl_canvas_vg_object_root_node_set(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd, Efl_VG *root_node) { // if the same root is already set if (pd->user_entry && pd->user_entry->root == root_node) return; Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); // check if a file has been already set if (pd->vg_entry) { evas_cache_vg_entry_del(pd->vg_entry); pd->vg_entry = NULL; } // detach/free the old root_node if (pd->user_entry && pd->user_entry->root) { efl_canvas_vg_node_vg_obj_set(pd->user_entry->root, NULL, NULL); efl_parent_set(pd->user_entry->root, NULL); } if (root_node) { if (!pd->user_entry) { pd->user_entry = malloc(sizeof(Vg_User_Entry)); if (!pd->user_entry) { ERR("Failed to alloc user entry data while setting root node"); return; } } pd->user_entry->w = pd->user_entry->h = 0; pd->user_entry->root = root_node; // set the parent so that vg canvas can render it. efl_parent_set(pd->user_entry->root, pd->root); efl_canvas_vg_node_vg_obj_set(root_node, eo_obj, pd); } else if (pd->user_entry) { // drop any surface cache attached to it. ENFN->ector_surface_cache_drop(_evas_engine_context(obj->layer->evas), pd->user_entry->root); free(pd->user_entry); pd->user_entry = NULL; } // force a redraw pd->changed = EINA_TRUE; evas_object_change(eo_obj, obj); }
EAPI void evas_object_lower(Evas_Object *obj) { MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); if (evas_object_intercept_call_lower(obj)) return; if (!((EINA_INLIST_GET(obj))->prev)) { evas_object_inform_call_restack(obj); return; } if (obj->smart.parent) evas_object_smart_member_lower(obj); else { if (obj->in_layer) obj->layer->objects = (Evas_Object *)eina_inlist_promote(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj)); } if (obj->clip.clipees) { evas_object_inform_call_restack(obj); return; } if (obj->layer) evas_render_invalidate(obj->layer->evas); obj->restack = 1; evas_object_change(obj); evas_object_inform_call_restack(obj); if (obj->layer->evas->events_frozen <= 0) { if (!evas_event_passes_through(obj)) { if (!obj->smart.smart) { if (evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, 1, 1) && obj->cur.visible) evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, obj->layer->evas->last_timestamp, NULL); } } } }
/** * Sets the offset of the given evas gradient object's spectrum. * @param obj The given evas gradient object. * @param offset Values can be negative. */ EAPI void evas_object_gradient_offset_set(Evas_Object *obj, float offset) { Evas_Object_Gradient *o; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); o = (Evas_Object_Gradient *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); if (offset == o->cur.map.offset) return; o->cur.map.offset = offset; o->changed = 1; evas_object_change(obj); }
/** * Sets the tiling mode for the given evas gradient object's fill. * @param obj The given evas gradient object. * @param spread One of EVAS_TEXTURE_REFLECT, EVAS_TEXTURE_REPEAT, * EVAS_TEXTURE_RESTRICT, EVAS_TEXTURE_RESTRICT_REFLECT, EVAS_TEXTURE_RESTRICT_REPEAT, * or EVAS_TEXTURE_PAD. */ EAPI void evas_object_gradient_fill_spread_set(Evas_Object *obj, int spread) { Evas_Object_Gradient *o; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); o = (Evas_Object_Gradient *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); if (spread == o->cur.fill.spread) return; o->cur.fill.spread = spread; o->changed = 1; evas_object_change(obj); }
/** * Sets the angle at which the given evas gradient object's fill sits clockwise * from vertical. * @param obj The given evas gradient object. * @param angle Angle in degrees. Can be negative. */ EAPI void evas_object_gradient_fill_angle_set(Evas_Object *obj, Evas_Angle angle) { Evas_Object_Gradient *o; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); o = (Evas_Object_Gradient *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); if (angle == o->cur.fill.angle) return; o->cur.fill.angle = angle; o->changed = 1; evas_object_change(obj); }
/** * Sets the direction of the given evas gradient object's spectrum. * @param obj The given evas gradient object. * @param direction Values are either 1 (the default) or -1. */ EAPI void evas_object_gradient_direction_set(Evas_Object *obj, int direction) { Evas_Object_Gradient *o; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); o = (Evas_Object_Gradient *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); if (direction == o->cur.map.direction) return; o->cur.map.direction = direction; o->changed = 1; o->gradient_changed = 1; evas_object_change(obj); }
/** * Adds a gradient object to the given evas. * @param e The given evas. * @return A new evas gradient object if successful. Otherwise, @c NULL. * @ingroup Evas_Object_Gradient_Group */ EAPI Evas_Object * evas_object_gradient_add(Evas *e) { Evas_Object *obj; MAGIC_CHECK(e, Evas, MAGIC_EVAS); return NULL; MAGIC_CHECK_END(); obj = evas_object_new(e); evas_object_gradient_init(obj); evas_object_inject(obj, e); if (obj->object_data) { Evas_Object_Gradient *o = (Evas_Object_Gradient *)(obj->object_data); o->engine_data = e->engine.func->gradient_new(e->engine.data.output); } evas_object_change(obj); return obj; }
EAPI void evas_object_map_enable_set(Evas_Object *obj, Eina_Bool enabled) { MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); enabled = !!enabled; if (obj->cur.usemap == enabled) return; obj->cur.usemap = enabled; if (enabled) { if (!obj->cur.map) obj->cur.map = _evas_map_new(4); evas_object_mapped_clip_across_mark(obj); // obj->cur.map->normal_geometry = obj->cur.geometry; } else { if (obj->cur.map) { _evas_map_calc_geom_change(obj); evas_object_mapped_clip_across_mark(obj); //FIXME: Since the last frame is not updated when map is //disabled, afterimage problem is happened in s/w rendering. //Need to find out the fundamental reason then fix it. evas_damage_rectangle_add(obj->layer->evas, 0, 0, obj->layer->evas->output.w, obj->layer->evas->output.h); } } _evas_map_calc_map_geometry(obj); /* This is a bit heavy handed, but it fixes the case of same geometry, but * changed colour or UV settings. */ evas_object_change(obj); }
static void _update_vgtree_viewport(Eo *obj, Efl_Canvas_Vg_Object_Data *pd) { double vb_w, vb_h, vp_w, vp_h, scale_w, scale_h, scale; Eina_Size2D sz = efl_gfx_entity_size_get(obj); Eina_Matrix3 m; eina_matrix3_identity(&m); vb_w = pd->viewbox.w; vb_h = pd->viewbox.h; vp_w = sz.w; vp_h = sz.h; scale_w = vp_w / vb_w; scale_h = vp_h / vb_h; if (pd->fill_mode == EFL_CANVAS_VG_FILL_MODE_STRETCH) { // Fill the viewport and ignore the aspect ratio eina_matrix3_scale(&m, scale_w, scale_h); eina_matrix3_translate(&m, -pd->viewbox.x, -pd->viewbox.y); } else { if (pd->fill_mode == EFL_CANVAS_VG_FILL_MODE_MEET) scale = scale_w < scale_h ? scale_w : scale_h; else // slice scale = scale_w > scale_h ? scale_w : scale_h; eina_matrix3_translate(&m, (vp_w - vb_w * scale) * pd->align_x, (vp_h - vb_h * scale) * pd->align_y); eina_matrix3_scale(&m, scale, scale); eina_matrix3_translate(&m, -pd->viewbox.x, -pd->viewbox.y); } efl_canvas_vg_node_transformation_set(pd->root, &m); pd->changed = EINA_TRUE; evas_object_change(obj, efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS)); }
/** * Sets the geometric type displayed by the given gradient object. * @param obj The given gradient object. * @param name Name of the geometric type that the gradient is to be drawn as. * @param params List of allowable params that the given gradient type allows. * Can be NULL. */ EAPI void evas_object_gradient_type_set(Evas_Object *obj, const char *name, const char *params) { Evas_Object_Gradient *o; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); o = (Evas_Object_Gradient *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); if (!name || !*name) { name = "linear"; params = NULL; } if (params && !*params) params = NULL; if ((o->cur.type.name) && (!strcmp(o->cur.type.name, name))) { if ((!o->cur.type.params) && (!params)) return; if ((o->cur.type.params) && (params) && (!strcmp(o->cur.type.params, params))) return; if (o->cur.type.params) { if (o->prev.type.params == o->cur.type.params) o->prev.type.params = strdup(o->cur.type.params); free(o->cur.type.params); o->cur.type.params = NULL; } if (params) o->cur.type.params = strdup(params); o->changed = 1; o->gradient_changed = 1; o->type_changed = 1; evas_object_change(obj); return; } if (o->cur.type.name) { if (o->prev.type.name == o->cur.type.name) o->prev.type.name = strdup(o->cur.type.name); free(o->cur.type.name); o->cur.type.name = NULL; } o->cur.type.name = strdup(name); if (o->cur.type.params) { if (o->prev.type.params == o->cur.type.params) o->prev.type.params = strdup(o->cur.type.params); free(o->cur.type.params); o->cur.type.params = NULL; } if (params) o->cur.type.params = strdup(params); o->changed = 1; o->gradient_changed = 1; o->type_changed = 1; evas_object_change(obj); }
static void _line_xy_set(Eo *eo_obj, void *_pd, va_list *list) { Evas_Coord x1 = va_arg(*list, Evas_Coord); Evas_Coord y1 = va_arg(*list, Evas_Coord); Evas_Coord x2 = va_arg(*list, Evas_Coord); Evas_Coord y2 = va_arg(*list, Evas_Coord); Evas_Object_Line *o = _pd; Evas_Coord min_x, max_x, min_y, max_y; int is, was = 0; MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); if ((x1 == o->cur.x1) && (y1 == o->cur.y1) && (x2 == o->cur.x2) && (y2 == o->cur.y2)) return; Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); if (!(obj->layer->evas->is_frozen)) { if (!evas_event_passes_through(eo_obj, obj) && !evas_event_freezes_through(eo_obj, obj) && !evas_object_is_source_invisible(eo_obj, obj)) was = evas_object_is_in_output_rect(eo_obj, obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, 1, 1); } if (x1 < x2) { min_x = x1; max_x = x2; } else { min_x = x2; max_x = x1; } if (y1 < y2) { min_y = y1; max_y = y2; } else { min_y = y2; max_y = y1; } obj->cur.geometry.x = min_x; obj->cur.geometry.y = min_y; obj->cur.geometry.w = max_x - min_x + 2; obj->cur.geometry.h = max_y - min_y + 2; //// obj->cur.cache.geometry.validity = 0; o->cur.x1 = x1 - min_x; o->cur.y1 = y1 - min_y; o->cur.x2 = x2 - min_x; o->cur.y2 = y2 - min_y; o->changed = EINA_TRUE; evas_object_change(eo_obj, obj); evas_object_coords_recalc(eo_obj, obj); evas_object_clip_dirty(eo_obj, obj); if (!(obj->layer->evas->is_frozen)) { is = evas_object_is_in_output_rect(eo_obj, obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, 1, 1); if (!evas_event_passes_through(eo_obj, obj) && !evas_event_freezes_through(eo_obj, obj) && !evas_object_is_source_invisible(eo_obj, obj)) { if ((is ^ was) && obj->cur.visible) evas_event_feed_mouse_move(obj->layer->evas->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, obj->layer->evas->last_timestamp, NULL); } } evas_object_inform_call_move(eo_obj, obj); evas_object_inform_call_resize(eo_obj); }
EAPI void evas_object_line_xy_set(Evas_Object *obj, Evas_Coord x1, Evas_Coord y1, Evas_Coord x2, Evas_Coord y2) { Evas_Object_Line *o; Evas_Coord min_x, max_x, min_y, max_y; int is, was = 0; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); o = (Evas_Object_Line *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Line, MAGIC_OBJ_LINE); return; MAGIC_CHECK_END(); if ((x1 == o->cur.x1) && (y1 == o->cur.y1) && (x2 == o->cur.x2) && (y2 == o->cur.y2)) return; if (obj->layer->evas->events_frozen <= 0) { if (!evas_event_passes_through(obj) && !evas_event_freezes_through(obj)) was = evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, 1, 1); } if (x1 < x2) { min_x = x1; max_x = x2; } else { min_x = x2; max_x = x1; } if (y1 < y2) { min_y = y1; max_y = y2; } else { min_y = y2; max_y = y1; } obj->cur.geometry.x = min_x; obj->cur.geometry.y = min_y; obj->cur.geometry.w = max_x - min_x + 2; obj->cur.geometry.h = max_y - min_y + 2; //// obj->cur.cache.geometry.validity = 0; o->cur.x1 = x1 - min_x; o->cur.y1 = y1 - min_y; o->cur.x2 = x2 - min_x; o->cur.y2 = y2 - min_y; o->changed = 1; evas_object_change(obj); evas_object_coords_recalc(obj); evas_object_clip_dirty(obj); if (obj->layer->evas->events_frozen <= 0) { is = evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, 1, 1); if (!evas_event_passes_through(obj) && !evas_event_freezes_through(obj)) { if ((is ^ was) && obj->cur.visible) evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, obj->layer->evas->last_timestamp, NULL); } } evas_object_inform_call_move(obj); evas_object_inform_call_resize(obj); }
EAPI void evas_object_stack_below(Evas_Object *obj, Evas_Object *below) { MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); MAGIC_CHECK(below, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); if (obj == below) return; if (evas_object_intercept_call_stack_below(obj, below)) return; if (!below) { evas_object_lower(obj); return; } if ((EINA_INLIST_GET(obj))->next == EINA_INLIST_GET(below)) { evas_object_inform_call_restack(obj); return; } if (obj->smart.parent) { if (obj->smart.parent != below->smart.parent) { ERR("BITCH! evas_object_stack_below(), %p not inside same smart as %p!", obj, below); return; } evas_object_smart_member_stack_below(obj, below); } else { if (below->smart.parent) { ERR("BITCH! evas_object_stack_below(), %p stack below %p, but below has smart parent, obj does not", obj, below); return; } if (obj->layer != below->layer) { ERR("BITCH! evas_object_stack_below(), %p stack below %p, not matching layers", obj, below); return; } if (obj->in_layer) { obj->layer->objects = (Evas_Object *)eina_inlist_remove(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj)); obj->layer->objects = (Evas_Object *)eina_inlist_prepend_relative(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj), EINA_INLIST_GET(below)); } } if (obj->clip.clipees) { evas_object_inform_call_restack(obj); return; } if (obj->layer) evas_render_invalidate(obj->layer->evas); obj->restack = 1; evas_object_change(obj); evas_object_inform_call_restack(obj); if (obj->layer->evas->events_frozen <= 0) { if (!evas_event_passes_through(obj)) { if (!obj->smart.smart) { if (evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, 1, 1) && obj->cur.visible) evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, obj->layer->evas->last_timestamp, NULL); } } } }