em = ecore_evas_data_get(ee, "emotion");
evas_object_resize(bg, w, h);
- evas_object_resize(em, w, h);
+ evas_object_move(em, 10, 10);
+ evas_object_resize(em, w - 20, h - 20);
}
int
/* Creating the emotion object */
em = _create_emotion_object(e);
emotion_object_file_set(em, eina_list_data_get(curfile));
- evas_object_move(em, 0, 0);
+ evas_object_move(em, 10, 10);
evas_object_resize(em, WIDTH, HEIGHT);
- emotion_object_border_set(em, -30, -30, -30, -30);
+ evas_object_resize(em, WIDTH - 20, HEIGHT - 20);
+ emotion_object_border_set(em, 0, 0, 50, 50);
+ emotion_object_bg_color_set(em, 0, 128, 0, 255);
evas_object_show(em);
ecore_evas_data_set(ee, "emotion", em);
* that respective side of the video will be cropped.
*
* It's possible to set a color for the added borders (default is transparent)
- * with emotion_object_border_color_set(). By default, an Emotion object doesn't
+ * with emotion_object_bg_color_set(). By default, an Emotion object doesn't
* have any border.
*
* @see emotion_object_border_get()
- * @see emotion_object_border_color_set()
+ * @see emotion_object_bg_color_set()
*/
EAPI void emotion_object_border_set(Evas_Object *obj, int l, int r, int t, int b);
EAPI void emotion_object_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b);
/**
+ * @brief Set a color for the background rectangle of this emotion object.
+ *
+ * @param obj The emotion object where the background color is being set.
+ * @param r Red component of the color.
+ * @param g Green component of the color.
+ * @param b Blue component of the color.
+ * @param a Alpha channel of the color.
+ *
+ * This is useful when a border is added to any side of the Emotion object. The
+ * area between the edge of the video and the edge of the object will be filled
+ * with the specified color.
+ *
+ * The default color is 0, 0, 0, 0 (transparent).
+ *
+ * @see emotion_object_bg_color_get()
+ */
+EAPI void emotion_object_bg_color_set(Evas_Object *obj, int r, int g, int b, int a);
+
+/**
+ * @brief Get the background color set for the emotion object.
+ *
+ * @param obj The emotion object from which the background color is being retrieved.
+ * @param r Red component of the color.
+ * @param g Green component of the color.
+ * @param b Blue component of the color.
+ * @param a AAlpha channel of the color.
+ *
+ * @see emotion_object_bg_color_set()
+ */
+EAPI void emotion_object_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a);
+
+/**
* @brief Set the file to be played in the Emotion object.
*
* @param obj The emotion object where the file is being loaded.
const char *file;
Evas_Object *obj;
+ Evas_Object *bg;
Ecore_Job *job;
}
EAPI void
-emotion_object_border_get(Evas_Object *obj, int *l, int *r, int *t, int *b)
+emotion_object_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b)
{
Smart_Data *sd;
}
EAPI void
+emotion_object_bg_color_set(Evas_Object *obj, int r, int g, int b, int a)
+{
+ Smart_Data *sd;
+
+ E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
+
+ evas_object_color_set(sd->bg, r, g, b, a);
+
+ if (!evas_object_visible_get(obj))
+ return;
+
+ if (a > 0)
+ evas_object_show(sd->bg);
+ else
+ evas_object_hide(sd->bg);
+}
+
+EAPI void
+emotion_object_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
+{
+ Smart_Data *sd;
+
+ E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
+ evas_object_color_get(sd->bg, r, g, b, a);
+}
+
+EAPI void
emotion_object_play_set(Evas_Object *obj, Eina_Bool play)
{
Smart_Data *sd;
EINA_REFCOUNT_INIT(sd);
sd->state = EMOTION_WAKEUP;
sd->obj = evas_object_image_add(evas_object_evas_get(obj));
+ sd->bg = evas_object_rectangle_add(evas_object_evas_get(obj));
+ evas_object_color_set(sd->bg, 0, 0, 0, 0);
evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, sd);
evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, sd);
evas_object_image_pixels_get_callback_set(sd->obj, _pixels_get, sd);
evas_object_smart_member_add(sd->obj, obj);
+ evas_object_smart_member_add(sd->bg, obj);
+ evas_object_lower(sd->bg);
sd->ratio = 1.0;
sd->spu.button = -1;
evas_object_image_alpha_set(sd->obj, 0);
int vid_w, vid_h, w, h;
sd->module->video_data_size_get(sd->video, &vid_w, &vid_h);
_clipper_position_size_update(obj, vid_w, vid_h);
+ evas_object_move(sd->bg, x, y);
}
static void
sd->module->video_data_size_get(sd->video, &vid_w, &vid_h);
_clipper_position_size_update(obj, vid_w, vid_h);
+ evas_object_resize(sd->bg, w, h);
}
static void
_smart_show(Evas_Object * obj)
{
Smart_Data *sd;
+ int a;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_show(sd->obj);
if (sd->crop.clipper)
evas_object_show(sd->crop.clipper);
+
+ evas_object_color_get(sd->bg, NULL, NULL, NULL, &a);
+ if (a > 0)
+ evas_object_show(sd->bg);
}
static void
evas_object_hide(sd->obj);
if (sd->crop.clipper)
evas_object_hide(sd->crop.clipper);
+ evas_object_hide(sd->bg);
}
static void
evas_object_clip_set(sd->crop.clipper, clip);
else
evas_object_clip_set(sd->obj, clip);
+ evas_object_clip_set(sd->bg, clip);
}
static void
evas_object_clip_unset(sd->crop.clipper);
else
evas_object_clip_unset(sd->obj);
+ evas_object_clip_unset(sd->bg);
}