add call to allow program to query if image object has alpha...

SVN revision: 4664
This commit is contained in:
Carsten Haitzler 2001-04-20 01:58:57 +00:00
parent 45f9adc1d5
commit 3e9ca9ebfa
3 changed files with 22 additions and 0 deletions

View File

@ -183,6 +183,7 @@ void evas_show(Evas e, Evas_Object o);
void evas_hide(Evas e, Evas_Object o); void evas_hide(Evas e, Evas_Object o);
/* image query ops */ /* image query ops */
int evas_get_image_alpha(Evas e, Evas_Object o);
void evas_get_image_size(Evas e, Evas_Object o, int *w, int *h); void evas_get_image_size(Evas e, Evas_Object o, int *w, int *h);
void evas_get_image_border(Evas e, Evas_Object o, int *l, int *r, int *t, int *b); void evas_get_image_border(Evas e, Evas_Object o, int *l, int *r, int *t, int *b);
Imlib_Load_Error evas_get_image_load_error(Evas e, Evas_Object o); Imlib_Load_Error evas_get_image_load_error(Evas e, Evas_Object o);

View File

@ -203,6 +203,7 @@ struct _Evas_Object_Image
char *file; char *file;
int new_data; int new_data;
int scale; int scale;
int alpha;
struct { struct {
int w, h; int w, h;
} image; } image;

View File

@ -77,8 +77,13 @@ evas_add_image_from_file(Evas e, char *file)
imlib_context_set_image(im); imlib_context_set_image(im);
oo->current.image.w = imlib_image_get_width(); oo->current.image.w = imlib_image_get_width();
oo->current.image.h = imlib_image_get_height(); oo->current.image.h = imlib_image_get_height();
oo->current.alpha = imlib_image_has_alpha();
imlib_free_image(); imlib_free_image();
} }
else
{
oo->current.alpha = 1;
}
} }
} }
oo->current.fill.x = 0; oo->current.fill.x = 0;
@ -149,6 +154,7 @@ evas_set_image_file(Evas e, Evas_Object o, char *file)
imlib_context_set_image(im); imlib_context_set_image(im);
oo->current.image.w = imlib_image_get_width(); oo->current.image.w = imlib_image_get_width();
oo->current.image.h = imlib_image_get_height(); oo->current.image.h = imlib_image_get_height();
oo->current.alpha = imlib_image_has_alpha();
imlib_free_image(); imlib_free_image();
evas_resize(e, o, evas_resize(e, o,
(double)oo->current.image.w, (double)oo->current.image.w,
@ -169,6 +175,7 @@ evas_set_image_file(Evas e, Evas_Object o, char *file)
oo->current.fill.y = 0; oo->current.fill.y = 0;
oo->current.fill.w = (double)oo->current.image.w; oo->current.fill.w = (double)oo->current.image.w;
oo->current.fill.h = (double)oo->current.image.h; oo->current.fill.h = (double)oo->current.image.h;
oo->current.alpha = 1;
} }
} }
o->changed = 1; o->changed = 1;
@ -182,6 +189,7 @@ evas_set_image_file(Evas e, Evas_Object o, char *file)
oo->current.file = NULL; oo->current.file = NULL;
oo->current.image.w = 0; oo->current.image.w = 0;
oo->current.image.h = 0; oo->current.image.h = 0;
oo->current.alpha = 1;
evas_resize(e, o, evas_resize(e, o,
(double)oo->current.image.w, (double)oo->current.image.w,
(double)oo->current.image.h); (double)oo->current.image.h);
@ -222,6 +230,18 @@ evas_set_image_fill(Evas e, Evas_Object o, double x, double y, double w, double
} }
/* image query ops */ /* image query ops */
int
evas_get_image_alpha(Evas e, Evas_Object o)
{
Evas_Object_Image oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_IMAGE) return 0;
oo = o;
return oo->current.alpha;
}
void void
evas_get_image_size(Evas e, Evas_Object o, int *w, int *h) evas_get_image_size(Evas e, Evas_Object o, int *w, int *h)
{ {