forked from enlightenment/efl
elm_image: remove elm_image_memfile_set api from eo API.
memfile_set feature will be deprecated. instead of memfile_set, use Efl.file.mmap. and merge elm_image_obj_mmap_set and elm_image_efl_file_mmap_set
This commit is contained in:
parent
b76f9c8f6e
commit
adcc8c218c
|
@ -392,21 +392,6 @@ _elm_icon_efl_file_file_set(Eo *obj, Elm_Icon_Data *sd, const char *file, const
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
|
||||||
_elm_icon_elm_image_memfile_set(Eo *obj, Elm_Icon_Data *sd, const void *img, size_t size, const char *format, const char *key)
|
|
||||||
{
|
|
||||||
Eina_Bool int_ret = EINA_FALSE;
|
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(img, EINA_FALSE);
|
|
||||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(!size, EINA_FALSE);
|
|
||||||
ELM_SAFE_FREE(sd->stdicon, eina_stringshare_del);
|
|
||||||
|
|
||||||
_edje_signals_free(sd);
|
|
||||||
|
|
||||||
int_ret = elm_obj_image_memfile_set(eo_super(obj, MY_CLASS), img, size, format, key);
|
|
||||||
return int_ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
_elm_icon_elm_widget_theme_apply(Eo *obj, Elm_Icon_Data *sd)
|
_elm_icon_elm_widget_theme_apply(Eo *obj, Elm_Icon_Data *sd)
|
||||||
{
|
{
|
||||||
|
@ -683,11 +668,19 @@ elm_icon_memfile_set(Evas_Object *obj,
|
||||||
const char *format,
|
const char *format,
|
||||||
const char *key)
|
const char *key)
|
||||||
{
|
{
|
||||||
|
Eina_Bool int_ret = EINA_FALSE;
|
||||||
ELM_ICON_CHECK(obj) EINA_FALSE;
|
ELM_ICON_CHECK(obj) EINA_FALSE;
|
||||||
|
|
||||||
Eina_Bool ret = EINA_FALSE;
|
EINA_SAFETY_ON_NULL_RETURN_VAL(img, EINA_FALSE);
|
||||||
ret = elm_obj_image_memfile_set(obj, img, size, format, key);
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(!size, EINA_FALSE);
|
||||||
return ret;
|
|
||||||
|
ELM_ICON_DATA_GET(obj, sd);
|
||||||
|
ELM_SAFE_FREE(sd->stdicon, eina_stringshare_del);
|
||||||
|
|
||||||
|
_edje_signals_free(sd);
|
||||||
|
|
||||||
|
int_ret = elm_image_memfile_set(eo_super(obj, MY_CLASS), img, size, format, key);
|
||||||
|
return int_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
|
|
|
@ -104,7 +104,6 @@ class Elm.Icon (Elm.Image)
|
||||||
Evas.Object_Smart.add;
|
Evas.Object_Smart.add;
|
||||||
Evas.Object_Smart.del;
|
Evas.Object_Smart.del;
|
||||||
Elm.Widget.theme_apply;
|
Elm.Widget.theme_apply;
|
||||||
Elm.Image.memfile.set;
|
|
||||||
Efl.File.file.set;
|
Efl.File.file.set;
|
||||||
}
|
}
|
||||||
events {
|
events {
|
||||||
|
|
|
@ -885,35 +885,6 @@ _elm_image_file_set_do(Evas_Object *obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
|
||||||
_elm_image_memfile_set(Eo *obj, Elm_Image_Data *sd, const void *img, size_t size, const char *format, const char *key)
|
|
||||||
{
|
|
||||||
Evas_Load_Error err;
|
|
||||||
|
|
||||||
_elm_image_file_set_do(obj);
|
|
||||||
|
|
||||||
evas_object_image_memfile_set
|
|
||||||
(sd->img, (void *)img, size, (char *)format, (char *)key);
|
|
||||||
|
|
||||||
sd->preload_status = ELM_IMAGE_PRELOADING;
|
|
||||||
evas_object_image_preload(sd->img, EINA_FALSE);
|
|
||||||
|
|
||||||
err = evas_object_image_load_error_get(sd->img);
|
|
||||||
if (err != EVAS_LOAD_ERROR_NONE)
|
|
||||||
{
|
|
||||||
if (img)
|
|
||||||
ERR("Failed to load image from memory block (" FMT_SIZE_T
|
|
||||||
" bytes): %s (%p)", size, evas_load_error_str(err), sd->img);
|
|
||||||
else
|
|
||||||
ERR("NULL image data passed (%p)", sd->img);
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_elm_image_internal_sizing_eval(obj, sd);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_elm_image_scale_set(Eo *obj, Elm_Image_Data *sd, double scale)
|
_elm_image_scale_set(Eo *obj, Elm_Image_Data *sd, double scale)
|
||||||
{
|
{
|
||||||
|
@ -947,45 +918,19 @@ _elm_image_eo_base_constructor(Eo *obj, Elm_Image_Data *_pd EINA_UNUSED)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
|
||||||
elm_image_file_set(Evas_Object *obj,
|
|
||||||
const char *file,
|
|
||||||
const char *group)
|
|
||||||
{
|
|
||||||
Eina_Bool ret = EINA_FALSE;
|
|
||||||
|
|
||||||
ELM_IMAGE_CHECK(obj) EINA_FALSE;
|
|
||||||
ret = efl_file_set(obj, file, group);
|
|
||||||
elm_obj_image_sizing_eval(obj);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
elm_image_file_get(const Eo *obj, const char **file, const char **group)
|
|
||||||
{
|
|
||||||
efl_file_get((Eo *) obj, file, group);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
ret = efl_file_mmap_set(obj, file, group);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN Eina_Bool
|
EOLIAN Eina_Bool
|
||||||
_elm_image_efl_file_mmap_set(Eo *obj, Elm_Image_Data *pd EINA_UNUSED,
|
_elm_image_efl_file_mmap_set(Eo *obj, Elm_Image_Data *sd,
|
||||||
const Eina_File *file, const char *key)
|
const Eina_File *file, const char *key)
|
||||||
{
|
{
|
||||||
Eina_Bool ret = EINA_FALSE;
|
Eina_Bool ret = EINA_FALSE;
|
||||||
|
|
||||||
ret = elm_obj_image_mmap_set(obj, file, key);
|
if (sd->remote) _elm_url_cancel(sd->remote);
|
||||||
elm_obj_image_sizing_eval(obj);
|
sd->remote = NULL;
|
||||||
|
|
||||||
|
if (!sd->async_enable)
|
||||||
|
ret = _elm_image_smart_internal_file_set(obj, sd, eina_file_filename_get(file), file, key);
|
||||||
|
else
|
||||||
|
ret = _elm_image_async_file_set(obj, sd, eina_file_filename_get(file), file, key);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1658,4 +1603,63 @@ elm_image_editable_get(const Evas_Object *obj)
|
||||||
return evas_draggable_interface_drag_target_get(obj);
|
return evas_draggable_interface_drag_target_get(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
elm_image_file_set(Evas_Object *obj, const char *file, const char *group)
|
||||||
|
{
|
||||||
|
Eina_Bool ret = EINA_FALSE;
|
||||||
|
|
||||||
|
ELM_IMAGE_CHECK(obj) EINA_FALSE;
|
||||||
|
ret = efl_file_set(obj, file, group);
|
||||||
|
elm_obj_image_sizing_eval(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
elm_image_file_get(const Eo *obj, const char **file, const char **group)
|
||||||
|
{
|
||||||
|
efl_file_get((Eo *) obj, file, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
ret = efl_file_mmap_set(obj, file, group);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
elm_image_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key)
|
||||||
|
{
|
||||||
|
Evas_Load_Error err;
|
||||||
|
|
||||||
|
ELM_IMAGE_CHECK(obj) EINA_FALSE;
|
||||||
|
ELM_IMAGE_DATA_GET(obj, sd);
|
||||||
|
|
||||||
|
_elm_image_file_set_do(obj);
|
||||||
|
|
||||||
|
evas_object_image_memfile_set
|
||||||
|
(sd->img, (void *)img, size, (char *)format, (char *)key);
|
||||||
|
|
||||||
|
sd->preload_status = ELM_IMAGE_PRELOADING;
|
||||||
|
evas_object_image_preload(sd->img, EINA_FALSE);
|
||||||
|
|
||||||
|
err = evas_object_image_load_error_get(sd->img);
|
||||||
|
if (err != EVAS_LOAD_ERROR_NONE)
|
||||||
|
{
|
||||||
|
if (img)
|
||||||
|
ERR("Failed to load image from memory block (" FMT_SIZE_T
|
||||||
|
" bytes): %s (%p)", size, evas_load_error_str(err), sd->img);
|
||||||
|
else
|
||||||
|
ERR("NULL image data passed (%p)", sd->img);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_elm_image_internal_sizing_eval(obj, sd);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#include "elm_image.eo.c"
|
#include "elm_image.eo.c"
|
||||||
|
|
|
@ -198,53 +198,6 @@ class Elm.Image (Elm.Widget, Efl.File, Efl.Image_Load, Evas.Clickable_Interface,
|
||||||
disabled: bool; [[If true, preloading will be disabled]]
|
disabled: bool; [[If true, preloading will be disabled]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property mmap {
|
|
||||||
set {
|
|
||||||
[[Set the file that will be used as the image's source.
|
|
||||||
|
|
||||||
See: elm_image_file_set()
|
|
||||||
|
|
||||||
Note: This function will trigger the Edje file case based on the
|
|
||||||
extension of the $file string use to create the Eina_File (expects
|
|
||||||
$".edj", for this case).
|
|
||||||
|
|
||||||
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.]]
|
|
||||||
|
|
||||||
return: bool; [[$true = success, $false = error]]
|
|
||||||
legacy: null;
|
|
||||||
}
|
|
||||||
values {
|
|
||||||
file: const(Eina.File)*; [[The handler to an Eina_File that will be used as image source]]
|
|
||||||
group: const(char)* @optional; [[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.]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@property memfile {
|
|
||||||
set {
|
|
||||||
[[Set a location in memory to be used as an image object's source bitmap.
|
|
||||||
|
|
||||||
This function is handy when the contents of an image file are
|
|
||||||
mapped in memory, for example.
|
|
||||||
|
|
||||||
The $format string should be something like $"png", $"jpg",
|
|
||||||
$"tga", $"tiff", $"bmp" etc, when provided ($NULL, on the
|
|
||||||
contrary). This improves the loader performance as it tries the
|
|
||||||
"correct" loader first, before trying a range of other possible
|
|
||||||
loaders until one succeeds.
|
|
||||||
|
|
||||||
@since 1.7]]
|
|
||||||
|
|
||||||
return: bool; [[$true = success, $false = error]]
|
|
||||||
}
|
|
||||||
values {
|
|
||||||
img: const(void)*; [[The binary data that will be used as image source]]
|
|
||||||
size: size; [[The size of binary data blob $img]]
|
|
||||||
format: const(char)* @optional; [[(Optional) expected format of $img bytes]]
|
|
||||||
key: const(char)* @optional; [[Optional indexing key of $img to be passed to the image loader (eg. if $img is a memory-mapped EET file)]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@property object {
|
@property object {
|
||||||
get {
|
get {
|
||||||
[[Get the inlined image object of the image widget.
|
[[Get the inlined image object of the image widget.
|
||||||
|
|
|
@ -272,4 +272,30 @@ EAPI void elm_image_editable_set(Evas_Object *obj, Eina_Bool set);
|
||||||
* @ingroup Elm_Image
|
* @ingroup Elm_Image
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool elm_image_editable_get(const Evas_Object *obj);
|
EAPI Eina_Bool elm_image_editable_get(const Evas_Object *obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set a location in memory to be used as an image object's source
|
||||||
|
* bitmap.
|
||||||
|
*
|
||||||
|
* This function is handy when the contents of an image file are mapped in
|
||||||
|
* memory, for example.
|
||||||
|
*
|
||||||
|
* The @c format string should be something like $"png", $"jpg", $"tga",
|
||||||
|
* $"tiff", $"bmp" etc, when provided ($NULL, on the contrary). This improves
|
||||||
|
* the loader performance as it tries the "correct" loader first, before trying
|
||||||
|
* a range of other possible loaders until one succeeds.
|
||||||
|
*
|
||||||
|
* @param[in] img The binary data that will be used as image source
|
||||||
|
* @param[in] size The size of binary data blob @c img
|
||||||
|
* @param[in] format (Optional) expected format of @c img bytes
|
||||||
|
* @param[in] key Optional indexing key of @c img to be passed to the image
|
||||||
|
* loader (eg. if @c img is a memory-mapped EET file)
|
||||||
|
*
|
||||||
|
* @return @c true = success, @c false = error
|
||||||
|
*
|
||||||
|
* @since 1.7
|
||||||
|
*
|
||||||
|
* @ingroup Elm_Image
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool elm_image_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key);
|
||||||
#include "elm_image.eo.legacy.h"
|
#include "elm_image.eo.legacy.h"
|
||||||
|
|
Loading…
Reference in New Issue