Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/bin


Modified Files:
        ecore_evas_test_app.c ecore_evas_test_calibrate.c 


Log Message:


ecore_evas supprot for buffers... and bingo... image objects in another
evas.. so u can put an evas in an evas.. and get its pixel data or just
render to raw ARGB memory too :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/bin/ecore_evas_test_app.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ecore_evas_test_app.c       28 Aug 2004 02:06:57 -0000      1.4
+++ ecore_evas_test_app.c       8 Jan 2005 18:40:31 -0000       1.5
@@ -6,10 +6,50 @@
 Ecore_Evas  *ee         = NULL;
 Evas        *evas       = NULL;
 
+Ecore_Idle_Enterer *getpix_handler = NULL;
+
 static void app_resize(Ecore_Evas *ee);
 static int app_signal_exit(void *data, int ev_type, void *ev);
 static void app_delete_request(Ecore_Evas *ee);
 
+static int
+getpix_cb(void *data)
+{
+   int *pix, p;
+   int w, h;
+   FILE *f;
+   int x, y;
+   static int count = 0;
+   char buf[256];
+   unsigned char *line;
+   
+   pix = ecore_evas_buffer_pixels_get(ee);
+   ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
+   snprintf(buf, sizeof(buf), "out%04i.ppm", count);
+   count++;
+   f = fopen(buf, "wb");
+   if (f)
+     {
+       line = malloc(w * 4);
+       fprintf(f, "P6\n%i %i\n255\n", w, h);
+       for (y = 0; y < h; y++)
+         {
+            for (x = 0; x < w; x++)
+              {
+                 p = pix[(y * w) + x];
+                 line[(x * 3) + 0] = ((p >> 16) & 0xff);
+                 line[(x * 3) + 1] = ((p >> 8 ) & 0xff);
+                 line[(x * 3) + 2] = ((p      ) & 0xff);
+/*               line[(x * 3) + 3] = ((p >> 24) & 0xff);*/
+              }
+            fwrite(line, w * 3, 1, f);
+         }
+       free(line);
+       fclose(f);
+     }
+   return 1;
+}
+
 int
 app_start(int argc, const char **argv)
 {
@@ -22,39 +62,80 @@
    /* create an evas */
    if (!ecore_evas_init()) return -1;
    if ((argc > 1) && (!strcmp(argv[1], "-fb")))
-     ee = ecore_evas_fb_new(NULL, 0,  240, 320);
+     {
+       ee = ecore_evas_fb_new(NULL, 0,  240, 320);
+       evas = ecore_evas_get(ee);
+     }
    else if ((argc > 1) && (!strcmp(argv[1], "-x")))
-     ee = ecore_evas_software_x11_new(NULL, 0,  0, 0, 240, 320);
+     {
+       ee = ecore_evas_software_x11_new(NULL, 0,  0, 0, 240, 320);
+       evas = ecore_evas_get(ee);
+     }
 #if HAVE_ECORE_EVAS_GL
    else if ((argc > 1) && (!strcmp(argv[1], "-gl")))
-     ee = ecore_evas_gl_x11_new(NULL, 0,  0, 0, 240, 320);
+     {
+       ee = ecore_evas_gl_x11_new(NULL, 0,  0, 0, 240, 320);
+       evas = ecore_evas_get(ee);
+     }
 #endif
+   else if ((argc > 1) && (!strcmp(argv[1], "-buf")))
+     {
+       ee = ecore_evas_buffer_new(240, 320);
+       evas = ecore_evas_get(ee);
+       getpix_handler = ecore_idle_enterer_add(getpix_cb, NULL);
+     }
+   else if ((argc > 1) && (!strcmp(argv[1], "-buf2")))
+     {
+       Evas_Object *o;
+       
+       ee = ecore_evas_software_x11_new(NULL, 0,  0, 0, 240, 320);
+       
+       o = evas_object_rectangle_add(ecore_evas_get(ee));
+       evas_object_move(o, 0, 0);
+       evas_object_resize(o, 240, 320);
+       evas_object_color_set(o, 150, 200, 250, 255);
+       evas_object_show(o);
+       
+       o = ecore_evas_object_image_new(ee);
+       evas = ecore_evas_get(evas_object_data_get(o, "Ecore_Evas"));
+       evas_object_move(o, 50, 50);
+       evas_object_resize(o, 120, 160);
+       evas_object_image_fill_set(o, 0, 0, 120, 160);
+       evas_object_image_size_set(o, 240, 320);
+       ecore_evas_resize(evas_object_data_get(o, "Ecore_Evas"), 240, 320);
+       evas_object_color_set(o, 255, 255, 255, 200);
+       evas_object_show(o);
+     }
    else if ((argc > 1) && (!strcmp(argv[1], "-h")))
      {
        printf("%s -x         Test ecore_evas in X (default)\n"
               "%s -gl        Test ecore_evas in X GL\n"
               "%s -fb        Test ecore_evas in the Framebuffer\n"
+              "%s -buf       Test ecore_evas in the Buffer\n"
+              "%s -buf2      Test ecore_evas in the Image Buffer\n"
               "%s -h         Display this help\n",
-              argv[0], argv[0], argv[0], argv[0]);
+              argv[0], argv[0], argv[0], argv[0], argv[0], argv[0]);
        ecore_evas_shutdown();
        ecore_shutdown();
        return 0;
      }
    else
 #ifdef BUILD_ECORE_X
-     ee = ecore_evas_software_x11_new(NULL, 0,  0, 0, 240, 320);        
+     {
+       ee = ecore_evas_software_x11_new(NULL, 0,  0, 0, 240, 320);      
 #else
 #ifdef BUILD_ECORE_FB
-     ee = ecore_evas_fb_new(NULL, 270,  240, 320);
-#endif   
+       ee = ecore_evas_fb_new(NULL, 270,  240, 320);
+#endif
 #endif   
+       evas = ecore_evas_get(ee);
+     }
    if (!ee) return -1;
    ecore_evas_callback_delete_request_set(ee, app_delete_request);
    ecore_evas_callback_resize_set(ee, app_resize);
    ecore_evas_title_set(ee, "Ecore Evas Test");
    ecore_evas_name_class_set(ee, "ecore_test", "test_evas");   
    ecore_evas_show(ee);
-   evas = ecore_evas_get(ee);
    evas_image_cache_set(evas, 8192 * 1024);
    evas_font_cache_set(evas, 512 * 1024);
    evas_font_path_append(evas, FN);
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/bin/ecore_evas_test_calibrate.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ecore_evas_test_calibrate.c 13 May 2004 09:39:43 -0000      1.4
+++ ecore_evas_test_calibrate.c 8 Jan 2005 18:40:31 -0000       1.5
@@ -28,14 +28,14 @@
 void
 calibrate_pos_set(int pos)
 {
-   Evas_Coord w, h;
-   int x, y, ow, oh;
+   Evas_Coord w, h, ow, oh;
+   int x, y;
    
    cal_pos = pos;
    evas_object_geometry_get(o_crosshair, NULL, NULL, &w, &h);
    x = cal_coords[(cal_pos * 2) + 0];
    y = cal_coords[(cal_pos * 2) + 1];
-   evas_output_size_get(evas, &ow, &oh);
+   evas_output_viewport_get(evas, NULL, NULL, &ow, &oh);
    if (x < 0) x = ow + x - 1;
    if (y < 0) y = oh + y - 1;
    cal_coords[(cal_pos * 2) + 0] = x;
@@ -165,6 +165,7 @@
    
    ev = event_info;
    
+   evas_object_move(o_crosshair, ev->output.x - 15, ev->output.y - 15);
    tmp_input_count = 0;   
    tmp_input[((tmp_input_count & 0x7) * 2) + 0] = ev->output.x;
    tmp_input[((tmp_input_count & 0x7) * 2) + 1] = ev->output.y;




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to