Enlightenment CVS committal

Author  : xcomputerman
Project : e17
Module  : libs/esmart

Dir     : e17/libs/esmart/src/lib/esmart_trans_x11


Modified Files:
        Esmart_Trans_X11.h esmart_trans_x11.c 


Log Message:
Add more pseudo-transparency evilness (really only did this for demo
purposes) -- option for trans_x11 to do a screengrab instead of fetch
root pixmap. See http://xcomputerman.com/files/emotion_trans.png for
a sample of this.

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_trans_x11/Esmart_Trans_X11.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- Esmart_Trans_X11.h  5 May 2004 05:57:01 -0000       1.1.1.1
+++ Esmart_Trans_X11.h  17 Jul 2004 21:10:09 -0000      1.2
@@ -9,6 +9,11 @@
 
 typedef struct _Esmart_Trans_X11 Esmart_Trans_X11;
 
+typedef enum _Esmart_Trans_X11_Type {
+   Esmart_Trans_X11_Type_Background,
+   Esmart_Trans_X11_Type_Screengrab
+} Esmart_Trans_X11_Type;
+
 struct _Esmart_Trans_X11
 {
     Evas_Object *obj, *clip;
@@ -16,6 +21,8 @@
 };
 
 Evas_Object * esmart_trans_x11_new(Evas *e);
+void esmart_trans_x11_type_set(Evas_Object *o, Esmart_Trans_X11_Type type);
+Esmart_Trans_X11_Type esmart_trans_x11_type_get(Evas_Object *o);
 void esmart_trans_x11_window_set(Evas_Object *o, Ecore_X_Window win);
 void esmart_trans_x11_freshen(Evas_Object *o, int x, int y, int w,
 int h);
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_trans_x11/esmart_trans_x11.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- esmart_trans_x11.c  28 Jun 2004 13:18:32 -0000      1.2
+++ esmart_trans_x11.c  17 Jul 2004 21:10:09 -0000      1.3
@@ -17,6 +17,7 @@
 typedef struct {
    int x, y, w, h;
    Evas_Object *obj;
+   Esmart_Trans_X11_Type type;
    Ecore_X_Window win;
    Ecore_X_Pixmap pmap_id;
    Ecore_Timer *timer;
@@ -77,6 +78,40 @@
 }
 
 static Evas_Object *
+_esmart_trans_x11_screengrab_get(Evas *evas, Evas_Object *old, int x, int y, int w, 
int h)
+{
+   Evas_Object          *new = NULL;
+   Imlib_Image          im;
+
+   if (old)
+      evas_object_del(old);
+
+   imlib_context_set_display(ecore_x_display_get());
+   imlib_context_set_visual(DefaultVisual(ecore_x_display_get(), 
DefaultScreen(ecore_x_display_get())));
+   imlib_context_set_colormap(DefaultColormap(ecore_x_display_get(), 
DefaultScreen(ecore_x_display_get())));
+   imlib_context_set_drawable(DefaultRootWindow(ecore_x_display_get()));
+   im = imlib_create_image_from_drawable(0, x, y, w, h, 1);
+   imlib_context_set_image(im);
+   imlib_image_set_format("argb");
+   new = evas_object_image_add(evas);
+   evas_object_image_alpha_set(new, 0);
+   evas_object_image_size_set(new, w, h);
+   evas_object_image_data_copy_set(new, imlib_image_get_data_for_reading_only());
+   imlib_image_set_format("png");
+   imlib_save_image("/home/ibukun/test.png");
+   imlib_free_image_and_decache();
+
+   evas_object_image_fill_set(new, 0, 0, w, h);
+   evas_object_resize(new, w, h);
+   evas_object_move(new, 0, 0);
+   evas_object_layer_set(new, -9999);
+   evas_object_image_data_update_add(new, 0, 0, w, h);
+   evas_object_show(new);
+
+   return new;
+}
+
+static Evas_Object *
 _esmart_trans_x11_pixmap_get(Evas *evas, Evas_Object *old, int x, int y, int w, int h)
 {
    int                  num_desks = 0, ret, current_desk;
@@ -267,9 +302,13 @@
         /* Update the trans object */
         if((data = evas_object_smart_data_get(o)))
         {
-           data->obj =
-           _esmart_trans_x11_pixmap_get(evas_object_evas_get(data->clip),
-                                        data->obj, x, y, w, h);
+           if (eto->type == Esmart_Trans_X11_Type_Background)
+              data->obj =
+                 _esmart_trans_x11_pixmap_get(evas_object_evas_get(data->clip),
+                                              data->obj, x, y, w, h);
+           else
+              data->obj = 
_esmart_trans_x11_screengrab_get(evas_object_evas_get(data->clip),
+                                                           data->obj, x, y, w, h);
            evas_object_pass_events_set(data->obj, 1);
            evas_object_clip_set(data->obj, data->clip);
            evas_object_move(data->clip, data->x, data->y);
@@ -324,12 +363,33 @@
   /* Add to object list */
   eto = calloc(1, sizeof(Esmart_Trans_Object));
   eto->obj = x11_trans_object;
+  eto->type = Esmart_Trans_X11_Type_Background;
   ecore_list_append(_objects, eto);
 
   return x11_trans_object;
 }
 
 void
+esmart_trans_x11_type_set(Evas_Object *o, Esmart_Trans_X11_Type type)
+{
+   Esmart_Trans_Object *eto;
+
+   if ((eto = _esmart_trans_x11_object_find(o)))
+      eto->type = type;
+}
+
+Esmart_Trans_X11_Type
+esmart_trans_x11_type_get(Evas_Object *o)
+{
+   Esmart_Trans_Object *eto;
+
+   if ((eto = _esmart_trans_x11_object_find(o)))
+      return eto->type;
+   else
+      return Esmart_Trans_X11_Type_Background;
+}
+
+void
 esmart_trans_x11_window_set(Evas_Object *o, Ecore_X_Window win)
 {
    Esmart_Trans_Object *eto;




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to