static Eina_Bool
_elm_image_edje_file_set(Evas_Object *obj,
const char *file,
- Eina_File *f,
+ const Eina_File *f,
const char *group)
{
Evas_Object *pclip;
return ret;
}
+EAPI Eina_Bool
+elm_image_mmap_set(Evas_Object *obj,
+ const Eina_File *file,
+ const char *group)
+{
+ Eina_Bool ret = EINA_FALSE;
+
+ ELM_IMAGE_CHECK(obj) EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE);
+ eo_do(obj,
+ elm_obj_image_mmap_set(file, group, &ret),
+ elm_obj_image_sizing_eval());
+ return ret;
+}
+
static void
_elm_image_smart_internal_file_set(Eo *obj, Elm_Image_Smart_Data *sd,
- const char *file, Eina_File *f, const char *key, Eina_Bool *ret)
+ const char *file, const Eina_File *f, const char *key, Eina_Bool *ret)
{
if (eina_str_has_extension(file, ".edj"))
{
_elm_image_smart_internal_file_set(obj, sd, file, NULL, key, ret);
}
+static void
+_elm_image_smart_mmap_set(Eo *obj, void *_pd, va_list *list)
+{
+ const Eina_File *f = va_arg(*list, const Eina_File *);
+ const char *key = va_arg(*list, const char*);
+ Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+
+ Elm_Image_Smart_Data *sd = _pd;
+
+ if (sd->remote) elm_url_cancel(sd->remote);
+ sd->remote = NULL;
+
+ _elm_image_smart_internal_file_set(obj, sd,
+ eina_file_filename_get(f), f,
+ key, ret);
+}
+
EAPI void
elm_image_file_get(const Evas_Object *obj,
const char **file,
EO_OP_FUNC(ELM_OBJ_IMAGE_ID(ELM_OBJ_IMAGE_SUB_ID_LOAD_SIZE_GET), _elm_image_smart_load_size_get),
EO_OP_FUNC(ELM_OBJ_IMAGE_ID(ELM_OBJ_IMAGE_SUB_ID_MEMFILE_SET), _elm_image_smart_memfile_set),
+ EO_OP_FUNC(ELM_OBJ_IMAGE_ID(ELM_OBJ_IMAGE_SUB_ID_MMAP_SET), _elm_image_smart_mmap_set),
EO_OP_FUNC(ELM_OBJ_IMAGE_ID(ELM_OBJ_IMAGE_SUB_ID_ORIENT_SET), _elm_image_smart_orient_set),
EO_OP_FUNC(ELM_OBJ_IMAGE_ID(ELM_OBJ_IMAGE_SUB_ID_ORIENT_GET), _elm_image_smart_orient_get),
EO_OP_DESCRIPTION(ELM_OBJ_IMAGE_SUB_ID_LOAD_SIZE_GET, "'Virtual' function on retrieving the object's image loading size."),
EO_OP_DESCRIPTION(ELM_OBJ_IMAGE_SUB_ID_MEMFILE_SET, "Set a location in memory to be used as an image object's source bitmap."),
+ EO_OP_DESCRIPTION(ELM_OBJ_IMAGE_SUB_ID_MMAP_SET, "Set an Eina_File to be used as an image object's source bitmap."),
EO_OP_DESCRIPTION(ELM_OBJ_IMAGE_SUB_ID_ORIENT_SET, "Set the image orientation."),
EO_OP_DESCRIPTION(ELM_OBJ_IMAGE_SUB_ID_ORIENT_GET, "Get the image orientation."),
ELM_OBJ_IMAGE_SUB_ID_LOAD_SIZE_GET,
ELM_OBJ_IMAGE_SUB_ID_MEMFILE_SET,
+ ELM_OBJ_IMAGE_SUB_ID_MMAP_SET,
ELM_OBJ_IMAGE_SUB_ID_ORIENT_SET,
ELM_OBJ_IMAGE_SUB_ID_ORIENT_GET,
#define elm_obj_image_file_set(file, group, ret) ELM_OBJ_IMAGE_ID(ELM_OBJ_IMAGE_SUB_ID_FILE_SET), EO_TYPECHECK(const char *, file), EO_TYPECHECK(const char *, group), EO_TYPECHECK(Eina_Bool *, ret)
/**
+ * @def elm_obj_image_mmap_set
+ * @since 1.8
+ *
+ * Set the file that will be used as the image's source.
+ *
+ * @param[in] file
+ * @param[in] group
+ * @param[out] ret
+ *
+ * @see elm_image_mmap_set
+ */
+#define elm_obj_image_mmap_set(file, group, ret) ELM_OBJ_IMAGE_ID(ELM_OBJ_IMAGE_SUB_ID_MMAP_SET), EO_TYPECHECK(const Eina_File *, file), EO_TYPECHECK(const char *, group), EO_TYPECHECK(Eina_Bool *, ret)
+
+/**
* @def elm_obj_image_file_get
* @since 1.8
*
* Set the file that will be used as the image's source.
*
* @param obj The image object
+ * @param file The handler to an Eina_File that will be used as image source
+ * @param group The group that the image belongs to, in case it's an
+ * EET (including Edje case) file. This can be used as a key inside
+ * evas image cache if this is a normal image file not eet file.
+ *
+ * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
+ *
+ * @see elm_image_file_set()
+ *
+ * @note This function will trigger the Edje file case based on the
+ * extension of the @a file string use to create the Eina_File (expects
+ * @c ".edj", for this case). If one wants to force this type of file
+ * independently of the extension, elm_image_file_edje_set() must be
+ * used, instead.
+ *
+ * @note If you use animated gif image and create multiple image objects with
+ * one gif image file, you should set the @group differently for each object.
+ * Or image objects will share one evas image cache entry and you will get
+ * unwanted frames.
+ *
+ * @ingroup Image
+ */
+EAPI Eina_Bool elm_image_mmap_set(Evas_Object *obj, const Eina_File *file, const char *group);
+
+/**
+ * Set the file that will be used as the image's source.
+ *
+ * @param obj The image object
* @param file The path to file that will be used as image source
* @param group The group that the image belongs to, in case it's an
* EET (including Edje case) file. This can be used as a key inside