Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_image.c ewl_image.h 


Log Message:
add in the ability for ewl_images to be tiled instead of the full size of
the widget

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_image.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- ewl_image.c 23 Aug 2004 18:51:52 -0000      1.51
+++ ewl_image.c 20 Nov 2004 16:00:27 -0000      1.52
@@ -66,6 +66,11 @@
        i->sw = 1.0;
        i->sh = 1.0;
 
+       i->tile.x = 0;
+       i->tile.y = 0;
+       i->tile.w = 0;
+       i->tile.h = 0;
+
        ewl_image_file_set(i, path, key);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -246,6 +251,32 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+/**
+ * @param i: the image to tile
+ * @param x: the x position of the top right corner
+ * @param y: the y position of the top right corner
+ * @param w: the width of the tile
+ * @param h: the height of the tile
+ * @return Returns no value
+ * @brief Tile the image with the given start position and given size
+ *
+ * Tiles the image across the available area, starting the image at the
+ * given position and with the given size.
+ */
+void
+ewl_image_tile_set(Ewl_Image *i, int x, int y, int w, int h)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("i", i);
+
+       i->tile.x = x;
+       i->tile.y = y;
+       i->tile.w = w;
+       i->tile.h = h;
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
 void ewl_image_realize_cb(Ewl_Widget * w, void *ev_data, void *user_data)
 {
        Ewl_Image      *i;
@@ -363,11 +394,19 @@
        }
 
        /*
+        * set the tile width and height if not set already
+       */
+       if ((i->tile.w == 0) || (i->tile.h == 0)) {
+               i->tile.w = i->sw * ww;
+               i->tile.h = i->sh * hh;
+       }
+
+       /*
         * Move the image into place based on type.
         */
        if (i->type != EWL_IMAGE_TYPE_EDJE)
-               evas_object_image_fill_set(i->image, 0, 0, i->sw * ww,
-                               i->sh * hh);
+               evas_object_image_fill_set(i->image, i->tile.x, i->tile.y,
+                                       i->tile.w, i->tile.h);
 
        evas_object_move(i->image, CURRENT_X(w), CURRENT_Y(w));
        evas_object_resize(i->image, ww, hh);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_image.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ewl_image.h 23 Aug 2004 00:58:04 -0000      1.23
+++ ewl_image.h 20 Nov 2004 16:00:27 -0000      1.24
@@ -39,6 +39,10 @@
        char            proportional;
        int             ow, oh;
        double          sw, sh;
+
+       struct {
+               int x, y, w, h;
+       } tile;
 };
 
 Ewl_Widget     *ewl_image_new(char *i, char *k);
@@ -48,6 +52,8 @@
 void            ewl_image_proportional_set(Ewl_Image * i, char p);
 void           ewl_image_scale(Ewl_Image *i, double wp, double hp);
 void           ewl_image_scale_to(Ewl_Image *i, int w, int h);
+void           ewl_image_tile_set(Ewl_Image *i, int x, int y, 
+                                               int w, int h);
 
 /*
  * Internally used callbacks, override at your own risk.




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to