forked from enlightenment/efl
evas: add evas_object_image_load_orientation_set, evas_object_image_load_orientation_get.
SVN revision: 60040
This commit is contained in:
parent
1e62ad24a3
commit
260718c700
|
@ -397,3 +397,5 @@
|
||||||
2011-06-07 Cedric Bail
|
2011-06-07 Cedric Bail
|
||||||
|
|
||||||
* Use Eina_File for JPEG loader.
|
* Use Eina_File for JPEG loader.
|
||||||
|
* Add evas_object_image_load_orientation_get and evas_object_image_load_orientation_set,
|
||||||
|
that tell if we should honor the orientation information when loading image file.
|
||||||
|
|
|
@ -990,7 +990,7 @@ message(void *fdata __UNUSED__, Server *s __UNUSED__, Client *c, int opcode, int
|
||||||
Op_Load *rep;
|
Op_Load *rep;
|
||||||
Op_Load_Reply msg;
|
Op_Load_Reply msg;
|
||||||
Img *img;
|
Img *img;
|
||||||
RGBA_Image_Loadopts lopt = {0, 0.0, 0, 0, {0, 0, 0, 0}};
|
RGBA_Image_Loadopts lopt = {0, 0.0, 0, 0, {0, 0, 0, 0}, 0};
|
||||||
char *file = NULL, *key = NULL;
|
char *file = NULL, *key = NULL;
|
||||||
|
|
||||||
DBG("OP_LOAD %i", c->pid);
|
DBG("OP_LOAD %i", c->pid);
|
||||||
|
|
|
@ -5071,7 +5071,7 @@ EAPI void evas_object_image_load_size_set (Evas_Obj
|
||||||
/**
|
/**
|
||||||
* Get the size of a loaded image of the canvas.
|
* Get the size of a loaded image of the canvas.
|
||||||
*
|
*
|
||||||
* @param obj The given canvas object.
|
* @param obj The given image object.
|
||||||
* @param w The width of the canvas image given.
|
* @param w The width of the canvas image given.
|
||||||
* @param h The height of the canvas image given.
|
* @param h The height of the canvas image given.
|
||||||
*
|
*
|
||||||
|
@ -5083,7 +5083,7 @@ EAPI void evas_object_image_load_size_get (const Ev
|
||||||
/**
|
/**
|
||||||
* Set the scale down of a loaded image of the canvas.
|
* Set the scale down of a loaded image of the canvas.
|
||||||
*
|
*
|
||||||
* @param obj The given canvas pointer.
|
* @param obj The given image object pointer.
|
||||||
* @param scale_down The scale to down value.
|
* @param scale_down The scale to down value.
|
||||||
*
|
*
|
||||||
* This function sets the scale down of a given canvas image.
|
* This function sets the scale down of a given canvas image.
|
||||||
|
@ -5103,6 +5103,23 @@ EAPI int evas_object_image_load_scale_down_get (const Ev
|
||||||
EAPI void evas_object_image_load_region_set (Evas_Object *obj, int x, int y, int w, int h) EINA_ARG_NONNULL(1);
|
EAPI void evas_object_image_load_region_set (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);
|
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.
|
||||||
|
*
|
||||||
|
* @param obj The given image object pointer.
|
||||||
|
* @param enable @p EINA_TRUE means that it should honor the orientation information
|
||||||
|
* @since 1.1
|
||||||
|
*/
|
||||||
|
EAPI void evas_object_image_load_orientation_set (Evas_Object *obj, Eina_Bool enable) EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get if the orientation information in the image file should be honored.
|
||||||
|
*
|
||||||
|
* @param obj The given image object pointer.
|
||||||
|
* @since 1.1
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool evas_object_image_load_orientation_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the colorspace of a given image of the canvas.
|
* Set the colorspace of a given image of the canvas.
|
||||||
*
|
*
|
||||||
|
|
|
@ -680,7 +680,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
||||||
const char *ckey = "(null)";
|
const char *ckey = "(null)";
|
||||||
char *hkey;
|
char *hkey;
|
||||||
Image_Entry *im;
|
Image_Entry *im;
|
||||||
Evas_Image_Load_Opts prevent = { 0, 0, 0, 0, { 0, 0, 0, 0 } };
|
Evas_Image_Load_Opts prevent = { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0 };
|
||||||
size_t size;
|
size_t size;
|
||||||
int stat_done = 0, stat_failed = 0;
|
int stat_done = 0, stat_failed = 0;
|
||||||
size_t file_length;
|
size_t file_length;
|
||||||
|
@ -697,7 +697,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
||||||
/* generate hkey from file+key+load opts */
|
/* generate hkey from file+key+load opts */
|
||||||
file_length = strlen(file);
|
file_length = strlen(file);
|
||||||
key_length = key ? strlen(key) : 6;
|
key_length = key ? strlen(key) : 6;
|
||||||
size = file_length + key_length + 128;
|
size = file_length + key_length + 132;
|
||||||
hkey = alloca(sizeof (char) * size);
|
hkey = alloca(sizeof (char) * size);
|
||||||
memcpy(hkey, file, file_length);
|
memcpy(hkey, file, file_length);
|
||||||
size = file_length;
|
size = file_length;
|
||||||
|
@ -711,7 +711,8 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
||||||
(lo->scale_down_by == 0) &&
|
(lo->scale_down_by == 0) &&
|
||||||
(lo->dpi == 0.0) &&
|
(lo->dpi == 0.0) &&
|
||||||
((lo->w == 0) || (lo->h == 0)) &&
|
((lo->w == 0) || (lo->h == 0)) &&
|
||||||
((lo->region.w == 0) || (lo->region.h == 0))
|
((lo->region.w == 0) || (lo->region.h == 0)) &&
|
||||||
|
(lo->orientation == 0)
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
lo = &prevent;
|
lo = &prevent;
|
||||||
|
@ -742,6 +743,13 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
||||||
hkey[size] = 'x';
|
hkey[size] = 'x';
|
||||||
size += 1;
|
size += 1;
|
||||||
size += eina_convert_xtoa(lo->region.h, hkey + size);
|
size += eina_convert_xtoa(lo->region.h, hkey + size);
|
||||||
|
|
||||||
|
if (lo->orientation)
|
||||||
|
{
|
||||||
|
hkey[size] = '/';
|
||||||
|
hkey[size] = 'o';
|
||||||
|
size += 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
hkey[size] = '\0';
|
hkey[size] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ struct _Evas_Object_Image
|
||||||
struct {
|
struct {
|
||||||
short x, y, w, h;
|
short x, y, w, h;
|
||||||
} region;
|
} region;
|
||||||
|
Eina_Bool orientation : 1;
|
||||||
} load_opts;
|
} load_opts;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -315,6 +316,7 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
|
||||||
lo.region.y = o->load_opts.region.y;
|
lo.region.y = o->load_opts.region.y;
|
||||||
lo.region.w = o->load_opts.region.w;
|
lo.region.w = o->load_opts.region.w;
|
||||||
lo.region.h = o->load_opts.region.h;
|
lo.region.h = o->load_opts.region.h;
|
||||||
|
lo.orientation = o->load_opts.orientation;
|
||||||
o->engine_data = obj->layer->evas->engine.func->image_load(obj->layer->evas->engine.data.output,
|
o->engine_data = obj->layer->evas->engine.func->image_load(obj->layer->evas->engine.data.output,
|
||||||
o->cur.file,
|
o->cur.file,
|
||||||
o->cur.key,
|
o->cur.key,
|
||||||
|
@ -1609,6 +1611,36 @@ evas_object_image_load_region_get(const Evas_Object *obj, int *x, int *y, int *w
|
||||||
if (h) *h = o->load_opts.region.h;
|
if (h) *h = o->load_opts.region.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
evas_object_image_load_orientation_set(Evas_Object *obj, Eina_Bool enable)
|
||||||
|
{
|
||||||
|
Evas_Object_Image *o;
|
||||||
|
|
||||||
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||||
|
return;
|
||||||
|
MAGIC_CHECK_END();
|
||||||
|
o = (Evas_Object_Image *)(obj->object_data);
|
||||||
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||||
|
return;
|
||||||
|
MAGIC_CHECK_END();
|
||||||
|
o->load_opts.orientation = !!enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
evas_object_image_load_orientation_get(const Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Object_Image *o;
|
||||||
|
|
||||||
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||||
|
return;
|
||||||
|
MAGIC_CHECK_END();
|
||||||
|
o = (Evas_Object_Image *)(obj->object_data);
|
||||||
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||||
|
return;
|
||||||
|
MAGIC_CHECK_END();
|
||||||
|
return o->load_opts.orientation;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_object_image_colorspace_set(Evas_Object *obj, Evas_Colorspace cspace)
|
evas_object_image_colorspace_set(Evas_Object *obj, Evas_Colorspace cspace)
|
||||||
{
|
{
|
||||||
|
@ -2285,6 +2317,7 @@ evas_object_image_load(Evas_Object *obj)
|
||||||
lo.region.y = o->load_opts.region.y;
|
lo.region.y = o->load_opts.region.y;
|
||||||
lo.region.w = o->load_opts.region.w;
|
lo.region.w = o->load_opts.region.w;
|
||||||
lo.region.h = o->load_opts.region.h;
|
lo.region.h = o->load_opts.region.h;
|
||||||
|
lo.orientation = o->load_opts.orientation;
|
||||||
o->engine_data = obj->layer->evas->engine.func->image_load
|
o->engine_data = obj->layer->evas->engine.func->image_load
|
||||||
(obj->layer->evas->engine.data.output,
|
(obj->layer->evas->engine.data.output,
|
||||||
o->cur.file,
|
o->cur.file,
|
||||||
|
|
|
@ -137,6 +137,7 @@ typedef struct
|
||||||
struct {
|
struct {
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
} region;
|
} region;
|
||||||
|
Eina_Bool orientation;
|
||||||
} lopt;
|
} lopt;
|
||||||
} Op_Load; // +"file""key"
|
} Op_Load; // +"file""key"
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -302,6 +302,7 @@ evas_cserve_image_load(Image_Entry *ie, const char *file, const char *key, RGBA_
|
||||||
msg.lopt.region.y = lopt->region.y;
|
msg.lopt.region.y = lopt->region.y;
|
||||||
msg.lopt.region.w = lopt->region.w;
|
msg.lopt.region.w = lopt->region.w;
|
||||||
msg.lopt.region.h = lopt->region.h;
|
msg.lopt.region.h = lopt->region.h;
|
||||||
|
msg.lopt.orientation = lopt->orientation;
|
||||||
if (file[0] != '/')
|
if (file[0] != '/')
|
||||||
{
|
{
|
||||||
if (getcwd(wdb, sizeof(wdb)))
|
if (getcwd(wdb, sizeof(wdb)))
|
||||||
|
|
|
@ -488,6 +488,8 @@ struct _RGBA_Image_Loadopts
|
||||||
struct {
|
struct {
|
||||||
unsigned int x, y, w, h;
|
unsigned int x, y, w, h;
|
||||||
} region;
|
} region;
|
||||||
|
|
||||||
|
Eina_Bool orientation; // if EINA_TRUE => should honor orientation information provided by file (like jpeg exif info)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Image_Entry_Flags
|
struct _Image_Entry_Flags
|
||||||
|
|
Loading…
Reference in New Issue