evas: Add api to know if an evas_object_image could support region
authoryoz <yoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 13 Dec 2011 16:58:20 +0000 (16:58 +0000)
committeryoz <yoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 13 Dec 2011 16:58:20 +0000 (16:58 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@66170 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

20 files changed:
src/lib/Evas.h
src/lib/canvas/evas_object_image.c
src/lib/include/evas_private.h
src/modules/engines/gl_x11/evas_engine.c
src/modules/engines/software_generic/evas_engine.c
src/modules/loaders/bmp/evas_image_load_bmp.c
src/modules/loaders/edb/evas_image_load_edb.c
src/modules/loaders/eet/evas_image_load_eet.c
src/modules/loaders/generic/evas_image_load_generic.c
src/modules/loaders/gif/evas_image_load_gif.c
src/modules/loaders/ico/evas_image_load_ico.c
src/modules/loaders/jpeg/evas_image_load_jpeg.c
src/modules/loaders/pmaps/evas_image_load_pmaps.c
src/modules/loaders/png/evas_image_load_png.c
src/modules/loaders/psd/evas_image_load_psd.c
src/modules/loaders/svg/evas_image_load_svg.c
src/modules/loaders/tga/evas_image_load_tga.c
src/modules/loaders/tiff/evas_image_load_tiff.c
src/modules/loaders/wbmp/evas_image_load_wbmp.c
src/modules/loaders/xpm/evas_image_load_xpm.c

index a0f197b..cbe0073 100644 (file)
@@ -7065,7 +7065,7 @@ EAPI void                     evas_object_image_load_region_set        (Evas_Obj
  *
  * @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.
@@ -7107,6 +7107,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;
 
 /**
+ * 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
  *
  * @param obj The given canvas pointer.
index 537b05f..aa4a974 100644 (file)
@@ -1934,6 +1934,24 @@ evas_object_image_content_hint_get(const Evas_Object *obj)
    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 */
 EAPI Eina_Bool
 evas_object_image_animated_get(const Evas_Object *obj)
index ff98c77..b5cd4c5 100644 (file)
@@ -773,6 +773,7 @@ struct _Evas_Func
    char *(*image_format_get)               (void *data, void *image);
    void (*image_colorspace_set)            (void *data, void *image, int cspace);
    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_native_set)               (void *data, void *image, void *native);
    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_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);
+  Eina_Bool do_region;
 };
 
 struct _Evas_Image_Save_Func
index 54a68d6..f872744 100644 (file)
@@ -3702,6 +3702,18 @@ eng_image_animated_frame_set(void *data __UNUSED__, void *image, int frame_index
    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
 eng_image_max_size_get(void *data, int *maxw, int *maxh)
 {
index b2c53c5..add55bb 100644 (file)
@@ -258,6 +258,15 @@ eng_image_colorspace_get(void *data __UNUSED__, void *image)
    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
 eng_image_mask_create(void *data __UNUSED__, void *image)
 {
@@ -1112,6 +1121,7 @@ static Evas_Func func =
      eng_image_format_get,
      eng_image_colorspace_set,
      eng_image_colorspace_get,
+     eng_image_can_region_get,
      eng_image_mask_create,
      eng_image_native_set,
      eng_image_native_get,
index e85b903..3c0d521 100644 (file)
@@ -21,7 +21,8 @@ static Evas_Image_Load_Func evas_image_load_bmp_func =
   EINA_TRUE,
   evas_image_load_file_head_bmp,
   evas_image_load_file_data_bmp,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 static Eina_Bool
index 94b121e..521161f 100644 (file)
@@ -16,7 +16,8 @@ static Evas_Image_Load_Func evas_image_load_edb_func =
   EINA_TRUE,
   evas_image_load_file_head_edb,
   evas_image_load_file_data_edb,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 static Eina_Bool
index a187b9e..f86246a 100644 (file)
@@ -16,7 +16,8 @@ Evas_Image_Load_Func evas_image_load_eet_func =
   EINA_TRUE,
   evas_image_load_file_head_eet,
   evas_image_load_file_data_eet,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 
index 88c189d..6e07fd8 100644 (file)
@@ -24,7 +24,8 @@ Evas_Image_Load_Func evas_image_load_generic_func =
   EINA_TRUE,
   evas_image_load_file_head_generic,
   evas_image_load_file_data_generic,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 static Eina_Bool
index 976df0d..9cd6f6e 100644 (file)
@@ -50,7 +50,8 @@ static Evas_Image_Load_Func evas_image_load_gif_func =
   EINA_TRUE,
   evas_image_load_file_head_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))
 
index 5621bdd..93a8a6b 100644 (file)
@@ -19,7 +19,8 @@ static Evas_Image_Load_Func evas_image_load_ico_func =
   EINA_TRUE,
   evas_image_load_file_head_ico,
   evas_image_load_file_data_ico,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 static Eina_Bool
index 0dbabab..797c76d 100644 (file)
@@ -46,7 +46,8 @@ static Evas_Image_Load_Func evas_image_load_jpeg_func =
   EINA_TRUE,
   evas_image_load_file_head_jpeg,
   evas_image_load_file_data_jpeg,
-  NULL
+  NULL,
+  EINA_TRUE
 };
 
 
index 9ba8f81..ab97328 100644 (file)
@@ -19,7 +19,8 @@ Evas_Image_Load_Func evas_image_load_pmaps_func = {
    EINA_TRUE,
    evas_image_load_file_head_pmaps,
    evas_image_load_file_data_pmaps,
-   NULL
+   NULL,
+   EINA_FALSE
 };
 
 /* The buffer to load pmaps images */
index a1480ae..3007a57 100644 (file)
@@ -35,7 +35,8 @@ static Evas_Image_Load_Func evas_image_load_png_func =
   EINA_TRUE,
   evas_image_load_file_head_png,
   evas_image_load_file_data_png,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 static Eina_Bool
index 5a85e17..0839b4f 100644 (file)
@@ -941,7 +941,8 @@ static const Evas_Image_Load_Func evas_image_load_psd_func = {
   EINA_TRUE,
   evas_image_load_file_head_psd,
   evas_image_load_file_data_psd,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 static int
index f1c8452..dc0fc8d 100644 (file)
@@ -13,7 +13,8 @@ Evas_Image_Load_Func evas_image_load_svg_func =
   EINA_FALSE,
   evas_image_load_file_head_svg,
   evas_image_load_file_data_svg,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 static int  rsvg_initialized = 0;
index 61b99f6..9b4073c 100644 (file)
@@ -65,7 +65,8 @@ static Evas_Image_Load_Func evas_image_load_tga_func =
   EINA_TRUE,
   evas_image_load_file_head_tga,
   evas_image_load_file_data_tga,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 static Eina_Bool
index b9bea91..e17d5a6 100644 (file)
@@ -34,7 +34,8 @@ static Evas_Image_Load_Func evas_image_load_tiff_func =
   EINA_TRUE,
   evas_image_load_file_head_tiff,
   evas_image_load_file_data_tiff,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 typedef struct TIFFRGBAImage_Extra TIFFRGBAImage_Extra;
index fa6fab2..70cb0bf 100644 (file)
@@ -19,7 +19,8 @@ static Evas_Image_Load_Func evas_image_load_wbmp_func =
    EINA_TRUE,
    evas_image_load_file_head_wbmp,
    evas_image_load_file_data_wbmp,
-   NULL
+   NULL,
+   EINA_FALSE
 };
 
 
index 3a04f84..0455512 100644 (file)
@@ -24,7 +24,8 @@ static Evas_Image_Load_Func evas_image_load_xpm_func =
   EINA_FALSE,
   evas_image_load_file_head_xpm,
   evas_image_load_file_data_xpm,
-  NULL
+  NULL,
+  EINA_FALSE
 };
 
 // TODO: REWRITE THIS WITH THREAD SAFE VERSION NOT USING THIS HANDLE!!!!