evas: Add api to know if an evas_object_image could support region

SVN revision: 66170
This commit is contained in:
Michael BOUCHAUD 2011-12-13 16:58:20 +00:00
parent 2e88dad910
commit 33eb1e5e79
20 changed files with 84 additions and 16 deletions

View File

@ -7065,7 +7065,7 @@ EAPI void evas_object_image_load_region_set (Evas_Obj
* *
* @see evas_object_image_load_region_get() * @see evas_object_image_load_region_get()
*/ */
EAPI void evas_object_image_load_region_get (const Evas_Object *obj, int *x, int *y, int *w, int *h) EINA_ARG_NONNULL(1); eAPI void evas_object_image_load_region_get (const Evas_Object *obj, int *x, int *y, int *w, int *h) EINA_ARG_NONNULL(1);
/** /**
* Define if the orientation information in the image file should be honored. * Define if the orientation information in the image file should be honored.
@ -7106,6 +7106,17 @@ EAPI void evas_object_image_colorspace_set (Evas_Obj
*/ */
EAPI Evas_Colorspace evas_object_image_colorspace_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; EAPI Evas_Colorspace evas_object_image_colorspace_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
/**
* Get the support state of a given image
*
* @param obj The given image object pointer
* @return The region support state
* @since 1.2.0
*
* This function returns the state of the region support of given image
*/
EAPI Eina_Bool evas_object_image_region_support_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
/** /**
* Set the native surface of a given image of the canvas * Set the native surface of a given image of the canvas
* *

View File

@ -1934,6 +1934,24 @@ evas_object_image_content_hint_get(const Evas_Object *obj)
return o->content_hint; return o->content_hint;
} }
EAPI Eina_Bool
evas_object_image_region_support_get(const Evas_Object *obj)
{
Evas_Object_Image *o;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return EINA_FALSE;
MAGIC_CHECK_END();
o = (Evas_Object_Image *) (obj->object_data);
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return EINA_FALSE;
MAGIC_CHECK_END();
return obj->layer->evas->engine.func->image_can_region_get(
obj->layer->evas->engine.data.output,
o->engine_data);
}
/* animated feature */ /* animated feature */
EAPI Eina_Bool EAPI Eina_Bool
evas_object_image_animated_get(const Evas_Object *obj) evas_object_image_animated_get(const Evas_Object *obj)

View File

@ -773,6 +773,7 @@ struct _Evas_Func
char *(*image_format_get) (void *data, void *image); char *(*image_format_get) (void *data, void *image);
void (*image_colorspace_set) (void *data, void *image, int cspace); void (*image_colorspace_set) (void *data, void *image, int cspace);
int (*image_colorspace_get) (void *data, void *image); int (*image_colorspace_get) (void *data, void *image);
Eina_Bool (*image_can_region_get) (void *data, void *image);
void (*image_mask_create) (void *data, void *image); void (*image_mask_create) (void *data, void *image);
void *(*image_native_set) (void *data, void *image, void *native); void *(*image_native_set) (void *data, void *image, void *native);
void *(*image_native_get) (void *data, void *image); void *(*image_native_get) (void *data, void *image);
@ -862,6 +863,7 @@ struct _Evas_Image_Load_Func
Eina_Bool (*file_head) (Image_Entry *ie, const char *file, const char *key, int *error); Eina_Bool (*file_head) (Image_Entry *ie, const char *file, const char *key, int *error);
Eina_Bool (*file_data) (Image_Entry *ie, const char *file, const char *key, int *error); Eina_Bool (*file_data) (Image_Entry *ie, const char *file, const char *key, int *error);
double (*frame_duration) (Image_Entry *ie, const char *file, const int start, const int frame_num); double (*frame_duration) (Image_Entry *ie, const char *file, const int start, const int frame_num);
Eina_Bool do_region;
}; };
struct _Evas_Image_Save_Func struct _Evas_Image_Save_Func

View File

@ -3702,6 +3702,18 @@ eng_image_animated_frame_set(void *data __UNUSED__, void *image, int frame_index
return EINA_TRUE; return EINA_TRUE;
} }
static Eina_Bool
eng_image_can_region_get(void *data__UNUSED__, void *image)
{
Evas_GL_Image *gim = image;
Image_Entry *im;
if (!gim) return EINA_FALSE;
im = (Image_Entry *)gim->im;
if (!im) return EINA_FALSE;
return ((Evas_Image_Load_Func*) im->info.loader)->do_region;
}
static void static void
eng_image_max_size_get(void *data, int *maxw, int *maxh) eng_image_max_size_get(void *data, int *maxw, int *maxh)
{ {

View File

@ -258,6 +258,15 @@ eng_image_colorspace_get(void *data __UNUSED__, void *image)
return im->space; return im->space;
} }
static Eina_Bool
eng_image_can_region_get(void *data__UNUSED__, void *image)
{
Image_Entry *im;
if (!image) return EINA_FALSE;
im = image;
return ((Evas_Image_Load_Func*) im->info.loader)->do_region;
}
static void static void
eng_image_mask_create(void *data __UNUSED__, void *image) eng_image_mask_create(void *data __UNUSED__, void *image)
{ {
@ -1112,6 +1121,7 @@ static Evas_Func func =
eng_image_format_get, eng_image_format_get,
eng_image_colorspace_set, eng_image_colorspace_set,
eng_image_colorspace_get, eng_image_colorspace_get,
eng_image_can_region_get,
eng_image_mask_create, eng_image_mask_create,
eng_image_native_set, eng_image_native_set,
eng_image_native_get, eng_image_native_get,

View File

@ -21,7 +21,8 @@ static Evas_Image_Load_Func evas_image_load_bmp_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_bmp, evas_image_load_file_head_bmp,
evas_image_load_file_data_bmp, evas_image_load_file_data_bmp,
NULL NULL,
EINA_FALSE
}; };
static Eina_Bool static Eina_Bool

View File

@ -16,7 +16,8 @@ static Evas_Image_Load_Func evas_image_load_edb_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_edb, evas_image_load_file_head_edb,
evas_image_load_file_data_edb, evas_image_load_file_data_edb,
NULL NULL,
EINA_FALSE
}; };
static Eina_Bool static Eina_Bool

View File

@ -16,7 +16,8 @@ Evas_Image_Load_Func evas_image_load_eet_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_eet, evas_image_load_file_head_eet,
evas_image_load_file_data_eet, evas_image_load_file_data_eet,
NULL NULL,
EINA_FALSE
}; };

View File

@ -24,7 +24,8 @@ Evas_Image_Load_Func evas_image_load_generic_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_generic, evas_image_load_file_head_generic,
evas_image_load_file_data_generic, evas_image_load_file_data_generic,
NULL NULL,
EINA_FALSE
}; };
static Eina_Bool static Eina_Bool

View File

@ -50,7 +50,8 @@ static Evas_Image_Load_Func evas_image_load_gif_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_gif, evas_image_load_file_head_gif,
evas_image_load_file_data_gif, evas_image_load_file_data_gif,
evas_image_load_frame_duration_gif evas_image_load_frame_duration_gif,
EINA_FALSE
}; };
#define byte2_to_int(a,b) (((b)<<8)|(a)) #define byte2_to_int(a,b) (((b)<<8)|(a))

View File

@ -19,7 +19,8 @@ static Evas_Image_Load_Func evas_image_load_ico_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_ico, evas_image_load_file_head_ico,
evas_image_load_file_data_ico, evas_image_load_file_data_ico,
NULL NULL,
EINA_FALSE
}; };
static Eina_Bool static Eina_Bool

View File

@ -46,7 +46,8 @@ static Evas_Image_Load_Func evas_image_load_jpeg_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_jpeg, evas_image_load_file_head_jpeg,
evas_image_load_file_data_jpeg, evas_image_load_file_data_jpeg,
NULL NULL,
EINA_TRUE
}; };

View File

@ -19,7 +19,8 @@ Evas_Image_Load_Func evas_image_load_pmaps_func = {
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_pmaps, evas_image_load_file_head_pmaps,
evas_image_load_file_data_pmaps, evas_image_load_file_data_pmaps,
NULL NULL,
EINA_FALSE
}; };
/* The buffer to load pmaps images */ /* The buffer to load pmaps images */

View File

@ -35,7 +35,8 @@ static Evas_Image_Load_Func evas_image_load_png_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_png, evas_image_load_file_head_png,
evas_image_load_file_data_png, evas_image_load_file_data_png,
NULL NULL,
EINA_FALSE
}; };
static Eina_Bool static Eina_Bool

View File

@ -941,7 +941,8 @@ static const Evas_Image_Load_Func evas_image_load_psd_func = {
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_psd, evas_image_load_file_head_psd,
evas_image_load_file_data_psd, evas_image_load_file_data_psd,
NULL NULL,
EINA_FALSE
}; };
static int static int

View File

@ -13,7 +13,8 @@ Evas_Image_Load_Func evas_image_load_svg_func =
EINA_FALSE, EINA_FALSE,
evas_image_load_file_head_svg, evas_image_load_file_head_svg,
evas_image_load_file_data_svg, evas_image_load_file_data_svg,
NULL NULL,
EINA_FALSE
}; };
static int rsvg_initialized = 0; static int rsvg_initialized = 0;

View File

@ -65,7 +65,8 @@ static Evas_Image_Load_Func evas_image_load_tga_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_tga, evas_image_load_file_head_tga,
evas_image_load_file_data_tga, evas_image_load_file_data_tga,
NULL NULL,
EINA_FALSE
}; };
static Eina_Bool static Eina_Bool

View File

@ -34,7 +34,8 @@ static Evas_Image_Load_Func evas_image_load_tiff_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_tiff, evas_image_load_file_head_tiff,
evas_image_load_file_data_tiff, evas_image_load_file_data_tiff,
NULL NULL,
EINA_FALSE
}; };
typedef struct TIFFRGBAImage_Extra TIFFRGBAImage_Extra; typedef struct TIFFRGBAImage_Extra TIFFRGBAImage_Extra;

View File

@ -19,7 +19,8 @@ static Evas_Image_Load_Func evas_image_load_wbmp_func =
EINA_TRUE, EINA_TRUE,
evas_image_load_file_head_wbmp, evas_image_load_file_head_wbmp,
evas_image_load_file_data_wbmp, evas_image_load_file_data_wbmp,
NULL NULL,
EINA_FALSE
}; };

View File

@ -24,7 +24,8 @@ static Evas_Image_Load_Func evas_image_load_xpm_func =
EINA_FALSE, EINA_FALSE,
evas_image_load_file_head_xpm, evas_image_load_file_head_xpm,
evas_image_load_file_data_xpm, evas_image_load_file_data_xpm,
NULL NULL,
EINA_FALSE
}; };
// TODO: REWRITE THIS WITH THREAD SAFE VERSION NOT USING THIS HANDLE!!!! // TODO: REWRITE THIS WITH THREAD SAFE VERSION NOT USING THIS HANDLE!!!!