in theory - (not tested yet) allow hitns to set middle to solid of
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 12 Feb 2009 13:38:33 +0000 (13:38 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 12 Feb 2009 13:38:33 +0000 (13:38 +0000)
borderscaling.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@39000 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Evas.h
src/lib/canvas/evas_object_image.c

index a4f39fe..741d5e7 100644 (file)
@@ -245,6 +245,12 @@ typedef enum _Evas_Render_Op
    EVAS_RENDER_MUL = 11 /**< d = d*s */
 } Evas_Render_Op; /**<  */
 
+typedef enum _Evas_Border_Fill_Mode
+{
+   EVAS_BORDER_FILL_NONE = 0,
+   EVAS_BORDER_FILL_DEFAULT = 1,
+   EVAS_BORDER_FILL_SOLID = 2
+} Evas_Border_Fill_Mode;
 
 struct _Evas_Engine_Info /** Generic engine information. Generic info is useless */
 {
@@ -509,8 +515,8 @@ extern "C" {
    EAPI void              evas_object_image_file_get        (const Evas_Object *obj, const char **file, const char **key);
    EAPI void              evas_object_image_border_set      (Evas_Object *obj, int l, int r, int t, int b);
    EAPI void              evas_object_image_border_get      (const Evas_Object *obj, int *l, int *r, int *t, int *b);
-   EAPI void              evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Bool fill);
-   EAPI Evas_Bool         evas_object_image_border_center_fill_get(const Evas_Object *obj);
+   EAPI void              evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Border_Fill_Mode fill);
+   EAPI Evas_Border_Fill_Mode evas_object_image_border_center_fill_get(const Evas_Object *obj);
    EAPI void              evas_object_image_filled_set      (Evas_Object *obj, Evas_Bool setting);
    EAPI Evas_Bool         evas_object_image_filled_get      (const Evas_Object *obj);
    EAPI void              evas_object_image_fill_set        (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
index 922f537..19c6216 100644 (file)
@@ -441,14 +441,14 @@ evas_object_image_border_get(const Evas_Object *obj, int *l, int *r, int *t, int
  *
  * When rendering, the image may be scaled to fit the size of the
  * image object. This function sets if the center part of the scaled image
- * is to be drawn or left completely blank. Very useful for frames and
- * decorations.
+ * is to be drawn or left completely blank, or forced to be solid. Very useful
+ * for frames and decorations.
  *
  * @param obj The given image object.
- * @param fill Whether the center should be drawn.
+ * @param fill Fill mode of the middle.
  */
 EAPI void
-evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Bool fill)
+evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Border_Fill_Mode fill)
 {
    Evas_Object_Image *o;
 
@@ -459,9 +459,7 @@ evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Bool fill)
    MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
    return;
    MAGIC_CHECK_END();
-   if (((o->cur.border.fill) && (fill)) ||
-       ((!o->cur.border.fill) && (!fill)))
-     return;
+   if (fill == o->cur.border.fill) return;
    o->cur.border.fill = fill;
    o->changed = 1;
    evas_object_change(obj);
@@ -541,9 +539,9 @@ evas_object_image_filled_set(Evas_Object *obj, Evas_Bool setting)
  * See @ref evas_object_image_fill_set for more details.
  *
  * @param obj The given image object.
- * @return If the center is to be drawn or not.
+ * @return Fill mode of the  center.
  */
-EAPI Evas_Bool
+EAPI Evas_Border_Fill_Mode
 evas_object_image_border_center_fill_get(const Evas_Object *obj)
 {
    Evas_Object_Image *o;
@@ -2247,13 +2245,19 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su
                       outx = ox; outy = oy + bt;
                       outw = bl; outh = ih - bt - bb;
                       obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale);
-                      if (o->cur.border.fill)
+                      if (o->cur.border.fill > EVAS_BORDER_FILL_NONE)
                         {
                            inx = bl; iny = bt;
                            inw = imw - bl - br; inh = imh - bt - bb;
                            outx = ox + bl; outy = oy + bt;
                            outw = iw - bl - br; outh = ih - bt - bb;
+                            if (o->cur.border.fill == EVAS_BORDER_FILL_SOLID)
+                              obj->layer->evas->engine.func->context_render_op_set(output, context,
+                                                                                   EVAS_RENDER_COPY);
                            obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale);
+                            if (o->cur.border.fill == EVAS_BORDER_FILL_SOLID)
+                              obj->layer->evas->engine.func->context_render_op_set(output, context,
+                                                                                   obj->cur.render_op);
                         }
                       inx = imw - br; iny = bt;
                       inw = br; inh = imh - bt - bb;