Difference between revisions of "CodingWithEFL"

From ArmadeusWiki
Jump to: navigation, search
(How to use the EFL)
 
(color :D)
 
Line 8: Line 8:
 
we need to init both.
 
we need to init both.
 
So we call <lib>_init() for both.
 
So we call <lib>_init() for both.
 
+
<source lang=c>
  evas_init();
+
evas_init();
  ecore_init();
+
ecore_init();
 
+
</source>
 
You can handle error during init like any other fuctions.
 
You can handle error during init like any other fuctions.
  
Line 18: Line 18:
 
On the APF you need to use the Framebuffer to displays graphics on the lcd
 
On the APF you need to use the Framebuffer to displays graphics on the lcd
 
So you need a new Framebuffer object from Evas_ecore
 
So you need a new Framebuffer object from Evas_ecore
  ee = ecore_evas_fb_new(NULL, ANGLE, WIDTH, HEIGHT);  
+
<source lang=c>
 +
ee = ecore_evas_fb_new(NULL, ANGLE, WIDTH, HEIGHT);
 +
</source>
 
where ANGLE is the rotation in ° of the screen
 
where ANGLE is the rotation in ° of the screen
  
 
If you are on your host Pc, with Xorg, you will need a X11_software to display things.
 
If you are on your host Pc, with Xorg, you will need a X11_software to display things.
 
+
<source lang=c>
  ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT);
+
ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT);
 
+
</source>
 
Then you can show it on the screen  
 
Then you can show it on the screen  
 
+
<source lang=c>
  ecore_evas_show(ee);
+
ecore_evas_show(ee);
 
+
</source>
 
== Get the Evas Object ==
 
== Get the Evas Object ==
 
And now, we get an evas object, we will manipulate it after.
 
And now, we get an evas object, we will manipulate it after.
  evas = ecore_evas_get(ee);
+
<source lang=c>
 
+
evas = ecore_evas_get(ee);
 +
</source>
 
== Displaying things ==
 
== Displaying things ==
  
 
Let's add a rectangle to the evas object.
 
Let's add a rectangle to the evas object.
  base_rect_sec = evas_object_rectangle_add(evas);
+
<source lang=c>
 
+
base_rect_sec = evas_object_rectangle_add(evas);
 +
</source>
 
Then we will set the size of the rectangle
 
Then we will set the size of the rectangle
  evas_object_resize(base_rect_sec, WIDTH-200, HEIGHT);
+
<source lang=c>
 
+
evas_object_resize(base_rect_sec, WIDTH-200, HEIGHT);
 +
</source>
 
And now, we set the color of the rectangle. (R,G,B,Alpha)
 
And now, we set the color of the rectangle. (R,G,B,Alpha)
  evas_object_color_set(base_rect_sec, 0, 0, 255, 25);
+
<source lang=c>
 
+
evas_object_color_set(base_rect_sec, 0, 0, 255, 25);
 +
</source>
 
We show the rectangle
 
We show the rectangle
  evas_object_show(base_rect_sec);
+
<source lang=c>
 
+
evas_object_show(base_rect_sec);
 +
</source>
  
 
== Compiling ==
 
== Compiling ==

Latest revision as of 16:19, 23 February 2008

Installing required libs

- Using the menuconfig of buildroot (no usable for the moment)


Init required libs

We will use evas and ecore, we need to init both. So we call <lib>_init() for both.

evas_init();
ecore_init();

You can handle error during init like any other fuctions.

Set up where you will display things

On the APF you need to use the Framebuffer to displays graphics on the lcd So you need a new Framebuffer object from Evas_ecore

ee = ecore_evas_fb_new(NULL, ANGLE, WIDTH, HEIGHT);

where ANGLE is the rotation in ° of the screen

If you are on your host Pc, with Xorg, you will need a X11_software to display things.

ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT);

Then you can show it on the screen

ecore_evas_show(ee);

Get the Evas Object

And now, we get an evas object, we will manipulate it after.

evas = ecore_evas_get(ee);

Displaying things

Let's add a rectangle to the evas object.

base_rect_sec = evas_object_rectangle_add(evas);

Then we will set the size of the rectangle

evas_object_resize(base_rect_sec, WIDTH-200, HEIGHT);

And now, we set the color of the rectangle. (R,G,B,Alpha)

evas_object_color_set(base_rect_sec, 0, 0, 255, 25);

We show the rectangle

evas_object_show(base_rect_sec);

Compiling

To test on your host computer you will compile it with :

 gcc -o test test.c -levas -lecore -lecore_evas

And then

 ./test

For the APF board

 -mtune=arm920t -msoft-float

Use the gcc version of buildroot, and -L to the /usr/lib in the root dir, and -I to /usr/include too. Sometime you will nee to do that for the staging_dir too.


And you will need to link to the framebuffer engine too

 -lecore_fb

And eet too if this had not be done automaticaly.

 -leet