forked from enlightenment/efl
parent
e92406d330
commit
5887bde860
|
@ -532,6 +532,7 @@ extern "C" {
|
||||||
EAPI int evas_object_image_stride_get (const Evas_Object *obj);
|
EAPI int evas_object_image_stride_get (const Evas_Object *obj);
|
||||||
EAPI int evas_object_image_load_error_get (const Evas_Object *obj);
|
EAPI int evas_object_image_load_error_get (const Evas_Object *obj);
|
||||||
EAPI void evas_object_image_data_set (Evas_Object *obj, void *data);
|
EAPI void evas_object_image_data_set (Evas_Object *obj, void *data);
|
||||||
|
EAPI void *evas_object_image_data_convert (Evas_Object *obj, Evas_Colorspace to_cspace);
|
||||||
EAPI void *evas_object_image_data_get (const Evas_Object *obj, Evas_Bool for_writing);
|
EAPI void *evas_object_image_data_get (const Evas_Object *obj, Evas_Bool for_writing);
|
||||||
EAPI void evas_object_image_data_copy_set (Evas_Object *obj, void *data);
|
EAPI void evas_object_image_data_copy_set (Evas_Object *obj, void *data);
|
||||||
EAPI void evas_object_image_data_update_add (Evas_Object *obj, int x, int y, int w, int h);
|
EAPI void evas_object_image_data_update_add (Evas_Object *obj, int x, int y, int w, int h);
|
||||||
|
|
|
@ -67,6 +67,8 @@ static int evas_object_image_is_opaque(Evas_Object *obj);
|
||||||
static int evas_object_image_was_opaque(Evas_Object *obj);
|
static int evas_object_image_was_opaque(Evas_Object *obj);
|
||||||
static int evas_object_image_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
static int evas_object_image_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||||
|
|
||||||
|
static void *evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_Colorspace to_cspace);
|
||||||
|
|
||||||
static const Evas_Object_Func object_func =
|
static const Evas_Object_Func object_func =
|
||||||
{
|
{
|
||||||
/* methods (compulsory) */
|
/* methods (compulsory) */
|
||||||
|
@ -705,6 +707,46 @@ evas_object_image_load_error_get(const Evas_Object *obj)
|
||||||
* image object.
|
* image object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the raw image data of the given image object to the
|
||||||
|
* specified colorspace.
|
||||||
|
*
|
||||||
|
* Note that this function does not modify the raw image data.
|
||||||
|
* If the requested colorspace is the same as the image colorspace
|
||||||
|
* nothing is done and NULL is returned. You should use
|
||||||
|
* evas_object_image_colorspace_get() to check the current image
|
||||||
|
* colorspace.
|
||||||
|
*
|
||||||
|
* See @ref evas_object_image_colorspace_get.
|
||||||
|
*
|
||||||
|
* @param obj The given image object.
|
||||||
|
* @param to_cspace The colorspace to which the image raw data will be converted.
|
||||||
|
* @return data A newly allocated data in the format specified by to_cspace.
|
||||||
|
* @ingroup Evas_Object_Image_Data
|
||||||
|
*/
|
||||||
|
EAPI void *
|
||||||
|
evas_object_image_data_convert(Evas_Object *obj, Evas_Colorspace to_cspace)
|
||||||
|
{
|
||||||
|
Evas_Object_Image *o;
|
||||||
|
DATA32 *data;
|
||||||
|
|
||||||
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||||
|
return NULL;
|
||||||
|
MAGIC_CHECK_END();
|
||||||
|
o = (Evas_Object_Image *)(obj->object_data);
|
||||||
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||||
|
return NULL;
|
||||||
|
MAGIC_CHECK_END();
|
||||||
|
if (!o->engine_data) return NULL;
|
||||||
|
if (!o->cur.cspace == to_cspace) return NULL;
|
||||||
|
data = NULL;
|
||||||
|
o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
||||||
|
o->engine_data,
|
||||||
|
0,
|
||||||
|
&data);
|
||||||
|
return evas_object_image_data_convert_internal(o, data, to_cspace);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the raw image data of the given image object.
|
* Sets the raw image data of the given image object.
|
||||||
*
|
*
|
||||||
|
@ -1126,9 +1168,21 @@ evas_object_image_save(const Evas_Object *obj, const char *file, const char *key
|
||||||
o->cur.has_alpha,
|
o->cur.has_alpha,
|
||||||
EVAS_COLORSPACE_ARGB8888);
|
EVAS_COLORSPACE_ARGB8888);
|
||||||
if (im)
|
if (im)
|
||||||
|
{
|
||||||
|
if (o->cur.cspace == EVAS_COLORSPACE_ARGB8888)
|
||||||
|
im->image.data = data;
|
||||||
|
else
|
||||||
|
im->image.data = evas_object_image_data_convert_internal(o,
|
||||||
|
data,
|
||||||
|
EVAS_COLORSPACE_ARGB8888);
|
||||||
|
if (im->image.data)
|
||||||
{
|
{
|
||||||
ok = evas_common_save_image_to_file(im, file, key, quality, compress);
|
ok = evas_common_save_image_to_file(im, file, key, quality, compress);
|
||||||
|
|
||||||
|
if (o->cur.cspace != EVAS_COLORSPACE_ARGB8888)
|
||||||
|
free(im->image.data);
|
||||||
|
}
|
||||||
|
|
||||||
evas_cache_image_drop(&im->cache_entry);
|
evas_cache_image_drop(&im->cache_entry);
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -2373,3 +2427,36 @@ evas_object_image_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||||
|
|
||||||
return (a != 0);
|
return (a != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_Colorspace to_cspace)
|
||||||
|
{
|
||||||
|
void *out = NULL;
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
switch (o->cur.cspace)
|
||||||
|
{
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
out = evas_common_convert_argb8888_to(data,
|
||||||
|
o->cur.image.w,
|
||||||
|
o->cur.image.h,
|
||||||
|
o->cur.image.stride,
|
||||||
|
o->cur.has_alpha,
|
||||||
|
to_cspace);
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_RGB565_A5P:
|
||||||
|
out = evas_common_convert_rgb565_a5p_to(data,
|
||||||
|
o->cur.image.w,
|
||||||
|
o->cur.image.h,
|
||||||
|
o->cur.image.stride,
|
||||||
|
o->cur.has_alpha,
|
||||||
|
to_cspace);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ evas_op_mul_main_.c \
|
||||||
evas_blend_main.c \
|
evas_blend_main.c \
|
||||||
evas_blit_main.c \
|
evas_blit_main.c \
|
||||||
evas_convert_color.c \
|
evas_convert_color.c \
|
||||||
|
evas_convert_colorspace.c \
|
||||||
evas_convert_gry_1.c \
|
evas_convert_gry_1.c \
|
||||||
evas_convert_gry_4.c \
|
evas_convert_gry_4.c \
|
||||||
evas_convert_gry_8.c \
|
evas_convert_gry_8.c \
|
||||||
|
|
|
@ -1039,6 +1039,9 @@ EAPI void evas_common_convert_color_rgb_to_hsv (int r, int g
|
||||||
EAPI void evas_common_convert_color_hsv_to_rgb_int (int h, int s, int v, int *r, int *g, int *b);
|
EAPI void evas_common_convert_color_hsv_to_rgb_int (int h, int s, int v, int *r, int *g, int *b);
|
||||||
EAPI void evas_common_convert_color_rgb_to_hsv_int (int r, int g, int b, int *h, int *s, int *v);
|
EAPI void evas_common_convert_color_rgb_to_hsv_int (int r, int g, int b, int *h, int *s, int *v);
|
||||||
|
|
||||||
|
EAPI void *evas_common_convert_argb8888_to (void *data, int w, int h, int stride, Evas_Bool has_alpha, Evas_Colorspace cspace);
|
||||||
|
EAPI void *evas_common_convert_rgb565_a5p_to (void *data, int w, int h, int stride, Evas_Bool has_alpha, Evas_Colorspace cspace);
|
||||||
|
|
||||||
/****/
|
/****/
|
||||||
EAPI void evas_common_scale_init (void);
|
EAPI void evas_common_scale_init (void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue