btwotch    

, Deutschland · männlich · registriert seit 2008 · gestern zuletzt online


mailto, against spam!

Evas display image

Sonstiges ·

Watch some p0rn:

wget 'http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png'


    1 #include <stdio.h>
    2 #include <stdlib.h>
    3 
    4 #include <Ecore_Evas.h>
    5 #include <Ecore.h>
    6 
    7 
    8 int main(int argc, char **argv)
    9 {
   10   Ecore_Evas *ee;
   11   Evas *evas;
   12   Evas_Object *rect, *image;
   13 
   14   ecore_init();
   15   ecore_evas_init();
   16 
   17   ee = ecore_evas_software_x11_new(0, 0, 0, 0, 400, 300);
   18   ecore_evas_title_set(ee, "Ecore_Evas Template");
   19   ecore_evas_show(ee);
   20   evas = ecore_evas_get(ee);
   21 
   22   rect = evas_object_rectangle_add(evas);
   23   evas_object_color_set(rect, 0, 0, 0, 255);
   24   evas_object_resize(rect, 400, 300);
   25   evas_object_show(rect);
   26 
   27   image = evas_object_image_add(evas);
   28   evas_object_image_file_set(image, "Lenna.png", NULL);
   29   evas_object_image_fill_set(image, 0, 0, 400, 300);
   30   evas_object_resize(image, 400, 300);
   31   evas_object_show(image);
   32 
   33 
   34   ecore_main_loop_begin();
   35 
   36 
   37   return 0;
   38 }

Makefile:

pic: pic.c
        gcc pic.c -g -Wall -I/opt/e17/include/ecore-1 -I/opt/e17/include/evas-1 -I/opt/e17/include/eina-1 -I/opt/e17/include/eina-1/eina -I/opt/e17/include/eet-1 -L/opt/e17/lib -lecore_evas -o pic -g
29. Dezember 2010 00:29

Tags:  ·  ·  ·

Evas focus callback

Sonstiges ·

just compile to find out functionality ;)

pic.c:

    1 #include <stdio.h>
    2 #include <stdlib.h>
    3 
    4 #include <Ecore_Evas.h>
    5 #include <Ecore.h>
    6 
    7 
    8 void focus_in_callback(void *data, Evas *e, void *event_info)
    9 {
   10   Evas_Object *txt = data;
   11   evas_object_text_text_set(txt, "IN");
   12   evas_object_show(txt);
   13 }
   14 
   15 void focus_out_callback(void *data, Evas *e, void *event_info)
   16 {
   17   Evas_Object *txt = data;
   18   evas_object_text_text_set(txt, "OUT");
   19   evas_object_show(txt);
   20 }
   21 
   22 int main(int argc, char **argv)
   23 {
   24   Ecore_Evas *ee;
   25   Evas *evas;
   26   Evas_Object *rect, *txt;
   27 
   28   ecore_init();
   29   ecore_evas_init();
   30 
   31   ee = ecore_evas_software_x11_new(0, 0, 0, 0, 400, 300);
   32   ecore_evas_title_set(ee, "Focus callback");
   33   ecore_evas_show(ee);
   34   evas = ecore_evas_get(ee);
   35 
   36   rect = evas_object_rectangle_add(evas);
   37   evas_object_color_set(rect, 0, 0, 0, 255);
   38   evas_object_resize(rect, 400, 300);
   39   evas_object_show(rect);
   40 
   41 
   42   txt = evas_object_text_add(evas);
   43   evas_object_color_set(txt, 0, 255, 255, 255);
   44   evas_object_move(txt, 200, 150);
   45   evas_object_text_font_set(txt, "Sans", 10);
   46   evas_object_text_text_set(txt, "ndef");
   47   evas_object_show(txt);
   48 
   49 
   50   evas_event_callback_add(evas, EVAS_CALLBACK_CANVAS_FOCUS_IN,
   51                           focus_in_callback, txt);
   52   evas_event_callback_add(evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT,
   53                           focus_out_callback, txt);
   54 
   55   ecore_main_loop_begin();
   56 
   57   return 0;
   58 }

Makefile:

 

pic: pic.c
        gcc pic.c -g -Wall -I/opt/e17/include/ecore-1 -I/opt/e17/include/evas-1 -I/opt/e17/include/eina-1 -I/opt/e17/include/eina-1/eina -I/opt/e17/include/eet-1 -L/opt/e17/lib -lecore_evas -o pic -g
29. Dezember 2010 00:03

Tags:  ·  ·  ·

Evas library

Sonstiges ·

Evas is the enlightenment canvas library - it's pretty on the same level as SDL.

Here some code to show up a polygon and a line; there are no functions for pixels, circles and ellipses :(
The developers thought evas to be a library to load images and not to make all manually ;)

Hint: as evas does not provide ellipse, smooth paths or circle, one can calculate points and convert these to a polygon.

You must have a rectangle as a background unless you wanna let debug a e17-developer 3 hours long :aetsch:
pic.c:

    1 #include <stdio.h>
    2 #include <stdlib.h>
    3 
    4 #include <Ecore_Evas.h>
    5 #include <Ecore.h>
    6 
    7 
    8 int main(int argc, char **argv)
    9 {
   10   Ecore_Evas *ee;
   11   Evas *evas;
   12   Evas_Object *line, *rect, *poly;
   13 
   14   ecore_init();
   15   ecore_evas_init();
   16 
   17   ee = ecore_evas_software_x11_new(0, 0, 0, 0, 400, 300);
   18   ecore_evas_title_set(ee, "Ecore_Evas Template");
   19   ecore_evas_show(ee);
   20   evas = ecore_evas_get(ee);
   21 
   22   rect = evas_object_rectangle_add(evas);
   23   evas_object_color_set(rect, 0, 0, 0, 255);
   24   evas_object_resize(rect, 400, 300);
   25   evas_object_show(rect);
   26 
   27   line = evas_object_line_add(evas);
   28   evas_object_line_xy_set(line, 0, 0, 200, 300);
   29   evas_object_color_set(line, 255, 0, 0, 255);
   30   evas_object_show(line);
   31 
   32 
   33   poly = evas_object_polygon_add(evas);
   34   evas_object_polygon_point_add(poly, 10, 0);
   35   evas_object_polygon_point_add(poly, 10, 50);
   36   evas_object_polygon_point_add(poly, 50, 10);
   37   evas_object_color_set(poly, 0, 255, 0, 255);
   38   evas_object_show(poly);
   39 
   40   ecore_main_loop_begin();
   41 
   42 
   43   return 0;
   44 }

Makefile:

pic: pic.c
        gcc pic.c -g -Wall -I/opt/e17/include/ecore-1 -I/opt/e17/include/evas-1 -I/opt/e17/include/eina-1 -I/opt/e17/include/eina-1/eina -I/opt/e17/include/eet-1 -L/opt/e17/lib -lecore_evas -o pic -g
29. Dezember 2010 00:11

Tags:  ·  ·  ·

26. Dezember 2010

Sonstiges ·

26. Dezember 2010 22:12

Tags:

Advent calendar received - thx @construktiv

Sonstiges ·

Yesterday I received the advent calendar from mister-wong/construktiv

22. Dezember 2010 14:50

Tags:

07. Dezember 2010

Sonstiges · · 2 Kommentare

Snowpenis @university - there he is again

07. Dezember 2010 16:11

Tags:

Blog durchsuchen
(nur öffentliche Einträge)

Willst du auch bloggen?
Kostenlos bloggen bei Spin.de
Diese Seite ist eine auf spin.de gelagerte persönliche Homepage, deren Verantwortlichkeit beim Nutzer liegt.
spin.de ist eine große Online-Community mit Chat, Blogs, Foren, Online-Spielen und vielem mehr.
Deine eigene Homepage mit Blog und Gästebuch

Impressum · Datenschutz · Sitemap