On Thu, Feb 5, 2009 at 4:15 PM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
>  Interpolate text font size.
>
>  Often requested for animations that want to grow or shrink text
>  quickly. This is a faster alternative to using geometry with rel1/rel2
>  and "text.fit: 1 1;" since it does not need to figure out which size
>  fits better into that object.
>
>  I tested and it does not seem to introduce any regression. Also
>  checked with scale and text_class variations.

find attached 2 files to test it.

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
collections {
   group {
      name: "main";
      parts {

         part {
            name: "t1";
            type: TEXT;
            mouse_events: 0;
            scale: 1;
            description {
               state: "default" 0.0;
               rel1 {
                  relative: 0.0 0.0;
                  offset: 0 0;
               }
               rel2 {
                  relative: 1.0 0.5;
                  offset: -1 -1;
               }
               text {
                  text_class: "t1_class1";
                  font: "Sans Serif";
                  size: 10;
                  text: "contents";
               }
            }
            description {
               state: "big" 0.0;
               inherit: "default" 0.0;
               text {
                  text_class: "t1_class2";
                  font: "Sans Serif";
                  size: 36;
                  text: "contents";
               }
            }
         }

         programs {
            program {
               name: "anim1_t1";
               signal: "load";
               action: STATE_SET "big" 0.0;
               target: "t1";
               transition: LINEAR 0.5;
               after: "anim2_t1";
            }
            program {
               name: "anim2_t1";
               action: STATE_SET "default" 0.0;
               target: "t1";
               transition: LINEAR 0.5;
               after: "anim1_t1";
            }
         }

#if 0
         part {
            name: "t2";
            type: TEXT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1 {
                  relative: 0.0 0.7;
                  offset: 0 0;
               }
               rel2 {
                  relative: 1.0 0.9;
                  offset: -1 -1;
               }
               text {
                  text_class: "t2_class";
                  font: "Sans Serif";
                  size: 10;
                  text: "contents";
                  fit: 0 1;
               }
            }
            description {
               state: "big" 0.0;
               inherit: "default" 0.0;
               rel1 {
                  relative: 0.0 0.5;
                  offset: 0 0;
               }
               rel2 {
                  relative: 1.0 1.0;
                  offset: -1 -1;
               }
            }
         }

         programs {
            program {
               name: "anim1_t2";
               signal: "load";
               action: STATE_SET "big" 0.0;
               target: "t2";
               transition: LINEAR 5.0;
               after: "anim2_t2";
            }
            program {
               name: "anim2_t2";
               action: STATE_SET "default" 0.0;
               target: "t2";
               transition: LINEAR 5.0;
               after: "anim1_t2";
            }
         }
#endif
      }
   }
}
#include <Edje.h>
#include <Ecore_Evas.h>
#include <Evas.h>
#include <Ecore.h>
#include <stdio.h>
#include <stdlib.h>

static void on_del(void *data, Evas *e, Evas_Object *o, void *ei)
{
    ecore_main_loop_quit();
}

int main(int argc, char *argv[])
{
    Ecore_Evas *ee;
    Evas *e;
    Evas_Object *stack, *bg, *ed;
    const char *file, *group;

    if (argc < 3) {
        fputs("ERROR: missing file and/or group names.\n", stderr);
        return -1;
    }

    file = argv[1];
    group = argv[2];

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

    ee = ecore_evas_new(NULL, 0, 0, 320, 240, NULL);
    e = ecore_evas_get(ee);

    stack = evas_object_box_add(e);
    evas_object_box_layout_set(stack, evas_object_box_layout_stack, NULL, NULL);
    evas_object_resize(stack, 320, 240);
    evas_object_event_callback_add(stack, EVAS_CALLBACK_DEL, on_del, NULL);
    ecore_evas_object_associate(ee, stack, ECORE_EVAS_OBJECT_ASSOCIATE_DEL);
    evas_object_show(stack);

    bg = evas_object_rectangle_add(e);
    evas_object_color_set(bg, 0, 0, 0, 255);
    evas_object_size_hint_align_set(bg, -1.0, -1.0);
    evas_object_show(bg);
    evas_object_box_append(stack, bg);

    ed = edje_object_add(e);
    if (!edje_object_file_set(ed, file, group)) {
        int err = edje_object_load_error_get(ed);
        const char *errmsg = edje_load_error_str(err);
        fprintf(stderr, "ERROR: could not load edje file=%s, group=%s: %s\n",
                file, group, errmsg);
        return -1;
    }
    evas_object_size_hint_align_set(ed, -1.0, -1.0);
    evas_object_show(ed);
    evas_object_box_append(stack, ed);

    edje_text_class_set("t1_class1", "Serif", 68);
    edje_object_text_class_set(ed, "t1_class2", "Serif", 36);
    //edje_object_scale_set(ed, 2.0);

    ecore_main_loop_begin();

    ecore_shutdown();
    evas_shutdown();
    ecore_evas_shutdown();
    edje_shutdown();

    return 0;
}
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to