Re: [E-devel] Swallowing an image in an edje part

2008-12-13 Thread Vincent Pomageot
Thanks for your answer Gustavo !
I've tried the new evas_object_image_filled_add() and it works well I
think... for someone who want to fill the complete evas canvas with an image
and resize it when one or the other is resized.
What I wanted to do was to fill the part:swallow with my image in order to
have its top left corner at rel1 and the bottom right corner at rel2.
I think getting the part:swallow as an object and then querying its min size
didn't do what I expected but I've found a better way to do that :
edje_object_part_geometry_get()
So here is my code now :

   - const Evas_Object *swallow = NULL;
   - swallow = edje_object_part_object_get(my_edje, place_for_image);
   - edje_object_size_min_get(swallow, w, h);
   - evas_object_image_fill_set(image, 0, 0, w, h);
   + Evas_Coord x, y;
   + edje_object_part_geometry_get(my_edje, place_for_image, x, y ,w,
h);
   + printf(x:%d, y:%d, w:%d, h:%d, x, y, w, h);
   + evas_object_image_fill_set(image, 0, 0, w, h);
   + edje_object_part_swallow(my_edje, place_for_image, image);

With that call I can even remove the min size of the swallow part in the edc
because it seams to be calculated..
Don't know if the description of my problem is clearer now or if I really
understand what you proposed :p
But now it works so thank you Gustavo !

2008/12/12 Gustavo Sverzut Barbieri barbi...@profusion.mobi

 On Fri, Dec 12, 2008 at 6:07 PM, Vincent Pomageot
 vincent.pomag...@gmail.com wrote:
  Hi devs !
 
  I'm begining to play with edje and have difficulties to swallow an
  evas_object_image into an edje part swallow.
  I'm under the impression I have to call evas_object_image_fill_set()
 before
  swalloing the image into the edje but I must do something wrong because
  either my image isn't scaled to the swallowing part or I get something
 gray.

 yes, this is correct, Edje will not even know the swallowed part is an
 image, so it will not change fill property.

 if you want to keep it scaled (fill == (0, 0, w, h)), then you
 should add an event listener for EVAS_CALLBACK_RESIZE and apply fill
 again.

 For Python I added FilledImage that will do that for you for a long
 time, just noticed that C still miss such a helper! So I just added to
 SVN (r38120):

   Evas_Object  *evas_object_image_filled_add(Evas *e);
   void  evas_object_image_filled_set(Evas_Object *obj, Evas_Bool
 setting);
   Evas_Bool evas_object_image_filled_get(const Evas_Object *obj);

 See attached file for usage example.

 --
 Gustavo Sverzut Barbieri
 http://profusion.mobi embedded systems
 --
 MSN: barbi...@gmail.com
 Skype: gsbarbieri
 Mobile: +55 (19) 9225-2202

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] Swallowing an image in an edje part

2008-12-13 Thread Gustavo Sverzut Barbieri
On Sat, Dec 13, 2008 at 9:04 AM, Vincent Pomageot
vincent.pomag...@gmail.com wrote:
 Thanks for your answer Gustavo !
 I've tried the new evas_object_image_filled_add() and it works well I
 think... for someone who want to fill the complete evas canvas with an image
 and resize it when one or the other is resized.
 What I wanted to do was to fill the part:swallow with my image in order to
 have its top left corner at rel1 and the bottom right corner at rel2.
 I think getting the part:swallow as an object and then querying its min size
 didn't do what I expected but I've found a better way to do that :
 edje_object_part_geometry_get()
 So here is my code now :

- const Evas_Object *swallow = NULL;
- swallow = edje_object_part_object_get(my_edje, place_for_image);
- edje_object_size_min_get(swallow, w, h);
- evas_object_image_fill_set(image, 0, 0, w, h);
+ Evas_Coord x, y;
+ edje_object_part_geometry_get(my_edje, place_for_image, x, y ,w,
 h);
+ printf(x:%d, y:%d, w:%d, h:%d, x, y, w, h);
+ evas_object_image_fill_set(image, 0, 0, w, h);
+ edje_object_part_swallow(my_edje, place_for_image, image);

 With that call I can even remove the min size of the swallow part in the edc
 because it seams to be calculated..
 Don't know if the description of my problem is clearer now or if I really
 understand what you proposed :p
 But now it works so thank you Gustavo !

You don't need none of this, in pseudo code your code should be something like:

   Evas_Object *image = evas_object_image_filled_add(evas);
   evas_object_image_file_set(image, path, NULL);
   edje_object_part_swallow(my_edje, place_for_image, image);

that's it, no show, no resize, no nothing. This should work.

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] Swallowing an image in an edje part

2008-12-13 Thread Vincent Pomageot
You're right ! Working perfectly now !
I was associating my image with the canvas... that couldn't work..
Thanks a lot !

2008/12/13 Gustavo Sverzut Barbieri barbi...@profusion.mobi

 On Sat, Dec 13, 2008 at 9:04 AM, Vincent Pomageot
 vincent.pomag...@gmail.com wrote:
  Thanks for your answer Gustavo !
  I've tried the new evas_object_image_filled_add() and it works well I
  think... for someone who want to fill the complete evas canvas with an
 image
  and resize it when one or the other is resized.
  What I wanted to do was to fill the part:swallow with my image in order
 to
  have its top left corner at rel1 and the bottom right corner at rel2.
  I think getting the part:swallow as an object and then querying its min
 size
  didn't do what I expected but I've found a better way to do that :
  edje_object_part_geometry_get()
  So here is my code now :
 
 - const Evas_Object *swallow = NULL;
 - swallow = edje_object_part_object_get(my_edje, place_for_image);
 - edje_object_size_min_get(swallow, w, h);
 - evas_object_image_fill_set(image, 0, 0, w, h);
 + Evas_Coord x, y;
 + edje_object_part_geometry_get(my_edje, place_for_image, x, y
 ,w,
  h);
 + printf(x:%d, y:%d, w:%d, h:%d, x, y, w, h);
 + evas_object_image_fill_set(image, 0, 0, w, h);
 + edje_object_part_swallow(my_edje, place_for_image, image);
 
  With that call I can even remove the min size of the swallow part in the
 edc
  because it seams to be calculated..
  Don't know if the description of my problem is clearer now or if I really
  understand what you proposed :p
  But now it works so thank you Gustavo !

 You don't need none of this, in pseudo code your code should be something
 like:

   Evas_Object *image = evas_object_image_filled_add(evas);
   evas_object_image_file_set(image, path, NULL);
edje_object_part_swallow(my_edje, place_for_image, image);

 that's it, no show, no resize, no nothing. This should work.

 --
 Gustavo Sverzut Barbieri
 http://profusion.mobi embedded systems
 --
 MSN: barbi...@gmail.com
 Skype: gsbarbieri
 Mobile: +55 (19) 9225-2202

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[E-devel] Swallowing an image in an edje part

2008-12-12 Thread Vincent Pomageot
Hi devs !

I'm begining to play with edje and have difficulties to swallow an
evas_object_image into an edje part swallow.
I'm under the impression I have to call evas_object_image_fill_set() before
swalloing the image into the edje but I must do something wrong because
either my image isn't scaled to the swallowing part or I get something gray.

Here is what I do :
[...]
my_edje = edje_object_add(evas);
edje_object_file_set(my_edje, theme.edj, main);

evas_object_move(my_edje, 0, 0);
edje_object_size_min_get(my_edje, w ,h);
evas_object_resize(my_edje, w, h);
ecore_evas_resize(ecore_evas, w, h);

image = evas_object_image_add(evas);
evas_object_image_file_set(image, /path/to/my/image.jpg, NULL);
evas_object_name_set(image, image_swallow);
const Evas_Object *swallow = NULL;
swallow = edje_object_part_object_get(my_edje, place_for_image);
edje_object_size_min_get(swallow, w, h);
evas_object_image_fill_set(image, 0, 0, w, h);
edje_object_part_swallow(my_edje, place_for_image, image);
[...]

And the edc :

collections {
group { name: main;
min: 131 111;
max: 131 111;
parts {
part { name: bg;
type: RECT;
description { state: default 0;
min:131 111;
max:131 111;
color: 255 255 255 255;
}
}

part { name: image_swallow;
type: SWALLOW;
clip_to: bg;
description { state: default 0;
min: 100 100;
rel1.relative: 0.15 0.07;
rel2.relative: 0.91 0.95;
}
}
[...]

I should be wrong somewhere (in fact I don't like to set the min size of the
swallowed part..)
So, iIs there anyone to help me please ?

Vincent
--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] Swallowing an image in an edje part

2008-12-12 Thread Gustavo Sverzut Barbieri
On Fri, Dec 12, 2008 at 6:07 PM, Vincent Pomageot
vincent.pomag...@gmail.com wrote:
 Hi devs !

 I'm begining to play with edje and have difficulties to swallow an
 evas_object_image into an edje part swallow.
 I'm under the impression I have to call evas_object_image_fill_set() before
 swalloing the image into the edje but I must do something wrong because
 either my image isn't scaled to the swallowing part or I get something gray.

yes, this is correct, Edje will not even know the swallowed part is an
image, so it will not change fill property.

if you want to keep it scaled (fill == (0, 0, w, h)), then you
should add an event listener for EVAS_CALLBACK_RESIZE and apply fill
again.

For Python I added FilledImage that will do that for you for a long
time, just noticed that C still miss such a helper! So I just added to
SVN (r38120):

   Evas_Object  *evas_object_image_filled_add(Evas *e);
   void  evas_object_image_filled_set(Evas_Object *obj, Evas_Bool setting);
   Evas_Bool evas_object_image_filled_get(const Evas_Object *obj);

See attached file for usage example.

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
#include Evas.h
#include Ecore.h
#include Ecore_Evas.h
#include stdio.h
#include stdlib.h

static void
on_delete(void *data, Evas *e, Evas_Object *o, void *einfo)
{
   ecore_main_loop_quit();
}


int
main(int argc, char *argv[])
{
   Ecore_Evas *ee;
   Evas *e;
   Evas_Object *im;
   const char *file;
   int load_err;

   if (argc  2)
 {
	fputs(ERROR: missing image filename.\n, stderr);
	return -1;
 }
   file = argv[1];

   evas_init();
   ecore_init();
   ecore_evas_init();

   ee = ecore_evas_new(NULL, 0, 0, 320, 240, NULL);
   if (!ee) goto end;

   e = ecore_evas_get(ee);
   im = evas_object_image_filled_add(e);
   if (!im) goto end;

   evas_object_image_file_set(im, file, NULL);
   load_err = evas_object_image_load_error_get(im);
   if (load_err != EVAS_LOAD_ERROR_NONE)
 {
	fprintf(stderr, ERROR: could not load image \%s\: %d\n,
		file, load_err);
	goto end;
 }

   ecore_evas_object_associate(ee, im, 0);
   evas_object_event_callback_add(im, EVAS_CALLBACK_DEL, on_delete, NULL);
   evas_object_resize(im, 320, 240);
   evas_object_show(im);

   ecore_main_loop_begin();

 end:
   ecore_evas_shutdown();
   ecore_shutdown();
   evas_shutdown();
   return 0;
}
--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel