2008-07-10 15:53:33 -07:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
2008-07-10 15:53:33 -07:00
|
|
|
#include "../engines/common/evas_convert_color.h"
|
|
|
|
#include "../engines/common/evas_convert_colorspace.h"
|
|
|
|
#include "../engines/common/evas_convert_yuv.h"
|
2008-11-03 14:50:54 -08:00
|
|
|
#include "evas_object_image.h"
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* private magic number for image objects */
|
|
|
|
static const char o_type[] = "image";
|
|
|
|
|
|
|
|
|
|
|
|
/* private methods for image objects */
|
|
|
|
static void evas_object_image_unload(Evas_Object *obj);
|
|
|
|
static void evas_object_image_load(Evas_Object *obj);
|
|
|
|
|
|
|
|
static void evas_object_image_init(Evas_Object *obj);
|
|
|
|
static void *evas_object_image_new(void);
|
|
|
|
static void evas_object_image_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y);
|
|
|
|
static void evas_object_image_free(Evas_Object *obj);
|
|
|
|
static void evas_object_image_render_pre(Evas_Object *obj);
|
|
|
|
static void evas_object_image_render_post(Evas_Object *obj);
|
|
|
|
|
2008-08-30 19:04:31 -07:00
|
|
|
static unsigned int evas_object_image_id_get(Evas_Object *obj);
|
|
|
|
static unsigned int evas_object_image_visual_id_get(Evas_Object *obj);
|
2008-08-25 22:45:04 -07:00
|
|
|
static void *evas_object_image_engine_data_get(Evas_Object *obj);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static int evas_object_image_is_opaque(Evas_Object *obj);
|
|
|
|
static int evas_object_image_was_opaque(Evas_Object *obj);
|
2007-07-23 07:22:57 -07:00
|
|
|
static int evas_object_image_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2008-05-18 20:13:16 -07:00
|
|
|
static void *evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_Colorspace to_cspace);
|
|
|
|
|
2007-05-06 04:29:37 -07:00
|
|
|
static const Evas_Object_Func object_func =
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
/* methods (compulsory) */
|
|
|
|
evas_object_image_free,
|
2007-10-05 12:37:21 -07:00
|
|
|
evas_object_image_render,
|
|
|
|
evas_object_image_render_pre,
|
|
|
|
evas_object_image_render_post,
|
2008-08-30 19:04:31 -07:00
|
|
|
evas_object_image_id_get,
|
|
|
|
evas_object_image_visual_id_get,
|
|
|
|
evas_object_image_engine_data_get,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* these are optional. NULL = nothing */
|
2007-10-05 12:37:21 -07:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
evas_object_image_is_opaque,
|
|
|
|
evas_object_image_was_opaque,
|
|
|
|
evas_object_image_is_inside,
|
|
|
|
NULL,
|
|
|
|
NULL
|
2002-11-08 00:02:15 -08:00
|
|
|
};
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2004-08-01 05:34:19 -07:00
|
|
|
* @defgroup Evas_Object_Image Image Object Functions
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2004-08-01 05:34:19 -07:00
|
|
|
* Functions used to create and manipulate image objects.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* Note - Image objects may return or accept "image data" in multiple formats.
|
|
|
|
* This is based on the colorspace of an object. Here is a rundown on formats:
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* EVAS_COLORSPACE_ARGB8888:
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* This pixel format is a linear block of pixels, starting at the top-left row
|
|
|
|
* by row until the bottom right of the image or pixel region. All pixels are
|
|
|
|
* 32-bit unsigned int's with the high-byte being alpha and the low byte being
|
2007-10-05 12:37:21 -07:00
|
|
|
* blue in the format ARGB. Alpha may or may not be used by evas depending on
|
2007-07-09 17:13:26 -07:00
|
|
|
* the alpha flag of the image, but if not used, should be set to 0xff anyway.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* This colorspace uses premultiplied alpha. That means that R, G and B cannot
|
|
|
|
* exceed A in value. The conversion from non-premultiplied colorspace is:
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* R = (r * a) / 255; G = (g * a) / 255; B = (b * a) / 255;
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* So 50% transparent blue will be: 0x80000080. This will not be "dark" - just
|
|
|
|
* 50% transparent. Values are 0 == black, 255 == solid or full red, green or
|
|
|
|
* blue.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* EVAS_COLORSPACE_YCBCR422P601_PL:
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* This is a pointer-list indirected set of YUV (YCbCr) pixel data. This means
|
|
|
|
* that the data returned or set is not actual pixel data, but pointers TO
|
|
|
|
* lines of pixel data. The list of pointers will first be N rows of pointers
|
|
|
|
* to the Y plane - pointing to the first pixel at the start of each row in
|
|
|
|
* the Y plane. N is the height of the image data in pixels. Each pixel in the
|
|
|
|
* Y, U and V planes is 1 byte exactly, packed. The next N / 2 pointers will
|
|
|
|
* point to rows in the U plane, and the next N / 2 pointers will point to
|
|
|
|
* the V plane rows. U and V planes are half the horizontal and vertical
|
|
|
|
* resolution of the U plane.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* Row order is top to bottom and row pixels are stored left to right.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* There is a limitation that these images MUST be a multiple of 2 pixels in
|
|
|
|
* size horizontally or vertically. This is due to the U and V planes being
|
|
|
|
* half resolution. Also note that this assumes the itu601 YUV colorspace
|
|
|
|
* specification. This is defined for standard television and mpeg streams.
|
|
|
|
* HDTV may use the itu709 specification.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* Values are 0 to 255, indicating full or no signal in that plane
|
|
|
|
* respectively.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* EVAS_COLORSPACE_YCBCR422P709_PL:
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* Not implemented yet.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* EVAS_COLORSPACE_RGB565_A5P:
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* In the process of being implemented in 1 engine only. This may change.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* This is a pointer to image data for 16-bit half-word pixel data in 16bpp
|
|
|
|
* RGB 565 format (5 bits red, 6 bits green, 5 bits blue), with the high-byte
|
|
|
|
* containing red and the low byte containing blue, per pixel. This data is
|
|
|
|
* packed row by row from the top-left to the bottom right.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* If the image has an alpha channel enabled there will be an extra alpha plane
|
|
|
|
* after the color pixel plane. If not, then this data will not exist and
|
|
|
|
* should not be accessed in any way. This plane is a set of pixels with 1
|
|
|
|
* byte per pixel defining the alpha values of all pixels in the image from
|
|
|
|
* the top-left to the bottom right of the image, row by row. Even though
|
|
|
|
* the values of the alpha pixels can be 0 to 255, only values 0 through to 32
|
|
|
|
* are used, 32 being solid and 0 being transparent.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* RGB values can be 0 to 31 for red and blue and 0 to 63 for green, with 0
|
|
|
|
* being black and 31 or 63 being full red, green or blue respectively. This
|
|
|
|
* colorspace is also pre-multiplied like EVAS_COLORSPACE_ARGB8888 so:
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
2007-07-09 17:13:26 -07:00
|
|
|
* R = (r * a) / 32; G = (g * a) / 32; B = (b * a) / 32;
|
2004-08-01 05:34:19 -07:00
|
|
|
*/
|
|
|
|
|
2008-11-01 14:07:49 -07:00
|
|
|
/**
|
|
|
|
* @addtogroup Evas_Object_Image
|
|
|
|
* @{
|
2008-11-01 14:50:36 -07:00
|
|
|
* @ingroup Evas_Object_Specific
|
2008-11-01 14:07:49 -07:00
|
|
|
*/
|
|
|
|
|
2004-08-01 05:34:19 -07:00
|
|
|
/**
|
|
|
|
* Creates a new image object on the given evas.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
|
|
|
* @param e The given evas.
|
|
|
|
* @return The created image object.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Object *
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_object_image_add(Evas *e)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
2007-09-30 08:04:51 -07:00
|
|
|
Evas_Object_Image *o;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
obj = evas_object_new();
|
|
|
|
evas_object_image_init(obj);
|
|
|
|
evas_object_inject(obj, e);
|
2007-09-30 08:04:51 -07:00
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
2002-11-08 00:02:15 -08:00
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Sets the filename and key of the given image object.
|
|
|
|
*
|
|
|
|
* If the file supports multiple data stored in it as eet,
|
|
|
|
* you can specify the key to be used as the index of the
|
|
|
|
* image in this file.
|
|
|
|
*
|
|
|
|
* @param obj The given image object.
|
|
|
|
* @param file The image filename.
|
|
|
|
* @param key The image key in file, or NULL.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2006-08-18 07:45:26 -07:00
|
|
|
Evas_Image_Load_Opts lo;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
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();
|
|
|
|
if ((o->cur.file) && (file) && (!strcmp(o->cur.file, file)))
|
|
|
|
{
|
|
|
|
if ((!o->cur.key) && (!key))
|
|
|
|
return;
|
2004-02-16 11:22:48 -08:00
|
|
|
if ((o->cur.key) && (key) && (!strcmp(o->cur.key, key)))
|
|
|
|
return;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2008-10-15 07:38:34 -07:00
|
|
|
if (o->cur.file) eina_stringshare_del(o->cur.file);
|
|
|
|
if (o->cur.key) eina_stringshare_del(o->cur.key);
|
|
|
|
if (file) o->cur.file = eina_stringshare_add(file);
|
2002-11-08 00:02:15 -08:00
|
|
|
else o->cur.file = NULL;
|
2008-10-15 07:38:34 -07:00
|
|
|
if (key) o->cur.key = eina_stringshare_add(key);
|
2002-11-08 00:02:15 -08:00
|
|
|
else o->cur.key = NULL;
|
|
|
|
o->prev.file = NULL;
|
|
|
|
o->prev.key = NULL;
|
|
|
|
if (o->engine_data)
|
|
|
|
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
|
|
|
o->load_error = EVAS_LOAD_ERROR_NONE;
|
2006-08-18 07:45:26 -07:00
|
|
|
lo.scale_down_by = o->load_opts.scale_down_by;
|
|
|
|
lo.dpi = o->load_opts.dpi;
|
|
|
|
lo.w = o->load_opts.w;
|
|
|
|
lo.h = o->load_opts.h;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_load(obj->layer->evas->engine.data.output,
|
|
|
|
o->cur.file,
|
|
|
|
o->cur.key,
|
2006-08-18 07:45:26 -07:00
|
|
|
&o->load_error,
|
|
|
|
&lo);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2003-02-14 17:30:32 -08:00
|
|
|
int w, h;
|
2007-07-23 07:22:57 -07:00
|
|
|
int stride;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->layer->evas->engine.func->image_size_get(obj->layer->evas->engine.data.output,
|
2003-02-14 17:30:32 -08:00
|
|
|
o->engine_data, &w, &h);
|
2007-07-23 07:22:57 -07:00
|
|
|
if (obj->layer->evas->engine.func->image_stride_get)
|
|
|
|
obj->layer->evas->engine.func->image_stride_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data, &stride);
|
|
|
|
else
|
|
|
|
stride = w;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->cur.has_alpha = obj->layer->evas->engine.func->image_alpha_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
2006-12-17 07:48:52 -08:00
|
|
|
o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
2003-02-14 17:30:32 -08:00
|
|
|
o->cur.image.w = w;
|
|
|
|
o->cur.image.h = h;
|
2007-07-23 07:22:57 -07:00
|
|
|
o->cur.image.stride = stride;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o->load_error = EVAS_LOAD_ERROR_GENERIC;
|
2004-02-16 11:22:48 -08:00
|
|
|
o->cur.has_alpha = 1;
|
2006-12-17 07:48:52 -08:00
|
|
|
o->cur.cspace = EVAS_COLORSPACE_ARGB8888;
|
2004-02-16 11:22:48 -08:00
|
|
|
o->cur.image.w = 0;
|
|
|
|
o->cur.image.h = 0;
|
2007-07-23 07:22:57 -07:00
|
|
|
o->cur.image.stride = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
o->changed = 1;
|
|
|
|
evas_object_change(obj);
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2004-08-01 05:34:19 -07:00
|
|
|
* Retrieves the filename and key of the given image object.
|
2007-10-05 12:37:21 -07:00
|
|
|
*
|
|
|
|
* @param obj The given image object.
|
|
|
|
* @param file Location to store the image filename, or NULL.
|
|
|
|
* @param key Location to store the image key, or NULL.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_file_get(const Evas_Object *obj, const char **file, const char **key)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
if (file) *file = NULL;
|
|
|
|
if (key) *key = NULL;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
if (file) *file = NULL;
|
|
|
|
if (key) *key = NULL;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (file) *file = o->cur.file;
|
|
|
|
if (key) *key = o->cur.key;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Sets how much of each border of the given image object is not
|
2004-08-01 05:34:19 -07:00
|
|
|
* to be scaled.
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2004-08-01 05:34:19 -07:00
|
|
|
* When rendering, the image may be scaled to fit the size of the
|
2007-10-05 12:37:21 -07:00
|
|
|
* image object. This function sets what area around the border of
|
|
|
|
* the image is not to be scaled. This sort of function is useful for
|
2004-08-01 05:34:19 -07:00
|
|
|
* widget theming, where, for example, buttons may be of varying
|
|
|
|
* sizes, but the border size must remain constant.
|
|
|
|
*
|
|
|
|
* The units used for @p l, @p r, @p t and @p b are output units.
|
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @param l Distance of the left border that is not to be stretched.
|
|
|
|
* @param r Distance of the right border that is not to be stretched.
|
|
|
|
* @param t Distance of the top border that is not to be stretched.
|
|
|
|
* @param b Distance of the bottom border that is not to be stretched.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_object_image_border_set(Evas_Object *obj, int l, int r, int t, int b)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
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();
|
|
|
|
if (l < 0) l = 0;
|
|
|
|
if (r < 0) r = 0;
|
|
|
|
if (t < 0) t = 0;
|
|
|
|
if (b < 0) b = 0;
|
|
|
|
if ((o->cur.border.l == l) &&
|
|
|
|
(o->cur.border.r == r) &&
|
|
|
|
(o->cur.border.t == t) &&
|
|
|
|
(o->cur.border.b == b)) return;
|
|
|
|
o->cur.border.l = l;
|
|
|
|
o->cur.border.r = r;
|
|
|
|
o->cur.border.t = t;
|
|
|
|
o->cur.border.b = b;
|
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Retrieves how much of each border of the given image object is not to
|
2004-08-01 05:34:19 -07:00
|
|
|
* be scaled.
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* See @ref evas_object_image_border_set for more details.
|
2004-08-01 05:34:19 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @param l Location to store the left border width in, or NULL.
|
|
|
|
* @param r Location to store the right border width in, or NULL.
|
|
|
|
* @param t Location to store the top border width in, or NULL.
|
|
|
|
* @param b Location to store the bottom border width in, or NULL.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
if (l) *l = 0;
|
|
|
|
if (r) *r = 0;
|
|
|
|
if (t) *t = 0;
|
|
|
|
if (b) *b = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
if (l) *l = 0;
|
|
|
|
if (r) *r = 0;
|
|
|
|
if (t) *t = 0;
|
|
|
|
if (b) *b = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (l) *l = o->cur.border.l;
|
|
|
|
if (r) *r = o->cur.border.r;
|
|
|
|
if (t) *t = o->cur.border.t;
|
|
|
|
if (b) *b = o->cur.border.b;
|
|
|
|
}
|
|
|
|
|
2007-10-05 12:37:21 -07:00
|
|
|
/**
|
|
|
|
* Sets if the center part of the given image object (not the border)
|
|
|
|
* should be drawn.
|
2005-03-31 03:39:55 -08:00
|
|
|
*
|
|
|
|
* When rendering, the image may be scaled to fit the size of the
|
2007-10-05 12:37:21 -07:00
|
|
|
* image object. This function sets if the center part of the scaled image
|
2005-03-31 03:39:55 -08:00
|
|
|
* is to be drawn or left completely blank. Very useful for frames and
|
|
|
|
* decorations.
|
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @param fill Whether the center should be drawn.
|
2005-03-31 03:39:55 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2005-03-31 03:39:55 -08:00
|
|
|
evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Bool fill)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2005-03-31 03:39:55 -08:00
|
|
|
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();
|
2008-11-03 14:50:54 -08:00
|
|
|
if (((o->cur.border.center_fill) && (fill)) ||
|
|
|
|
((!o->cur.border.center_fill) && (!fill)))
|
2005-03-31 03:39:55 -08:00
|
|
|
return;
|
2008-11-03 14:50:54 -08:00
|
|
|
o->cur.border.center_fill = fill;
|
2005-03-31 03:39:55 -08:00
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2005-03-31 03:39:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Retrieves if the center of the given image object is to be drawn
|
|
|
|
* or not.
|
2005-03-31 03:39:55 -08:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* See @ref evas_object_image_fill_set for more details.
|
2005-03-31 03:39:55 -08:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @return If the center is to be drawn or not.
|
2005-03-31 03:39:55 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Bool
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_border_center_fill_get(const Evas_Object *obj)
|
2005-03-31 03:39:55 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2005-03-31 03:39:55 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
2008-11-03 14:50:54 -08:00
|
|
|
return o->cur.border.center_fill;
|
2005-03-31 03:39:55 -08:00
|
|
|
}
|
|
|
|
|
2004-08-12 05:14:01 -07:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Sets the rectangle of the given image object that the image will
|
|
|
|
* be drawn to.
|
2004-08-12 05:14:01 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* Note that the image will be tiled around this one rectangle. To have
|
2004-08-01 05:34:19 -07:00
|
|
|
* only one copy of the image drawn, @p x and @p y must be 0 and @p w
|
|
|
|
* and @p h need to be the width and height of the image object
|
|
|
|
* respectively.
|
|
|
|
*
|
|
|
|
* The default values for the fill parameters is @p x = 0, @p y = 0,
|
|
|
|
* @p w = 32 and @p h = 32.
|
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @param x The X coordinate for the top left corner of the image.
|
|
|
|
* @param y The Y coordinate for the top left corner of the image.
|
|
|
|
* @param w The width of the image.
|
|
|
|
* @param h The height of the image.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_object_image_fill_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (w < 0) w = -w;
|
|
|
|
if (h < 0) h = -h;
|
|
|
|
if (w == 0.0) return;
|
|
|
|
if (h == 0.0) return;
|
|
|
|
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();
|
|
|
|
if ((o->cur.fill.x == x) &&
|
|
|
|
(o->cur.fill.y == y) &&
|
|
|
|
(o->cur.fill.w == w) &&
|
|
|
|
(o->cur.fill.h == h)) return;
|
|
|
|
o->cur.fill.x = x;
|
|
|
|
o->cur.fill.y = y;
|
|
|
|
o->cur.fill.w = w;
|
|
|
|
o->cur.fill.h = h;
|
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Retrieves the dimensions of the rectangle of the given image object
|
|
|
|
* that the image will be drawn to.
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2004-08-01 05:34:19 -07:00
|
|
|
* See @ref evas_object_image_fill_set for more details.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @param x Location to store the X coordinate for the top left corner of the image in, or NULL.
|
|
|
|
* @param y Location to store the Y coordinate for the top left corner of the image in, or NULL.
|
|
|
|
* @param w Location to store the width of the image in, or NULL.
|
|
|
|
* @param h Location to store the height of the image in, or NULL.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_fill_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
|
|
|
if (w) *w = 0;
|
|
|
|
if (h) *h = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
|
|
|
if (w) *w = 0;
|
|
|
|
if (h) *h = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (x) *x = o->cur.fill.x;
|
|
|
|
if (y) *y = o->cur.fill.y;
|
|
|
|
if (w) *w = o->cur.fill.w;
|
|
|
|
if (h) *h = o->cur.fill.h;
|
|
|
|
}
|
|
|
|
|
2008-08-30 19:04:31 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the tiling mode for the given evas image object's fill.
|
|
|
|
* @param obj The given evas image object.
|
|
|
|
* @param spread One of EVAS_TEXTURE_REFLECT, EVAS_TEXTURE_REPEAT,
|
|
|
|
* EVAS_TEXTURE_RESTRICT, or EVAS_TEXTURE_PAD.
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_fill_spread_set(Evas_Object *obj, int spread)
|
|
|
|
{
|
|
|
|
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();
|
2008-11-03 14:50:54 -08:00
|
|
|
if (spread == o->cur.fill.spread) return;
|
|
|
|
o->cur.fill.spread = spread;
|
2008-08-30 19:04:31 -07:00
|
|
|
o->changed = 1;
|
|
|
|
evas_object_change(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the spread (tiling mode) for the given image object's fill.
|
|
|
|
* @param obj The given evas image object.
|
|
|
|
* @return The current spread mode of the image object.
|
|
|
|
*/
|
|
|
|
EAPI int
|
|
|
|
evas_object_image_fill_spread_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return EVAS_TEXTURE_REPEAT;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return EVAS_TEXTURE_REPEAT;
|
|
|
|
MAGIC_CHECK_END();
|
2008-11-03 14:50:54 -08:00
|
|
|
return o->cur.fill.spread;
|
2008-08-30 19:04:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_fill_transform_set (Evas_Object *obj, Evas_Transform *t)
|
|
|
|
{
|
|
|
|
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();
|
|
|
|
if (!t)
|
|
|
|
{
|
2008-11-03 14:50:54 -08:00
|
|
|
o->cur.fill.transform.mxx = 1;
|
|
|
|
o->cur.fill.transform.mxy = 0;
|
|
|
|
o->cur.fill.transform.mxz = 0;
|
|
|
|
o->cur.fill.transform.myx = 0;
|
|
|
|
o->cur.fill.transform.myy = 1;
|
|
|
|
o->cur.fill.transform.myz = 0;
|
|
|
|
o->cur.fill.transform.mzx = 0;
|
|
|
|
o->cur.fill.transform.mzy = 0;
|
|
|
|
o->cur.fill.transform.mzz = 1;
|
|
|
|
o->cur.fill.transform.is_identity = 1;
|
2008-10-26 09:18:58 -07:00
|
|
|
o->changed = 1;
|
2008-08-30 19:04:31 -07:00
|
|
|
evas_object_change(obj);
|
|
|
|
return;
|
|
|
|
}
|
2008-11-03 14:50:54 -08:00
|
|
|
if ( (o->cur.fill.transform.mxx == t->mxx) &&
|
|
|
|
(o->cur.fill.transform.mxy == t->mxy) &&
|
|
|
|
(o->cur.fill.transform.mxz == t->mxz) &&
|
|
|
|
(o->cur.fill.transform.myx == t->myx) &&
|
|
|
|
(o->cur.fill.transform.myy == t->myy) &&
|
|
|
|
(o->cur.fill.transform.myz == t->myz) &&
|
|
|
|
(o->cur.fill.transform.mzx == t->mzx) &&
|
|
|
|
(o->cur.fill.transform.mzy == t->mzy) &&
|
|
|
|
(o->cur.fill.transform.mzz == t->mzz) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
o->cur.fill.transform.mxx = t->mxx;
|
|
|
|
o->cur.fill.transform.mxy = t->mxy;
|
|
|
|
o->cur.fill.transform.mxz = t->mxz;
|
|
|
|
o->cur.fill.transform.myx = t->myx;
|
|
|
|
o->cur.fill.transform.myy = t->myy;
|
|
|
|
o->cur.fill.transform.myz = t->myz;
|
|
|
|
o->cur.fill.transform.mzx = t->mzx;
|
|
|
|
o->cur.fill.transform.mzy = t->mzy;
|
|
|
|
o->cur.fill.transform.mzz = t->mzz;
|
|
|
|
o->cur.fill.transform.is_identity = 0;
|
|
|
|
if ( (t->mxx == 1) && (t->mxy == 0) && (t->mxz == 0) &&
|
|
|
|
(t->myx == 0) && (t->myy == 1) && (t->myz == 0) &&
|
|
|
|
(t->mzx == 0) && (t->mzy == 0) && (t->mzz == 1) )
|
|
|
|
o->cur.fill.transform.is_identity = 1;
|
2008-10-26 09:18:58 -07:00
|
|
|
o->changed = 1;
|
2008-08-30 19:04:31 -07:00
|
|
|
evas_object_change(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_fill_transform_get (const Evas_Object *obj, Evas_Transform *t)
|
|
|
|
{
|
|
|
|
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();
|
|
|
|
if (t)
|
|
|
|
{
|
2008-11-03 14:50:54 -08:00
|
|
|
t->mxx = o->cur.fill.transform.mxx;
|
|
|
|
t->mxy = o->cur.fill.transform.mxy;
|
|
|
|
t->mxz = o->cur.fill.transform.mxz;
|
|
|
|
t->myx = o->cur.fill.transform.myx;
|
|
|
|
t->myy = o->cur.fill.transform.myy;
|
|
|
|
t->myz = o->cur.fill.transform.myz;
|
|
|
|
t->mzx = o->cur.fill.transform.mzx;
|
|
|
|
t->mzy = o->cur.fill.transform.mzy;
|
|
|
|
t->mzz = o->cur.fill.transform.mzz;
|
2008-08-30 19:04:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-12 05:14:01 -07:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Sets the size of the given image object.
|
2004-08-12 05:14:01 -07:00
|
|
|
*
|
|
|
|
* This function will scale down or crop the image so that it is
|
2007-10-05 12:37:21 -07:00
|
|
|
* treated as if it were at the given size. If the size given is
|
|
|
|
* smaller than the image, it will be cropped. If the size given is
|
2004-08-12 05:14:01 -07:00
|
|
|
* larger, then the image will be treated as if it were in the upper
|
|
|
|
* left hand corner of a larger image that is otherwise transparent.
|
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @param w The new width of the image.
|
|
|
|
* @param h The new height of the image.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_object_image_size_set(Evas_Object *obj, int w, int h)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2007-07-23 07:22:57 -07:00
|
|
|
int stride;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
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();
|
|
|
|
if (w < 1) w = 1;
|
|
|
|
if (h < 1) h = 1;
|
|
|
|
if (w > 32768) return;
|
|
|
|
if (h > 32768) return;
|
|
|
|
if ((w == o->cur.image.w) &&
|
|
|
|
(h == o->cur.image.h)) return;
|
|
|
|
o->cur.image.w = w;
|
|
|
|
o->cur.image.h = h;
|
|
|
|
if (o->engine_data)
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_size_set(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
w, h);
|
|
|
|
else
|
2006-12-17 07:48:52 -08:00
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_new_from_copied_data
|
|
|
|
(obj->layer->evas->engine.data.output, w, h, NULL, o->cur.has_alpha,
|
|
|
|
o->cur.cspace);
|
2007-07-23 07:22:57 -07:00
|
|
|
|
|
|
|
if (obj->layer->evas->engine.func->image_stride_get)
|
|
|
|
obj->layer->evas->engine.func->image_stride_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data, &stride);
|
|
|
|
else
|
|
|
|
stride = w;
|
|
|
|
o->cur.image.stride = stride;
|
|
|
|
|
2006-12-17 07:48:52 -08:00
|
|
|
/* FIXME - in engine call above
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
o->cur.has_alpha);
|
2007-10-05 12:37:21 -07:00
|
|
|
*/
|
2003-02-13 02:25:30 -08:00
|
|
|
EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
|
2002-11-08 00:02:15 -08:00
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Retrieves the size of the given image object.
|
|
|
|
*
|
|
|
|
* See @ref evas_object_image_size_set for more details.
|
|
|
|
*
|
|
|
|
* @param obj The given image object.
|
|
|
|
* @param w Location to store the width of the image in, or NULL.
|
|
|
|
* @param h Location to store the height of the image in, or NULL.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_size_get(const Evas_Object *obj, int *w, int *h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
if (w) *w = 0;
|
|
|
|
if (h) *h = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
if (w) *w = 0;
|
|
|
|
if (h) *h = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (w) *w = o->cur.image.w;
|
|
|
|
if (h) *h = o->cur.image.h;
|
|
|
|
}
|
|
|
|
|
2007-07-23 07:22:57 -07:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Retrieves the row stride of the given image object,
|
|
|
|
*
|
|
|
|
* The row stride is the number of units between the start of a
|
|
|
|
* row and the start of the next row.
|
|
|
|
*
|
|
|
|
* @param obj The given image object.
|
|
|
|
* @return The stride of the image.
|
2007-07-23 07:22:57 -07:00
|
|
|
*/
|
|
|
|
EAPI int
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_stride_get(const Evas_Object *obj)
|
2007-07-23 07:22:57 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return o->cur.image.stride;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2004-08-01 05:34:19 -07:00
|
|
|
* Retrieves a number representing any error that occurred during the last
|
2007-10-05 12:37:21 -07:00
|
|
|
* load of the given image object.
|
|
|
|
*
|
2004-08-01 05:34:19 -07:00
|
|
|
* @param obj The given image object.
|
2007-10-05 12:37:21 -07:00
|
|
|
* @return A value giving the last error that occurred. It should be one of
|
2004-08-01 05:34:19 -07:00
|
|
|
* the @c EVAS_LOAD_ERROR_* values. @c EVAS_LOAD_ERROR_NONE is
|
|
|
|
* returned if there was no error.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI int
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_load_error_get(const Evas_Object *obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return o->load_error;
|
|
|
|
}
|
|
|
|
|
2008-05-18 20:13:16 -07:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2007-10-05 12:37:21 -07:00
|
|
|
/**
|
|
|
|
* Sets the raw image data of the given image object.
|
|
|
|
*
|
|
|
|
* Note that the raw data must be of the same size and colorspace
|
|
|
|
* of the image. If data is NULL the current image data will be freed.
|
|
|
|
*
|
2007-04-28 03:21:30 -07:00
|
|
|
* @param obj The given image object.
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param data The raw data, or NULL.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_object_image_data_set(Evas_Object *obj, void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
void *p_data;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
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();
|
|
|
|
p_data = o->engine_data;
|
2005-04-01 08:12:09 -08:00
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
if (o->engine_data)
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output,
|
2005-05-21 19:49:50 -07:00
|
|
|
o->engine_data,
|
2005-03-27 20:58:25 -08:00
|
|
|
data);
|
2005-04-01 08:12:09 -08:00
|
|
|
else
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_new_from_data(obj->layer->evas->engine.data.output,
|
|
|
|
o->cur.image.w,
|
|
|
|
o->cur.image.h,
|
2006-12-17 07:48:52 -08:00
|
|
|
data,
|
|
|
|
o->cur.has_alpha,
|
|
|
|
o->cur.cspace);
|
2005-04-01 08:12:09 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (o->engine_data)
|
|
|
|
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
|
|
|
o->load_error = EVAS_LOAD_ERROR_NONE;
|
|
|
|
o->cur.image.w = 0;
|
|
|
|
o->cur.image.h = 0;
|
2007-07-23 07:22:57 -07:00
|
|
|
o->cur.image.stride = 0;
|
2005-04-01 08:12:09 -08:00
|
|
|
o->engine_data = NULL;
|
|
|
|
}
|
2006-12-17 07:48:52 -08:00
|
|
|
/* FIXME - in engine call above
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
o->cur.has_alpha);
|
2007-10-05 12:37:21 -07:00
|
|
|
*/
|
2004-09-21 21:54:39 -07:00
|
|
|
if (o->pixels_checked_out > 0) o->pixels_checked_out--;
|
2002-11-08 00:02:15 -08:00
|
|
|
if (p_data != o->engine_data)
|
|
|
|
{
|
2003-02-13 02:25:30 -08:00
|
|
|
EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
|
2004-09-21 21:54:39 -07:00
|
|
|
o->pixels_checked_out = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Get a pointer to the raw image data of the given image object.
|
|
|
|
*
|
|
|
|
* This function returns a pointer to an image object's internal pixel buffer,
|
|
|
|
* for reading only or read/write. If you request it for writing, the image
|
|
|
|
* will be marked dirty so that it gets redrawn at the next update.
|
|
|
|
*
|
|
|
|
* This is best suited when you want to modify an existing image,
|
|
|
|
* without changing its dimensions.
|
|
|
|
*
|
2007-04-28 03:21:30 -07:00
|
|
|
* @param obj The given image object.
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param for_writing Whether the data being retrieved will be modified.
|
|
|
|
* @return The raw image data.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void *
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_data_get(const Evas_Object *obj, Evas_Bool for_writing)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
DATA32 *data;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
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;
|
|
|
|
data = NULL;
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
2005-05-21 19:49:50 -07:00
|
|
|
for_writing,
|
2002-11-08 00:02:15 -08:00
|
|
|
&data);
|
2004-09-21 21:54:39 -07:00
|
|
|
o->pixels_checked_out++;
|
|
|
|
if (for_writing)
|
|
|
|
{
|
|
|
|
EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
|
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2008-09-16 07:52:57 -07:00
|
|
|
/**
|
|
|
|
* Preload image in the background
|
|
|
|
*
|
|
|
|
* This function request the preload of the data image in the background. The
|
|
|
|
* worked is queued before being processed.
|
|
|
|
*
|
|
|
|
* If cancel is set, it will remove the image from the workqueue.
|
|
|
|
*
|
|
|
|
* @param obj The given image object.
|
|
|
|
* @param cancel 0 means add to the workqueue, 1 remove it.
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_preload(const Evas_Object *obj, Evas_Bool cancel)
|
|
|
|
{
|
|
|
|
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();
|
|
|
|
if (!o->engine_data) return ;
|
|
|
|
if (cancel)
|
|
|
|
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
|
|
|
else
|
|
|
|
obj->layer->evas->engine.func->image_data_preload_request(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
obj);
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Replaces the raw image data of the given image object.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* This function lets the application replace an image object's internal pixel
|
2007-10-05 12:37:21 -07:00
|
|
|
* buffer with a user-allocated one. For best results, you should generally
|
2007-06-04 02:48:28 -07:00
|
|
|
* first call evas_object_image_size_set() with the width and height for the
|
|
|
|
* new buffer.
|
|
|
|
*
|
|
|
|
* This call is best suited for when you will be using image data with
|
2007-10-05 12:37:21 -07:00
|
|
|
* different dimensions than the existing image data, if any. If you only need
|
2007-06-04 02:48:28 -07:00
|
|
|
* to modify the existing image in some fashion, then using
|
|
|
|
* evas_object_image_data_get() is probably what you are after.
|
|
|
|
*
|
|
|
|
* Note that the caller is responsible for freeing the buffer when finished
|
|
|
|
* with it, as user-set image data will not be automatically freed when the
|
|
|
|
* image object is deleted.
|
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* See @ref evas_object_image_data_get for more details.
|
|
|
|
*
|
|
|
|
* @param obj The given image object.
|
|
|
|
* @param data The raw data.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_object_image_data_copy_set(Evas_Object *obj, void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!data) return;
|
|
|
|
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();
|
|
|
|
if ((o->cur.image.w <= 0) ||
|
|
|
|
(o->cur.image.h <= 0)) return;
|
|
|
|
if (o->engine_data)
|
|
|
|
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_new_from_copied_data(obj->layer->evas->engine.data.output,
|
|
|
|
o->cur.image.w,
|
|
|
|
o->cur.image.h,
|
2006-12-17 07:48:52 -08:00
|
|
|
data,
|
|
|
|
o->cur.has_alpha,
|
|
|
|
o->cur.cspace);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
o->cur.has_alpha);
|
2004-09-21 21:54:39 -07:00
|
|
|
o->pixels_checked_out = 0;
|
2003-02-13 02:25:30 -08:00
|
|
|
EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Mark a sub-region of the given image object to be redrawn.
|
|
|
|
*
|
|
|
|
* This function schedules a particular rectangular region of an image
|
|
|
|
* object to be updated (redrawn) at the next render.
|
|
|
|
*
|
2007-04-28 03:21:30 -07:00
|
|
|
* @param obj The given image object.
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param x X-offset of the region to be updated.
|
|
|
|
* @param y Y-offset of the region to be updated.
|
|
|
|
* @param w Width of the region to be updated.
|
|
|
|
* @param h Height of the region to be updated.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_object_image_data_update_add(Evas_Object *obj, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
Evas_Rectangle *r;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
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();
|
|
|
|
RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, o->cur.image.w, o->cur.image.h);
|
|
|
|
if ((w <= 0) || (h <= 0)) return;
|
|
|
|
NEW_RECT(r, x, y, w, h);
|
2008-10-21 09:31:05 -07:00
|
|
|
if (r) o->pixel_updates = eina_list_append(o->pixel_updates, r);
|
2002-11-08 00:02:15 -08:00
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2007-10-05 12:37:21 -07:00
|
|
|
/**
|
|
|
|
* Enable or disable alpha channel of the given image object.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* This function sets a flag on an image object indicating whether or not to
|
|
|
|
* use alpha channel data. A value of 1 indicates to use alpha channel data,
|
|
|
|
* and 0 indicates to ignore any alpha channel data. Note that this has
|
|
|
|
* nothing to do with an object's color as manipulated by
|
|
|
|
* evas_object_color_set().
|
2007-06-04 02:48:28 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @param has_alpha Whether to use alpha channel data or not.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_object_image_alpha_set(Evas_Object *obj, Evas_Bool has_alpha)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
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();
|
|
|
|
if (((has_alpha) && (o->cur.has_alpha)) ||
|
|
|
|
((!has_alpha) && (!o->cur.has_alpha)))
|
|
|
|
return;
|
|
|
|
o->cur.has_alpha = has_alpha;
|
|
|
|
if (o->engine_data)
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
o->cur.has_alpha);
|
|
|
|
evas_object_image_data_update_add(obj, 0, 0, o->cur.image.w, o->cur.image.h);
|
2003-02-13 02:25:30 -08:00
|
|
|
EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2007-10-05 12:37:21 -07:00
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Retrieves the alpha channel setting of the given image object.
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* This function returns 1 if the image object's alpha channel is being used,
|
|
|
|
* or 0 otherwise.
|
|
|
|
*
|
|
|
|
* See @ref evas_object_image_alpha_set for more details.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @return Whether the alpha channel data is being used.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Bool
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_alpha_get(const Evas_Object *obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return o->cur.has_alpha;
|
|
|
|
}
|
|
|
|
|
2007-10-05 12:37:21 -07:00
|
|
|
/**
|
|
|
|
* Sets whether to use of high-quality image scaling algorithm
|
|
|
|
* of the given image object.
|
|
|
|
*
|
|
|
|
* When enabled, a higher quality image scaling algorithm is used when scaling
|
|
|
|
* images to sizes other than the source image. This gives better results but
|
|
|
|
* is more computationally expensive.
|
|
|
|
*
|
|
|
|
* @param obj The given image object.
|
|
|
|
* @param smooth_scale Whether to use smooth scale or not.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_object_image_smooth_scale_set(Evas_Object *obj, Evas_Bool smooth_scale)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
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;
|
2005-05-21 19:49:50 -07:00
|
|
|
MAGIC_CHECK_END();
|
2002-11-08 00:02:15 -08:00
|
|
|
if (((smooth_scale) && (o->cur.smooth_scale)) ||
|
|
|
|
((!smooth_scale) && (!o->cur.smooth_scale)))
|
|
|
|
return;
|
|
|
|
o->cur.smooth_scale = smooth_scale;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Retrieves whether the given image object is using use a high-quality
|
|
|
|
* image scaling algorithm.
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* See @ref evas_object_image_smooth_scale_set for more details.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @return Whether smooth scale is being used.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Bool
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_smooth_scale_get(const Evas_Object *obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0;
|
2005-05-21 19:49:50 -07:00
|
|
|
MAGIC_CHECK_END();
|
2002-11-08 00:02:15 -08:00
|
|
|
return o->cur.smooth_scale;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* To be documented.
|
2007-06-04 02:48:28 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* FIXME: To be fixed.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_object_image_reload(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
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();
|
2004-09-22 19:18:15 -07:00
|
|
|
if ((!o->cur.file) ||
|
|
|
|
(o->pixels_checked_out > 0)) return;
|
2004-09-22 19:08:26 -07:00
|
|
|
if (o->engine_data)
|
2005-10-02 08:15:44 -07:00
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_dirty_region(obj->layer->evas->engine.data.output, o->engine_data, 0, 0, o->cur.image.w, o->cur.image.h);
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_object_image_unload(obj);
|
|
|
|
evas_object_image_load(obj);
|
|
|
|
o->changed = 1;
|
|
|
|
evas_object_change(obj);
|
|
|
|
}
|
|
|
|
|
2005-11-10 22:09:46 -08:00
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Save the given image object to a file.
|
2005-11-10 22:09:46 -08:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* Note that you should pass the filename extension when saving.
|
|
|
|
* If the file supports multiple data stored in it as eet,
|
|
|
|
* you can specify the key to be used as the index of the
|
|
|
|
* image in this file.
|
2005-11-10 22:09:46 -08:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* You can specify some flags when saving the image.
|
|
|
|
* Currently acceptable flags are quality and compress.
|
|
|
|
* Eg.: "quality=100 compress=9"
|
|
|
|
*
|
|
|
|
* @param obj The given image object.
|
|
|
|
* @param file The filename to be used to save the image.
|
|
|
|
* @param key The image key in file, or NULL.
|
|
|
|
* @param flags String containing the flags to be used.
|
2005-11-10 22:09:46 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Bool
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_save(const Evas_Object *obj, const char *file, const char *key, const char *flags)
|
2005-11-10 22:09:46 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
DATA32 *data = NULL;
|
|
|
|
int quality = 80, compress = 9, ok = 0;
|
|
|
|
RGBA_Image *im;
|
2007-10-05 12:37:21 -07:00
|
|
|
|
2005-11-10 22:09:46 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
if (!o->engine_data) return 0;
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
0,
|
|
|
|
&data);
|
|
|
|
if (flags)
|
|
|
|
{
|
|
|
|
char *p, *pp;
|
|
|
|
char *tflags;
|
|
|
|
|
2005-11-30 00:45:20 -08:00
|
|
|
tflags = alloca(strlen(flags) + 1);
|
|
|
|
strcpy(tflags, flags);
|
|
|
|
p = tflags;
|
|
|
|
while (p)
|
2005-11-10 22:09:46 -08:00
|
|
|
{
|
2005-11-30 00:45:20 -08:00
|
|
|
pp = strchr(p, ' ');
|
|
|
|
if (pp) *pp = 0;
|
|
|
|
sscanf(p, "quality=%i", &quality);
|
|
|
|
sscanf(p, "compress=%i", &compress);
|
|
|
|
if (pp) p = pp + 1;
|
|
|
|
else break;
|
2005-11-10 22:09:46 -08:00
|
|
|
}
|
|
|
|
}
|
2008-04-11 17:32:30 -07:00
|
|
|
im = (RGBA_Image*) evas_cache_image_data(evas_common_image_cache_get(),
|
|
|
|
o->cur.image.w,
|
|
|
|
o->cur.image.h,
|
|
|
|
data,
|
|
|
|
o->cur.has_alpha,
|
|
|
|
EVAS_COLORSPACE_ARGB8888);
|
2005-11-10 22:09:46 -08:00
|
|
|
if (im)
|
|
|
|
{
|
2008-05-18 20:13:16 -07:00
|
|
|
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);
|
|
|
|
|
|
|
|
if (o->cur.cspace != EVAS_COLORSPACE_ARGB8888)
|
|
|
|
free(im->image.data);
|
|
|
|
}
|
2007-07-16 00:25:35 -07:00
|
|
|
|
2008-04-11 17:32:30 -07:00
|
|
|
evas_cache_image_drop(&im->cache_entry);
|
2005-11-10 22:09:46 -08:00
|
|
|
}
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2003-12-09 17:12:13 -08:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2003-12-09 17:12:13 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Bool
|
2003-12-09 17:12:13 -08:00
|
|
|
evas_object_image_pixels_import(Evas_Object *obj, Evas_Pixel_Import_Source *pixels)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-12-09 17:12:13 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
if ((pixels->w != o->cur.image.w) || (pixels->h != o->cur.image.h)) return 0;
|
|
|
|
switch (pixels->format)
|
|
|
|
{
|
2005-05-21 19:49:50 -07:00
|
|
|
#if 0
|
2003-12-09 17:12:13 -08:00
|
|
|
case EVAS_PIXEL_FORMAT_ARGB32:
|
|
|
|
{
|
|
|
|
if (o->engine_data)
|
|
|
|
{
|
|
|
|
DATA32 *image_pixels = NULL;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
|
|
|
o->engine_data =
|
2003-12-09 17:12:13 -08:00
|
|
|
obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
1,
|
|
|
|
&image_pixels);
|
2005-05-21 19:49:50 -07:00
|
|
|
/* FIXME: need to actualyl support this */
|
2003-12-09 17:12:13 -08:00
|
|
|
/* memcpy(image_pixels, pixels->rows, o->cur.image.w * o->cur.image.h * 4);*/
|
|
|
|
if (o->engine_data)
|
2005-05-21 19:49:50 -07:00
|
|
|
o->engine_data =
|
2003-12-09 17:12:13 -08:00
|
|
|
obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output,
|
2005-05-21 19:49:50 -07:00
|
|
|
o->engine_data,
|
2003-12-09 17:12:13 -08:00
|
|
|
image_pixels);
|
|
|
|
if (o->engine_data)
|
2005-05-21 19:49:50 -07:00
|
|
|
o->engine_data =
|
2003-12-09 17:12:13 -08:00
|
|
|
obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
o->cur.has_alpha);
|
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2003-12-09 17:12:13 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2005-05-21 19:49:50 -07:00
|
|
|
#endif
|
|
|
|
#ifdef BUILD_CONVERT_YUV
|
2003-12-09 17:12:13 -08:00
|
|
|
case EVAS_PIXEL_FORMAT_YUV420P_601:
|
|
|
|
{
|
|
|
|
if (o->engine_data)
|
|
|
|
{
|
|
|
|
DATA32 *image_pixels = NULL;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
|
|
|
o->engine_data =
|
2003-12-09 17:12:13 -08:00
|
|
|
obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
1,
|
|
|
|
&image_pixels);
|
|
|
|
if (image_pixels)
|
2005-05-21 20:02:15 -07:00
|
|
|
evas_common_convert_yuv_420p_601_rgba((DATA8 **) pixels->rows,
|
|
|
|
(DATA8 *) image_pixels,
|
2003-12-09 17:12:13 -08:00
|
|
|
o->cur.image.w,
|
|
|
|
o->cur.image.h);
|
|
|
|
if (o->engine_data)
|
2005-05-21 19:49:50 -07:00
|
|
|
o->engine_data =
|
2003-12-09 17:12:13 -08:00
|
|
|
obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output,
|
2005-05-21 19:49:50 -07:00
|
|
|
o->engine_data,
|
2003-12-09 17:12:13 -08:00
|
|
|
image_pixels);
|
|
|
|
if (o->engine_data)
|
2005-05-21 19:49:50 -07:00
|
|
|
o->engine_data =
|
2003-12-09 17:12:13 -08:00
|
|
|
obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
o->cur.has_alpha);
|
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2003-12-09 17:12:13 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2005-05-21 19:49:50 -07:00
|
|
|
#endif
|
2003-12-09 17:12:13 -08:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* To be documented.
|
2007-06-04 02:48:28 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* FIXME: To be fixed.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2003-12-09 17:12:13 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-12-09 17:12:13 -08:00
|
|
|
evas_object_image_pixels_get_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *o), void *data)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-12-09 17:12:13 -08:00
|
|
|
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->func.get_pixels = func;
|
|
|
|
o->func.get_pixels_data = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Mark whether the given image object is dirty (needs to be redrawn).
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @param dirty Whether the image is dirty.
|
2003-12-09 17:12:13 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-12-09 17:12:13 -08:00
|
|
|
evas_object_image_pixels_dirty_set(Evas_Object *obj, Evas_Bool dirty)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-12-09 17:12:13 -08:00
|
|
|
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();
|
|
|
|
if (dirty) o->dirty_pixels = 1;
|
|
|
|
else o->dirty_pixels = 0;
|
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2003-12-09 17:12:13 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-10-05 12:37:21 -07:00
|
|
|
* Retrieves whether the given image object is dirty (needs to be redrawn).
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-10-05 12:37:21 -07:00
|
|
|
* @param obj The given image object.
|
|
|
|
* @return Whether the image is dirty.
|
2003-12-09 17:12:13 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Bool
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_pixels_dirty_get(const Evas_Object *obj)
|
2003-12-09 17:12:13 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-12-09 17:12:13 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (o->dirty_pixels) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2006-08-18 07:45:26 -07:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_load_dpi_set(Evas_Object *obj, double dpi)
|
|
|
|
{
|
|
|
|
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.dpi = dpi;
|
|
|
|
if (o->cur.file)
|
|
|
|
{
|
|
|
|
evas_object_image_unload(obj);
|
|
|
|
evas_object_image_load(obj);
|
|
|
|
o->changed = 1;
|
|
|
|
evas_object_change(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI double
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_load_dpi_get(const Evas_Object *obj)
|
2006-08-18 07:45:26 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0.0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0.0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return o->load_opts.dpi;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_load_size_set(Evas_Object *obj, int w, int h)
|
|
|
|
{
|
|
|
|
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.w = w;
|
|
|
|
o->load_opts.h = h;
|
|
|
|
if (o->cur.file)
|
|
|
|
{
|
|
|
|
evas_object_image_unload(obj);
|
|
|
|
evas_object_image_load(obj);
|
|
|
|
o->changed = 1;
|
|
|
|
evas_object_change(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_load_size_get(const Evas_Object *obj, int *w, int *h)
|
2006-08-18 07:45:26 -07:00
|
|
|
{
|
|
|
|
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();
|
|
|
|
if (w) *w = o->load_opts.w;
|
|
|
|
if (h) *h = o->load_opts.h;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_load_scale_down_set(Evas_Object *obj, int scale_down)
|
|
|
|
{
|
|
|
|
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.scale_down_by = scale_down;
|
|
|
|
if (o->cur.file)
|
|
|
|
{
|
|
|
|
evas_object_image_unload(obj);
|
|
|
|
evas_object_image_load(obj);
|
|
|
|
o->changed = 1;
|
|
|
|
evas_object_change(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI int
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_load_scale_down_get(const Evas_Object *obj)
|
2006-08-18 07:45:26 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return o->load_opts.scale_down_by;
|
|
|
|
}
|
|
|
|
|
2006-12-09 00:52:08 -08:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_colorspace_set(Evas_Object *obj, Evas_Colorspace cspace)
|
|
|
|
{
|
|
|
|
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();
|
2006-12-17 07:48:52 -08:00
|
|
|
o->cur.cspace = cspace;
|
|
|
|
if (o->engine_data)
|
|
|
|
obj->layer->evas->engine.func->image_colorspace_set(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
cspace);
|
2006-12-09 00:52:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI Evas_Colorspace
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_colorspace_get(const Evas_Object *obj)
|
2006-12-09 00:52:08 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return EVAS_COLORSPACE_ARGB8888;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return EVAS_COLORSPACE_ARGB8888;
|
|
|
|
MAGIC_CHECK_END();
|
2007-09-30 08:04:51 -07:00
|
|
|
return o->cur.cspace;
|
2006-12-09 00:52:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
evas_object_image_native_surface_set(Evas_Object *obj, Evas_Native_Surface *surf)
|
|
|
|
{
|
|
|
|
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();
|
2006-12-09 01:02:43 -08:00
|
|
|
obj->layer->evas->engine.func->image_native_set(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
surf);
|
2006-12-09 00:52:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI Evas_Native_Surface *
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_image_native_surface_get(const Evas_Object *obj)
|
2006-12-09 00:52:08 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
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();
|
2006-12-09 01:02:43 -08:00
|
|
|
return obj->layer->evas->engine.func->image_native_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
2006-12-09 00:52:08 -08:00
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-22 14:24:36 -08:00
|
|
|
evas_image_cache_flush(Evas *e)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2005-05-21 19:49:50 -07:00
|
|
|
|
|
|
|
e->engine.func->image_cache_flush(e->engine.data.output);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-22 14:24:36 -08:00
|
|
|
evas_image_cache_reload(Evas *e)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2008-10-17 04:23:18 -07:00
|
|
|
Evas_Layer *layer;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2003-01-22 14:24:36 -08:00
|
|
|
evas_image_cache_flush(e);
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(e->layers, layer)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2008-10-17 04:23:18 -07:00
|
|
|
Evas_Object *obj;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(layer->objects, obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
2005-05-21 19:49:50 -07:00
|
|
|
if (o->magic == MAGIC_OBJ_IMAGE)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
evas_object_image_unload(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-01-22 14:24:36 -08:00
|
|
|
evas_image_cache_flush(e);
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(e->layers, layer)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2008-10-17 04:23:18 -07:00
|
|
|
Evas_Object *obj;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(layer->objects, obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
2005-05-21 19:49:50 -07:00
|
|
|
if (o->magic == MAGIC_OBJ_IMAGE)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
evas_object_image_load(obj);
|
|
|
|
o->changed = 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_object_change(obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-01-22 14:24:36 -08:00
|
|
|
evas_image_cache_flush(e);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-22 14:24:36 -08:00
|
|
|
evas_image_cache_set(Evas *e, int size)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (size < 0) size = 0;
|
|
|
|
e->engine.func->image_cache_set(e->engine.data.output, size);
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI int
|
2008-02-08 12:44:09 -08:00
|
|
|
evas_image_cache_get(const Evas *e)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
return e->engine.func->image_cache_get(e->engine.data.output);
|
|
|
|
}
|
|
|
|
|
2008-11-01 14:07:49 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* all nice and private */
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_object_image_unload(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
|
|
|
if ((!o->cur.file) ||
|
2004-09-21 21:54:39 -07:00
|
|
|
(o->pixels_checked_out > 0)) return;
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_dirty_region(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
2005-05-21 19:49:50 -07:00
|
|
|
0, 0,
|
|
|
|
o->cur.image.w, o->cur.image.h);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
2005-05-21 19:49:50 -07:00
|
|
|
o->engine_data = NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->load_error = EVAS_LOAD_ERROR_NONE;
|
|
|
|
o->cur.has_alpha = 1;
|
2006-12-17 07:48:52 -08:00
|
|
|
o->cur.cspace = EVAS_COLORSPACE_ARGB8888;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->cur.image.w = 0;
|
|
|
|
o->cur.image.h = 0;
|
2007-07-23 07:22:57 -07:00
|
|
|
o->cur.image.stride = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_object_image_load(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2006-08-18 07:45:26 -07:00
|
|
|
Evas_Image_Load_Opts lo;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
2004-09-22 18:58:50 -07:00
|
|
|
if (o->engine_data) return;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-08-18 07:45:26 -07:00
|
|
|
lo.scale_down_by = o->load_opts.scale_down_by;
|
|
|
|
lo.dpi = o->load_opts.dpi;
|
|
|
|
lo.w = o->load_opts.w;
|
|
|
|
lo.h = o->load_opts.h;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_load(obj->layer->evas->engine.data.output,
|
|
|
|
o->cur.file,
|
|
|
|
o->cur.key,
|
2006-08-18 07:45:26 -07:00
|
|
|
&o->load_error,
|
|
|
|
&lo);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2003-02-14 17:30:32 -08:00
|
|
|
int w, h;
|
2007-07-23 07:22:57 -07:00
|
|
|
int stride;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->layer->evas->engine.func->image_size_get(obj->layer->evas->engine.data.output,
|
2003-02-14 17:30:32 -08:00
|
|
|
o->engine_data, &w, &h);
|
2007-07-23 07:22:57 -07:00
|
|
|
if (obj->layer->evas->engine.func->image_stride_get)
|
|
|
|
obj->layer->evas->engine.func->image_stride_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data, &stride);
|
|
|
|
else
|
|
|
|
stride = w;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->cur.has_alpha = obj->layer->evas->engine.func->image_alpha_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
2006-12-17 07:48:52 -08:00
|
|
|
o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
2003-02-14 17:30:32 -08:00
|
|
|
o->cur.image.w = w;
|
|
|
|
o->cur.image.h = h;
|
2007-07-23 07:22:57 -07:00
|
|
|
o->cur.image.stride = stride;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o->load_error = EVAS_LOAD_ERROR_GENERIC;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_object_image_init(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
/* alloc image ob, setup methods and default values */
|
|
|
|
obj->object_data = evas_object_image_new();
|
|
|
|
/* set up default settings for this kind of object */
|
|
|
|
obj->cur.color.r = 255;
|
|
|
|
obj->cur.color.g = 255;
|
|
|
|
obj->cur.color.b = 255;
|
|
|
|
obj->cur.color.a = 255;
|
2007-10-04 21:52:10 -07:00
|
|
|
obj->cur.geometry.x = 0;
|
|
|
|
obj->cur.geometry.y = 0;
|
|
|
|
obj->cur.geometry.w = 0;
|
|
|
|
obj->cur.geometry.h = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->cur.layer = 0;
|
2006-09-30 03:18:37 -07:00
|
|
|
obj->cur.anti_alias = 0;
|
2006-05-02 00:28:49 -07:00
|
|
|
obj->cur.render_op = EVAS_RENDER_BLEND;
|
2002-11-08 00:02:15 -08:00
|
|
|
/* set up object-specific settings */
|
|
|
|
obj->prev = obj->cur;
|
|
|
|
/* set up methods (compulsory) */
|
|
|
|
obj->func = &object_func;
|
|
|
|
obj->type = o_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
evas_object_image_new(void)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* alloc obj private data */
|
|
|
|
o = calloc(1, sizeof(Evas_Object_Image));
|
|
|
|
o->magic = MAGIC_OBJ_IMAGE;
|
2007-10-04 21:52:10 -07:00
|
|
|
o->cur.fill.w = 1;
|
|
|
|
o->cur.fill.h = 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->cur.smooth_scale = 1;
|
2008-11-03 14:50:54 -08:00
|
|
|
o->cur.border.center_fill = 1;
|
2006-12-17 07:48:52 -08:00
|
|
|
o->cur.cspace = EVAS_COLORSPACE_ARGB8888;
|
2008-11-03 14:50:54 -08:00
|
|
|
o->cur.fill.transform.mxx = o->cur.fill.transform.myy = o->cur.fill.transform.mzz = 1;
|
|
|
|
o->cur.fill.transform.is_identity = 1;
|
|
|
|
o->cur.fill.spread = EVAS_TEXTURE_REPEAT;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->prev = o->cur;
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_object_image_free(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
/* frees private object data. very simple here */
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
/* free obj */
|
2008-10-15 07:38:34 -07:00
|
|
|
if (o->cur.file) eina_stringshare_del(o->cur.file);
|
|
|
|
if (o->cur.key) eina_stringshare_del(o->cur.key);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data);
|
2005-10-03 06:14:07 -07:00
|
|
|
o->engine_data = NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
o->magic = 0;
|
|
|
|
while (o->pixel_updates)
|
|
|
|
{
|
|
|
|
Evas_Rectangle *r;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
r = (Evas_Rectangle *)o->pixel_updates->data;
|
2008-10-21 09:31:05 -07:00
|
|
|
o->pixel_updates = eina_list_remove(o->pixel_updates, r);
|
2002-11-08 00:02:15 -08:00
|
|
|
free(r);
|
|
|
|
}
|
|
|
|
free(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_object_image_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
2004-09-20 20:15:42 -07:00
|
|
|
/* render object to surface with context, and offset by x,y */
|
2002-11-08 00:02:15 -08:00
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
obj->layer->evas->engine.func->context_color_set(output,
|
|
|
|
context,
|
|
|
|
255, 255, 255, 255);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if ((obj->cur.cache.clip.r == 255) &&
|
|
|
|
(obj->cur.cache.clip.g == 255) &&
|
|
|
|
(obj->cur.cache.clip.b == 255) &&
|
|
|
|
(obj->cur.cache.clip.a == 255))
|
|
|
|
{
|
|
|
|
obj->layer->evas->engine.func->context_multiplier_unset(output,
|
|
|
|
context);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
obj->layer->evas->engine.func->context_multiplier_set(output,
|
|
|
|
context,
|
|
|
|
obj->cur.cache.clip.r,
|
|
|
|
obj->cur.cache.clip.g,
|
|
|
|
obj->cur.cache.clip.b,
|
|
|
|
obj->cur.cache.clip.a);
|
2006-05-02 00:28:49 -07:00
|
|
|
|
|
|
|
obj->layer->evas->engine.func->context_render_op_set(output, context,
|
|
|
|
obj->cur.render_op);
|
2008-11-03 14:50:54 -08:00
|
|
|
/*
|
|
|
|
obj->layer->evas->engine.func->context_anti_alias_set(output, context,
|
|
|
|
obj->cur.anti_alias);
|
|
|
|
*/
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->engine_data)
|
|
|
|
{
|
2003-10-17 20:34:00 -07:00
|
|
|
Evas_Coord idw, idh, idx, idy;
|
2002-11-08 00:02:15 -08:00
|
|
|
int ix, iy, iw, ih;
|
2003-12-09 17:12:13 -08:00
|
|
|
|
|
|
|
if (o->dirty_pixels)
|
|
|
|
{
|
|
|
|
if (o->func.get_pixels)
|
2005-10-03 06:53:11 -07:00
|
|
|
{
|
|
|
|
o->func.get_pixels(o->func.get_pixels_data, obj);
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_dirty_region(obj->layer->evas->engine.data.output, o->engine_data, 0, 0, o->cur.image.w, o->cur.image.h);
|
|
|
|
}
|
2003-12-09 17:12:13 -08:00
|
|
|
o->dirty_pixels = 0;
|
|
|
|
}
|
2008-11-03 14:50:54 -08:00
|
|
|
obj->layer->evas->engine.func->image_draw(output, context, surface, o,
|
|
|
|
obj->cur.geometry.x + x,
|
|
|
|
obj->cur.geometry.y + y,
|
|
|
|
obj->cur.geometry.w,
|
|
|
|
obj->cur.geometry.h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_object_image_render_pre(Evas_Object *obj)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
Evas_Rectangles rects = { 0, 0, NULL };
|
2002-11-08 00:02:15 -08:00
|
|
|
Evas_Object_Image *o;
|
|
|
|
int is_v, was_v;
|
|
|
|
|
|
|
|
/* dont pre-render the obj twice! */
|
|
|
|
if (obj->pre_render_done) return;
|
|
|
|
obj->pre_render_done = 1;
|
|
|
|
/* pre-render phase. this does anything an object needs to do just before */
|
|
|
|
/* rendering. this could mean loading the image data, retrieving it from */
|
|
|
|
/* elsewhere, decoding video etc. */
|
|
|
|
/* then when this is done the object needs to figure if it changed and */
|
2004-02-16 11:22:48 -08:00
|
|
|
/* if so what and where and add the appropriate redraw rectangles */
|
2002-11-08 00:02:15 -08:00
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
/* if someone is clipping this obj - go calculate the clipper */
|
|
|
|
if (obj->cur.clipper)
|
|
|
|
{
|
2005-04-03 07:22:17 -07:00
|
|
|
if (obj->cur.cache.clip.dirty)
|
|
|
|
evas_object_clip_recalc(obj->cur.clipper);
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->cur.clipper->func->render_pre(obj->cur.clipper);
|
|
|
|
}
|
|
|
|
/* now figure what changed and add draw rects */
|
|
|
|
/* if it just became visible or invisible */
|
|
|
|
is_v = evas_object_is_visible(obj);
|
|
|
|
was_v = evas_object_was_visible(obj);
|
|
|
|
if (is_v != was_v)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_visible_change(&rects, obj, is_v, was_v);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2004-02-16 11:22:48 -08:00
|
|
|
/* it's not visible - we accounted for it appearing or not so just abort */
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!is_v) goto done;
|
|
|
|
/* clipper changed this is in addition to anything else for obj */
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_clipper_change(&rects, obj);
|
2004-02-16 11:22:48 -08:00
|
|
|
/* if we restacked (layer or just within a layer) and don't clip anyone */
|
2002-11-08 00:02:15 -08:00
|
|
|
if (obj->restack)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
/* if it changed color */
|
|
|
|
if ((obj->cur.color.r != obj->prev.color.r) ||
|
|
|
|
(obj->cur.color.g != obj->prev.color.g) ||
|
|
|
|
(obj->cur.color.b != obj->prev.color.b) ||
|
|
|
|
(obj->cur.color.a != obj->prev.color.a))
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2006-05-02 00:28:49 -07:00
|
|
|
/* if it changed render op */
|
|
|
|
if (obj->cur.render_op != obj->prev.render_op)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2006-05-02 00:28:49 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
|
|
|
}
|
2006-09-30 03:18:37 -07:00
|
|
|
/* if it changed anti_alias */
|
2008-11-03 14:50:54 -08:00
|
|
|
/*
|
2006-09-30 03:18:37 -07:00
|
|
|
if (obj->cur.anti_alias != obj->prev.anti_alias)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2006-09-30 03:18:37 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
|
|
|
}
|
2008-11-03 14:50:54 -08:00
|
|
|
*/
|
2002-11-08 00:02:15 -08:00
|
|
|
if (o->changed)
|
|
|
|
{
|
|
|
|
if (((o->cur.file) && (!o->prev.file)) ||
|
|
|
|
((!o->cur.file) && (o->prev.file)) ||
|
|
|
|
((o->cur.key) && (!o->prev.key)) ||
|
2005-11-30 00:45:20 -08:00
|
|
|
((!o->cur.key) && (o->prev.key))
|
2002-11-08 00:02:15 -08:00
|
|
|
)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
if ((o->cur.image.w != o->prev.image.w) ||
|
|
|
|
(o->cur.image.h != o->prev.image.h) ||
|
|
|
|
(o->cur.has_alpha != o->prev.has_alpha) ||
|
2006-12-17 07:48:52 -08:00
|
|
|
(o->cur.cspace != o->prev.cspace) ||
|
2002-11-08 00:02:15 -08:00
|
|
|
(o->cur.smooth_scale != o->prev.smooth_scale))
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
if ((o->cur.border.l != o->prev.border.l) ||
|
|
|
|
(o->cur.border.r != o->prev.border.r) ||
|
|
|
|
(o->cur.border.t != o->prev.border.t) ||
|
|
|
|
(o->cur.border.b != o->prev.border.b))
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2008-11-03 14:50:54 -08:00
|
|
|
if (o->cur.fill.spread != o->prev.fill.spread)
|
|
|
|
{
|
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
|
|
|
if (!o->pixel_updates) goto done;
|
|
|
|
}
|
|
|
|
if ( (o->cur.fill.transform.mxx != o->prev.fill.transform.mxx) ||
|
|
|
|
(o->cur.fill.transform.mxy != o->prev.fill.transform.mxy) ||
|
|
|
|
(o->cur.fill.transform.mxz != o->prev.fill.transform.mxz) ||
|
|
|
|
(o->cur.fill.transform.myx != o->prev.fill.transform.myx) ||
|
|
|
|
(o->cur.fill.transform.myy != o->prev.fill.transform.myy) ||
|
|
|
|
(o->cur.fill.transform.myz != o->prev.fill.transform.myz) )
|
|
|
|
{
|
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
|
|
|
if (!o->pixel_updates) goto done;
|
|
|
|
}
|
2003-12-09 17:12:13 -08:00
|
|
|
if (o->dirty_pixels)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2003-12-09 17:12:13 -08:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
/* if it changed geometry - and obviously not visibility or color */
|
|
|
|
/* caluclate differences since we have a constant color fill */
|
|
|
|
/* we really only need to update the differences */
|
2008-11-03 14:50:54 -08:00
|
|
|
if ( o->cur.fill.transform.is_identity && o->prev.fill.transform.is_identity &&
|
|
|
|
((obj->cur.geometry.x != obj->prev.geometry.x) ||
|
2002-11-08 00:02:15 -08:00
|
|
|
(obj->cur.geometry.y != obj->prev.geometry.y) ||
|
|
|
|
(obj->cur.geometry.w != obj->prev.geometry.w) ||
|
|
|
|
(obj->cur.geometry.h != obj->prev.geometry.h)) &&
|
|
|
|
(o->cur.fill.w == o->prev.fill.w) &&
|
|
|
|
(o->cur.fill.h == o->prev.fill.h) &&
|
|
|
|
((o->cur.fill.x + obj->cur.geometry.x) == (o->prev.fill.x + obj->prev.geometry.x)) &&
|
|
|
|
((o->cur.fill.y + obj->cur.geometry.y) == (o->prev.fill.y + obj->prev.geometry.y)) &&
|
|
|
|
(!o->pixel_updates)
|
|
|
|
)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_rects_return_difference_rects(&rects,
|
|
|
|
obj->cur.geometry.x,
|
|
|
|
obj->cur.geometry.y,
|
|
|
|
obj->cur.geometry.w,
|
|
|
|
obj->cur.geometry.h,
|
|
|
|
obj->prev.geometry.x,
|
|
|
|
obj->prev.geometry.y,
|
|
|
|
obj->prev.geometry.w,
|
|
|
|
obj->prev.geometry.h);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
if (((obj->cur.geometry.x != obj->prev.geometry.x) ||
|
|
|
|
(obj->cur.geometry.y != obj->prev.geometry.y) ||
|
|
|
|
(obj->cur.geometry.w != obj->prev.geometry.w) ||
|
|
|
|
(obj->cur.geometry.h != obj->prev.geometry.h))
|
|
|
|
)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
if (o->changed)
|
|
|
|
{
|
|
|
|
if ((o->cur.fill.x != o->prev.fill.x) ||
|
|
|
|
(o->cur.fill.y != o->prev.fill.y) ||
|
|
|
|
(o->cur.fill.w != o->prev.fill.w) ||
|
|
|
|
(o->cur.fill.h != o->prev.fill.h))
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2005-10-03 03:20:12 -07:00
|
|
|
if (!o->pixel_updates) goto done;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
if ((o->cur.border.l == 0) &&
|
|
|
|
(o->cur.border.r == 0) &&
|
|
|
|
(o->cur.border.t == 0) &&
|
|
|
|
(o->cur.border.b == 0))
|
|
|
|
{
|
|
|
|
while (o->pixel_updates)
|
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
Evas_Rectangle *rr;
|
2003-10-17 20:34:00 -07:00
|
|
|
Evas_Coord idw, idh, idx, idy;
|
2002-11-08 00:02:15 -08:00
|
|
|
int x, y, w, h;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
rr = o->pixel_updates->data;
|
2008-10-21 09:31:05 -07:00
|
|
|
o->pixel_updates = eina_list_remove(o->pixel_updates, rr);
|
2005-10-02 08:15:44 -07:00
|
|
|
obj->layer->evas->engine.func->image_dirty_region(obj->layer->evas->engine.data.output, o->engine_data, rr->x, rr->y, rr->w, rr->h);
|
|
|
|
|
2008-11-03 14:50:54 -08:00
|
|
|
idx = o->cur.fill.x;
|
|
|
|
idw = o->cur.fill.w;
|
|
|
|
idy = o->cur.fill.y;
|
|
|
|
idh = o->cur.fill.h;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-10-17 20:34:00 -07:00
|
|
|
if (idw < 1) idw = 1;
|
|
|
|
if (idh < 1) idh = 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
if (idx > 0) idx -= idw;
|
|
|
|
if (idy > 0) idy -= idh;
|
2006-11-15 19:20:24 -08:00
|
|
|
while (idx < obj->cur.geometry.w)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2003-10-17 20:34:00 -07:00
|
|
|
Evas_Coord ydy;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
ydy = idy;
|
|
|
|
x = idx;
|
|
|
|
w = ((int)(idx + idw)) - x;
|
2006-11-15 19:20:24 -08:00
|
|
|
while (idy < obj->cur.geometry.h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2008-07-07 14:29:29 -07:00
|
|
|
Evas_Rectangle r;
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
y = idy;
|
|
|
|
h = ((int)(idy + idh)) - y;
|
2008-07-07 14:29:29 -07:00
|
|
|
|
|
|
|
r.x = ((rr->x - 1) * w) / o->cur.image.w;
|
|
|
|
r.y = ((rr->y - 1) * h) / o->cur.image.h;
|
|
|
|
r.w = ((rr->w + 2) * w) / o->cur.image.w;
|
|
|
|
r.h = ((rr->h + 2) * h) / o->cur.image.h;
|
|
|
|
r.x += obj->cur.geometry.x + x;
|
|
|
|
r.y += obj->cur.geometry.y + y;
|
|
|
|
evas_add_rect(&rects, r.x, r.y, r.w, r.h);
|
2002-11-08 00:02:15 -08:00
|
|
|
idy += h;
|
|
|
|
}
|
|
|
|
idx += idw;
|
|
|
|
idy = ydy;
|
|
|
|
}
|
|
|
|
free(rr);
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (o->pixel_updates)
|
|
|
|
{
|
|
|
|
while (o->pixel_updates)
|
|
|
|
{
|
|
|
|
Evas_Rectangle *r;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
r = (Evas_Rectangle *)o->pixel_updates->data;
|
2008-10-21 09:31:05 -07:00
|
|
|
o->pixel_updates = eina_list_remove(o->pixel_updates, r);
|
2002-11-08 00:02:15 -08:00
|
|
|
free(r);
|
|
|
|
}
|
2005-10-02 08:15:44 -07:00
|
|
|
obj->layer->evas->engine.func->image_dirty_region(obj->layer->evas->engine.data.output, o->engine_data, 0, 0, o->cur.image.w, o->cur.image.h);
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&rects, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* it obviously didn't change - add a NO obscure - this "unupdates" this */
|
|
|
|
/* area so if there were updates for it they get wiped. don't do it if we */
|
2004-02-16 11:22:48 -08:00
|
|
|
/* aren't fully opaque and we are visible */
|
2002-11-08 00:02:15 -08:00
|
|
|
if (evas_object_is_visible(obj) &&
|
|
|
|
evas_object_is_opaque(obj))
|
|
|
|
obj->layer->evas->engine.func->output_redraws_rect_del(obj->layer->evas->engine.data.output,
|
2005-05-21 19:49:50 -07:00
|
|
|
obj->cur.cache.clip.x,
|
|
|
|
obj->cur.cache.clip.y,
|
|
|
|
obj->cur.cache.clip.w,
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->cur.cache.clip.h);
|
|
|
|
done:
|
2008-07-07 14:29:29 -07:00
|
|
|
evas_object_render_pre_effect_updates(&rects, obj, is_v, was_v);
|
2008-11-03 14:50:54 -08:00
|
|
|
if (o->changed)
|
|
|
|
obj->layer->evas->engine.func->image_render_pre(obj->layer->evas->engine.data.output,
|
|
|
|
obj->layer->evas->engine.data.context,
|
|
|
|
o);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_object_image_render_post(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
/* this moves the current data to the previous state parts of the object */
|
|
|
|
/* in whatever way is safest for the object. also if we don't need object */
|
|
|
|
/* data anymore we can free it if the object deems this is a good idea */
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
/* remove those pesky changes */
|
|
|
|
while (obj->clip.changes)
|
|
|
|
{
|
|
|
|
Evas_Rectangle *r;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
r = (Evas_Rectangle *)obj->clip.changes->data;
|
2008-10-21 09:31:05 -07:00
|
|
|
obj->clip.changes = eina_list_remove(obj->clip.changes, r);
|
2002-11-08 00:02:15 -08:00
|
|
|
free(r);
|
|
|
|
}
|
|
|
|
while (o->pixel_updates)
|
|
|
|
{
|
|
|
|
Evas_Rectangle *r;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
r = (Evas_Rectangle *)o->pixel_updates->data;
|
2008-10-21 09:31:05 -07:00
|
|
|
o->pixel_updates = eina_list_remove(o->pixel_updates, r);
|
2002-11-08 00:02:15 -08:00
|
|
|
free(r);
|
|
|
|
}
|
|
|
|
/* move cur to prev safely for object data */
|
|
|
|
obj->prev = obj->cur;
|
|
|
|
o->prev = o->cur;
|
|
|
|
o->changed = 0;
|
|
|
|
/* FIXME: copy strings across */
|
|
|
|
}
|
|
|
|
|
2008-08-30 19:04:31 -07:00
|
|
|
static unsigned int evas_object_image_id_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
if (!o) return 0;
|
|
|
|
return MAGIC_OBJ_IMAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned int evas_object_image_visual_id_get(Evas_Object *obj)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
if (!o) return 0;
|
|
|
|
return MAGIC_OBJ_IMAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *evas_object_image_engine_data_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
if (!o) return NULL;
|
|
|
|
return o->engine_data;
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static int
|
|
|
|
evas_object_image_is_opaque(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
|
|
|
|
|
|
|
/* this returns 1 if the internal object data implies that the object is */
|
2004-02-16 11:22:48 -08:00
|
|
|
/* currently fully opaque over the entire rectangle it occupies */
|
2002-11-08 00:02:15 -08:00
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
2008-11-03 14:50:54 -08:00
|
|
|
if (obj->cur.render_op != EVAS_RENDER_BLEND)
|
|
|
|
return 0;
|
2005-03-31 03:39:55 -08:00
|
|
|
if (((o->cur.border.l != 0) ||
|
|
|
|
(o->cur.border.r != 0) ||
|
|
|
|
(o->cur.border.t != 0) ||
|
|
|
|
(o->cur.border.b != 0)) &&
|
2008-11-03 14:50:54 -08:00
|
|
|
(!o->cur.border.center_fill)) return 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!o->engine_data) return 0;
|
|
|
|
if (o->cur.has_alpha) return 0;
|
2008-11-03 14:50:54 -08:00
|
|
|
if ((o->cur.fill.spread == EVAS_TEXTURE_RESTRICT) &&
|
|
|
|
((!o->cur.fill.transform.is_identity) || (o->cur.fill.x != 0) || (o->cur.fill.y != 0)))
|
2006-05-02 00:28:49 -07:00
|
|
|
return 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
evas_object_image_was_opaque(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* this returns 1 if the internal object data implies that the object was */
|
2004-02-16 11:22:48 -08:00
|
|
|
/* previously fully opaque over the entire rectangle it occupies */
|
2002-11-08 00:02:15 -08:00
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
2008-11-03 14:50:54 -08:00
|
|
|
if (obj->prev.render_op != EVAS_RENDER_BLEND)
|
|
|
|
return 0;
|
2005-03-31 03:39:55 -08:00
|
|
|
if (((o->prev.border.l != 0) ||
|
|
|
|
(o->prev.border.r != 0) ||
|
|
|
|
(o->prev.border.t != 0) ||
|
|
|
|
(o->prev.border.b != 0)) &&
|
2008-11-03 14:50:54 -08:00
|
|
|
(!o->prev.border.center_fill)) return 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!o->engine_data) return 0;
|
|
|
|
if (o->prev.has_alpha) return 0;
|
2008-11-03 14:50:54 -08:00
|
|
|
if ((o->prev.fill.spread == EVAS_TEXTURE_RESTRICT) &&
|
|
|
|
((!o->prev.fill.transform.is_identity) || (o->prev.fill.x != 0) || (o->prev.fill.y != 0)))
|
2006-05-02 00:28:49 -07:00
|
|
|
return 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
return 1;
|
|
|
|
}
|
2007-07-23 07:22:57 -07:00
|
|
|
|
2008-11-03 14:50:54 -08:00
|
|
|
/* FIXME: Need to consider the spread = restrict case and transforms */
|
2007-07-23 07:22:57 -07:00
|
|
|
static int
|
|
|
|
evas_object_image_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
|
|
|
{
|
|
|
|
Evas_Object_Image *o;
|
2008-04-11 17:32:30 -07:00
|
|
|
DATA32 *data;
|
2007-07-23 07:22:57 -07:00
|
|
|
int w, h, stride;
|
|
|
|
int a;
|
|
|
|
|
|
|
|
o = (Evas_Object_Image *)(obj->object_data);
|
|
|
|
|
|
|
|
x -= obj->cur.cache.clip.x;
|
|
|
|
y -= obj->cur.cache.clip.y;
|
|
|
|
w = o->cur.image.w;
|
|
|
|
h = o->cur.image.h;
|
|
|
|
|
|
|
|
if ((x > w) || (y > h))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (!o->cur.has_alpha)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
stride = o->cur.image.stride;
|
|
|
|
|
|
|
|
o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
|
|
|
o->engine_data,
|
|
|
|
0,
|
2008-04-11 17:32:30 -07:00
|
|
|
&data);
|
2007-07-23 07:22:57 -07:00
|
|
|
if (!data)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (o->cur.cspace)
|
|
|
|
{
|
|
|
|
case EVAS_COLORSPACE_ARGB8888:
|
|
|
|
data = ((DATA32*)(data) + ((y * stride) + x));
|
|
|
|
a = (*((DATA32*)(data)) >> 24) & 0xff;
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_RGB565_A5P:
|
2008-04-11 17:32:30 -07:00
|
|
|
data = (void*) ((DATA16*)(data) + (h * stride));
|
|
|
|
data = (void*) ((DATA8*)(data) + ((y * stride) + x));
|
2007-07-23 07:22:57 -07:00
|
|
|
a = (*((DATA8*)(data))) & 0x1f;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (a != 0);
|
|
|
|
}
|
2008-05-18 20:13:16 -07:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|