/usr/share/doc/libevas-doc/html/index.html is in libevas-doc 1.7.9-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | <html>
<head>
<title>Evas</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta name="author" content="Andres Blanc" >
<link rel="icon" href="img/favicon.png" type="image/x-icon">
<link rel="shortcut icon" href="img/favicon.png" type="image/x-icon">
<link rel="icon" href="img/favicon.png" type="image/ico">
<link rel="shortcut icon" href="img/favicon.png" type="image/ico">
<link rel="stylesheet" type="text/css" href="e.css">
<link rel="stylesheet" type="text/css" href="edoxy.css">
</head>
<body>
<div id="container">
<div id="header">
<div class="layout">
<h1><span>Enlightenment</span></h1>
<h2><span>Beauty at your fingertips</span></h2>
<table cellspacing="0" cellpadding="0" width="100%"><tr>
<td id="header_logo">
<a href="http://www.enlightenment.org"></a>
</td>
<td id="header_menu">
<table cellspacing="0" cellpadding="0" align="right"><tr>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=home">Home</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=news">News</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=about">About</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=download">Download</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=support">Support</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=contribute">Contribute</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=contact">Contact</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://trac.enlightenment.org/e">Tracker</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=docs">Docs</a></td>
</tr></table>
</td>
<td id="header_last"></td>
</tr></table>
<div class="doxytitle">
Evas Documentation <small>at Thu Feb 13 2014</small>
</div>
<div class="menu-container">
<div class="submenu">
<ul class="current">
<li><a href="todo.html">Todo</a></li>
<li><a href="files.html">Files</a></li>
<li><a href="annotated.html">Data Structures</a></li>
<li><a href="globals.html">Globals</a></li>
<li><a href="modules.html">Modules</a></li>
<li><a href="pages.html">Related Pages</a></li>
<li class="current"><a href="index.html">Main Page</a></li>
</ul>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div id="content">
<div class="layout">
<!-- Generated by Doxygen 1.8.6 -->
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Evas </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="section version"><dt>Version</dt><dd>1.7.5 </dd></dl>
<dl class="section date"><dt>Date</dt><dd>2000-2013</dd></dl>
<p>Please see the <a class="el" href="authors.html">Authors</a> page for contact details. <a class="el" href="Evas_8h.html">Evas API </a></p>
<p><a class="el" href="Evas_8h.html">Evas API </a></p>
<h1><a class="anchor" id="toc"></a>
Table of Contents</h1>
<ul>
<li><a class="el" href="index.html#intro">What is Evas?</a> </li>
<li><a class="el" href="index.html#work">How does Evas work?</a> </li>
<li><a class="el" href="index.html#compiling">How to compile using Evas ?</a> </li>
<li><a class="el" href="index.html#install">How is it installed?</a> </li>
<li><a class="el" href="index.html#next_steps">Next Steps</a> </li>
<li><a class="el" href="index.html#intro_example">Introductory Example</a></li>
</ul>
<h1><a class="anchor" id="intro"></a>
What is Evas?</h1>
<p>Evas is a clean display canvas API for several target display systems that can draw anti-aliased text, smooth super and sub-sampled scaled images, alpha-blend objects and much more.</p>
<p>It abstracts any need to know much about what the characteristics of your display system are or what graphics calls are used to draw them and how. It deals on an object level where all you do is create and manipulate objects in a canvas, set their properties, and the rest is done for you.</p>
<p>Evas optimises the rendering pipeline to minimise effort in redrawing changes made to the canvas and so takes this work out of the programmers hand, saving a lot of time and energy.</p>
<p>It's small and lean, designed to work on embedded systems all the way to large and powerful multi-cpu workstations. It can be compiled to only have the features you need for your target platform if you so wish, thus keeping it small and lean. It has several display back-ends, letting it display on several display systems, making it portable for cross-device and cross-platform development.</p>
<h2><a class="anchor" id="intro_not_evas"></a>
What Evas is not?</h2>
<p>Evas is not a widget set or widget toolkit, however it is their base. See Elementary (<a href="http://docs.enlightenment.org/auto/elementary/">http://docs.enlightenment.org/auto/elementary/</a>) for a toolkit based on Evas, Edje, Ecore and other Enlightenment technologies.</p>
<p>It is not dependent or aware of main loops, input or output systems. Input should be polled from various sources and fed to Evas. Similarly, it will not create windows or report windows updates to your system, rather just drawing the pixels and reporting to the user the areas that were changed. Of course these operations are quite common and thus they are ready to use in Ecore, particularly in Ecore_Evas (<a href="http://docs.enlightenment.org/auto/ecore/">http://docs.enlightenment.org/auto/ecore/</a>).</p>
<h1><a class="anchor" id="work"></a>
How does Evas work?</h1>
<p>Evas is a canvas display library. This is markedly different from most display and windowing systems as a canvas is structural and is also a state engine, whereas most display and windowing systems are immediate mode display targets. Evas handles the logic between a structural display via its state engine, and controls the target windowing system in order to produce rendered results of the current canvas' state on the display.</p>
<p>Immediate mode display systems retain very little, or no state. A program will execute a series of commands, as in the pseudo code:</p>
<pre class="fragment">draw line from position (0, 0) to position (100, 200);
draw rectangle from position (10, 30) to position (50, 500);
bitmap_handle = create_bitmap();
scale bitmap_handle to size 100 x 100;
draw image bitmap_handle at position (10, 30);
</pre><p>The series of commands is executed by the windowing system and the results are displayed on the screen (normally). Once the commands are executed the display system has little or no idea of how to reproduce this image again, and so has to be instructed by the application how to redraw sections of the screen whenever needed. Each successive command will be executed as instructed by the application and either emulated by software or sent to the graphics hardware on the device to be performed.</p>
<p>The advantage of such a system is that it is simple, and gives a program tight control over how something looks and is drawn. Given the increasing complexity of displays and demands by users to have better looking interfaces, more and more work is needing to be done at this level by the internals of widget sets, custom display widgets and other programs. This means more and more logic and display rendering code needs to be written time and time again, each time the application needs to figure out how to minimise redraws so that display is fast and interactive, and keep track of redraw logic. The power comes at a high-price, lots of extra code and work. Programmers not very familiar with graphics programming will often make mistakes at this level and produce code that is sub optimal. Those familiar with this kind of programming will simply get bored by writing the same code again and again.</p>
<p>For example, if in the above scene, the windowing system requires the application to redraw the area from 0, 0 to 50, 50 (also referred as "expose event"), then the programmer must calculate manually the updates and repaint it again:</p>
<pre class="fragment">Redraw from position (0, 0) to position (50, 50):
// what was in area (0, 0, 50, 50)?
// 1. intersection part of line (0, 0) to (100, 200)?
draw line from position (0, 0) to position (25, 50);
// 2. intersection part of rectangle (10, 30) to (50, 500)?
draw rectangle from position (10, 30) to position (50, 50)
// 3. intersection part of image at (10, 30), size 100 x 100?
bitmap_subimage = subregion from position (0, 0) to position (40, 20)
draw image bitmap_subimage at position (10, 30);
</pre><p>The clever reader might have noticed that, if all elements in the above scene are opaque, then the system is doing useless paints: part of the line is behind the rectangle, and part of the rectangle is behind the image. These useless paints tend to be very costly, as pixels tend to be 4 bytes in size, thus an overlapping region of 100 x 100 pixels is around 40000 useless writes! The developer could write code to calculate the overlapping areas and avoid painting then, but then it should be mixed with the "expose event" handling mentioned above and quickly one realizes the initially simpler method became really complex.</p>
<p>Evas is a structural system in which the programmer creates and manages display objects and their properties, and as a result of this higher level state management, the canvas is able to redraw the set of objects when needed to represent the current state of the canvas.</p>
<p>For example, the pseudo code:</p>
<pre class="fragment">line_handle = create_line();
set line_handle from position (0, 0) to position (100, 200);
show line_handle;
rectangle_handle = create_rectangle();
move rectangle_handle to position (10, 30);
resize rectangle_handle to size 40 x 470;
show rectangle_handle;
bitmap_handle = create_bitmap();
scale bitmap_handle to size 100 x 100;
move bitmap_handle to position (10, 30);
show bitmap_handle;
render scene;
</pre><p>This may look longer, but when the display needs to be refreshed or updated, the programmer only moves, resizes, shows, hides etc. the objects that need to change. The programmer simply thinks at the object logic level, and the canvas software does the rest of the work for them, figuring out what actually changed in the canvas since it was last drawn, how to most efficiently redraw the canvas and its contents to reflect the current state, and then it can go off and do the actual drawing of the canvas.</p>
<p>This lets the programmer think in a more natural way when dealing with a display, and saves time and effort of working out how to load and display images, render given the current display system etc. Since Evas also is portable across different display systems, this also gives the programmer the ability to have their code ported and displayed on different display systems with very little work.</p>
<p>Evas can be seen as a display system that stands somewhere between a widget set and an immediate mode display system. It retains basic display logic, but does very little high-level logic such as scrollbars, sliders, push buttons etc.</p>
<h1><a class="anchor" id="compiling"></a>
How to compile using Evas ?</h1>
<p>Evas is a library your application links to. The procedure for this is very simple. You simply have to compile your application with the appropriate compiler flags that the <code>pkg-config</code> script outputs. For example:</p>
<p>Compiling C or C++ files into object files:</p>
<pre class="fragment">gcc -c -o main.o main.c `pkg-config --cflags evas`
</pre><p>Linking object files into a binary executable:</p>
<pre class="fragment">gcc -o my_application main.o `pkg-config --libs evas`
</pre><p>You simply have to make sure that <code>pkg-config</code> is in your shell's <code>PATH</code> (see the manual page for your appropriate shell) and <code>evas.pc</code> in <code>/usr/lib/pkgconfig</code> or its path in the <code>PKG_CONFIG_PATH</code> environment variable. It's that simple to link and use Evas once you have written your code to use it.</p>
<p>Since the program is linked to Evas, it is now able to use any advertised API calls to display graphics in a canvas managed by it, as well as use the API calls provided to manage data.</p>
<p>You should make sure you add any extra compile and link flags to your compile commands that your application may need as well. The above example is only guaranteed to make Evas add it's own requirements.</p>
<h1><a class="anchor" id="install"></a>
How is it installed?</h1>
<p>Simple:</p>
<pre class="fragment">./configure
make
su -
...
make install
</pre><h1><a class="anchor" id="next_steps"></a>
Next Steps</h1>
<p>After you understood what Evas is and installed it in your system you should proceed understanding the programming interface for all objects, then see the specific for the most used elements. We'd recommend you to take a while to learn Ecore (<a href="http://docs.enlightenment.org/auto/ecore/">http://docs.enlightenment.org/auto/ecore/</a>) and Edje (<a href="http://docs.enlightenment.org/auto/edje/">http://docs.enlightenment.org/auto/edje/</a>) as they will likely save you tons of work compared to using just Evas directly.</p>
<p>Recommended reading:</p>
<ul>
<li><a class="el" href="group__Evas__Object__Group.html">Generic Object Functions</a>, where you'll get how to basically manipulate generic objects lying on an Evas canvas, handle canvas and object events, etc. </li>
<li><a class="el" href="group__Evas__Object__Rectangle.html">Rectangle Object Functions</a>, to learn about the most basic object type on Evas – the rectangle. </li>
<li><a class="el" href="group__Evas__Object__Polygon.html">Polygon Object Functions</a>, to learn how to create polygon elements on the canvas. </li>
<li><a class="el" href="group__Evas__Line__Group.html">Line Object Functions</a>, to learn how to create line elements on the canvas. </li>
<li><a class="el" href="group__Evas__Object__Image.html">Image Object Functions</a>, to learn about image objects, over which Evas can do a plethora of operations. </li>
<li><a class="el" href="group__Evas__Object__Text.html">Text Object Functions</a>, to learn how to create textual elements on the canvas. </li>
<li><a class="el" href="group__Evas__Object__Textblock.html">Textblock Object Functions</a>, to learn how to create multiline textual elements on the canvas. </li>
<li><a class="el" href="group__Evas__Smart__Object__Group.html">Smart Object Functions</a> and <a class="el" href="group__Evas__Smart__Group.html">Smart Functions</a>, to define new objects that provide <b>custom</b> functions to handle clipping, hiding, moving, resizing, color setting and more. These could be as simple as a group of objects that move together (see <a class="el" href="group__Evas__Smart__Object__Clipped.html">Clipped Smart Object</a>) up to implementations of what ends to be a widget, providing some intelligence (thus the name) to Evas objects – like a button or check box, for example.</li>
</ul>
<h1><a class="anchor" id="intro_example"></a>
Introductory Example</h1>
<div class="fragment"><div class="line"><span class="comment">/**</span></div>
<div class="line"><span class="comment"> * Simple Evas example using the Buffer engine.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * You must have Evas compiled with the buffer engine, and have the</span></div>
<div class="line"><span class="comment"> * evas-software-buffer pkg-config files installed.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Compile with:</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * @verbatim</span></div>
<div class="line"><span class="comment"> * gcc -o evas-buffer-simple evas-buffer-simple.c `pkg-config --libs --cflags evas evas-software-buffer`</span></div>
<div class="line"><span class="comment"> * @endverbatim</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"><span class="preprocessor">#include <<a class="code" href="Evas_8h.html">Evas.h</a>></span></div>
<div class="line"><span class="preprocessor">#include <Evas_Engine_Buffer.h></span></div>
<div class="line"><span class="preprocessor">#include <stdio.h></span></div>
<div class="line"><span class="preprocessor">#include <errno.h></span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#define WIDTH (320)</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define HEIGHT (240)</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line"><span class="comment">/*</span></div>
<div class="line"><span class="comment"> * create_canvas(), destroy_canvas() and draw_scene() are support functions.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * They are only required to use raw Evas, but for real world usage,</span></div>
<div class="line"><span class="comment"> * it is recommended to use ecore and its ecore-evas submodule, that</span></div>
<div class="line"><span class="comment"> * provide convenience canvas creators, integration with main loop and</span></div>
<div class="line"><span class="comment"> * automatic render of updates (draw_scene()) when system goes back to</span></div>
<div class="line"><span class="comment"> * main loop.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"><span class="keyword">static</span> <a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *create_canvas(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height);</div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> destroy_canvas(<a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *canvas);</div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> draw_scene(<a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *canvas);</div>
<div class="line"></div>
<div class="line"><span class="comment">// support function to save scene as PPM image</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> save_scene(<a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *canvas, <span class="keyword">const</span> <span class="keywordtype">char</span> *dest);</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">void</span>)</div>
<div class="line">{</div>
<div class="line"> <a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *canvas;</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group.html#ga9e19e6dd1f517a0ba437c0114d3e7c97">Evas_Object</a> *bg, *r1, *r2, *r3;</div>
<div class="line"></div>
<div class="line"> <a class="code" href="group__Evas__Group.html#ga939a904ec53bf80796a8ad763cbb4c3c">evas_init</a>();</div>
<div class="line"></div>
<div class="line"> <span class="comment">// create your canvas</span></div>
<div class="line"> <span class="comment">// NOTE: consider using ecore_evas_buffer_new() instead!</span></div>
<div class="line"> canvas = create_canvas(WIDTH, HEIGHT);</div>
<div class="line"> <span class="keywordflow">if</span> (!canvas)</div>
<div class="line"> <span class="keywordflow">return</span> -1;</div>
<div class="line"></div>
<div class="line"> bg = <a class="code" href="group__Evas__Object__Rectangle.html#gaa08a28171d59c43d106e1ea4f986fefa">evas_object_rectangle_add</a>(canvas);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga6b2dfe01eb955cebf734f4e10ac9ce7f">evas_object_color_set</a>(bg, 255, 255, 255, 255); <span class="comment">// white bg</span></div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga78fa8858c51707f1a557b720014b71cc">evas_object_move</a>(bg, 0, 0); <span class="comment">// at origin</span></div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga34df8b33704deafd2a25f40e3c09d149">evas_object_resize</a>(bg, WIDTH, HEIGHT); <span class="comment">// covers full canvas</span></div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga769ad9a3e3daecb7a828196a2c86332f">evas_object_show</a>(bg);</div>
<div class="line"></div>
<div class="line"> puts(<span class="stringliteral">"initial scene, with just background:"</span>);</div>
<div class="line"> draw_scene(canvas);</div>
<div class="line"></div>
<div class="line"> r1 = <a class="code" href="group__Evas__Object__Rectangle.html#gaa08a28171d59c43d106e1ea4f986fefa">evas_object_rectangle_add</a>(canvas);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga6b2dfe01eb955cebf734f4e10ac9ce7f">evas_object_color_set</a>(r1, 255, 0, 0, 255); <span class="comment">// 100% opaque red</span></div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga78fa8858c51707f1a557b720014b71cc">evas_object_move</a>(r1, 10, 10);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga34df8b33704deafd2a25f40e3c09d149">evas_object_resize</a>(r1, 100, 100);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga769ad9a3e3daecb7a828196a2c86332f">evas_object_show</a>(r1);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// pay attention to transparency! Evas color values are pre-multiplied by</span></div>
<div class="line"> <span class="comment">// alpha, so 50% opaque green is:</span></div>
<div class="line"> <span class="comment">// non-premul: r=0, g=255, b=0 a=128 (50% alpha)</span></div>
<div class="line"> <span class="comment">// premul:</span></div>
<div class="line"> <span class="comment">// r_premul = r * a / 255 = 0 * 128 / 255 = 0</span></div>
<div class="line"> <span class="comment">// g_premul = g * a / 255 = 255 * 128 / 255 = 128</span></div>
<div class="line"> <span class="comment">// b_premul = b * a / 255 = 0 * 128 / 255 = 0</span></div>
<div class="line"> <span class="comment">//</span></div>
<div class="line"> <span class="comment">// this 50% green is over a red background, so it will show in the</span></div>
<div class="line"> <span class="comment">// final output as yellow (green + red = yellow)</span></div>
<div class="line"> r2 = <a class="code" href="group__Evas__Object__Rectangle.html#gaa08a28171d59c43d106e1ea4f986fefa">evas_object_rectangle_add</a>(canvas);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga6b2dfe01eb955cebf734f4e10ac9ce7f">evas_object_color_set</a>(r2, 0, 128, 0, 128); <span class="comment">// 50% opaque green</span></div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga78fa8858c51707f1a557b720014b71cc">evas_object_move</a>(r2, 10, 10);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga34df8b33704deafd2a25f40e3c09d149">evas_object_resize</a>(r2, 50, 50);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga769ad9a3e3daecb7a828196a2c86332f">evas_object_show</a>(r2);</div>
<div class="line"></div>
<div class="line"> r3 = <a class="code" href="group__Evas__Object__Rectangle.html#gaa08a28171d59c43d106e1ea4f986fefa">evas_object_rectangle_add</a>(canvas);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga6b2dfe01eb955cebf734f4e10ac9ce7f">evas_object_color_set</a>(r3, 0, 128, 0, 255); <span class="comment">// 100% opaque dark green</span></div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga78fa8858c51707f1a557b720014b71cc">evas_object_move</a>(r3, 60, 60);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga34df8b33704deafd2a25f40e3c09d149">evas_object_resize</a>(r3, 50, 50);</div>
<div class="line"> <a class="code" href="group__Evas__Object__Group__Basic.html#ga769ad9a3e3daecb7a828196a2c86332f">evas_object_show</a>(r3);</div>
<div class="line"></div>
<div class="line"> puts(<span class="stringliteral">"final scene (note updates):"</span>);</div>
<div class="line"> draw_scene(canvas);</div>
<div class="line"> save_scene(canvas, <span class="stringliteral">"/tmp/evas-buffer-simple-render.ppm"</span>);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// NOTE: use ecore_evas_buffer_new() and here ecore_evas_free()</span></div>
<div class="line"> destroy_canvas(canvas);</div>
<div class="line"></div>
<div class="line"> <a class="code" href="group__Evas__Group.html#ga3170193ec2e0ce4d7f0eb55de71060ed">evas_shutdown</a>();</div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keyword">static</span> <a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *create_canvas(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height)</div>
<div class="line">{</div>
<div class="line"> <a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *canvas;</div>
<div class="line"> Evas_Engine_Info_Buffer *einfo;</div>
<div class="line"> <span class="keywordtype">int</span> method;</div>
<div class="line"> <span class="keywordtype">void</span> *pixels;</div>
<div class="line"></div>
<div class="line"> method = <a class="code" href="group__Evas__Output__Method.html#gad8a701a8d4a2acbb2ce4b741ae55ce6b">evas_render_method_lookup</a>(<span class="stringliteral">"buffer"</span>);</div>
<div class="line"> <span class="keywordflow">if</span> (method <= 0)</div>
<div class="line"> {</div>
<div class="line"> fputs(<span class="stringliteral">"ERROR: evas was not compiled with 'buffer' engine!\n"</span>, stderr);</div>
<div class="line"> <span class="keywordflow">return</span> NULL;</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> canvas = <a class="code" href="group__Evas__Canvas.html#ga9280ee6564c889348b142b8bcd723f87">evas_new</a>();</div>
<div class="line"> <span class="keywordflow">if</span> (!canvas)</div>
<div class="line"> {</div>
<div class="line"> fputs(<span class="stringliteral">"ERROR: could not instantiate new evas canvas.\n"</span>, stderr);</div>
<div class="line"> <span class="keywordflow">return</span> NULL;</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <a class="code" href="group__Evas__Output__Method.html#gab6cca6c7a5edabef057790889d560b11">evas_output_method_set</a>(canvas, method);</div>
<div class="line"> <a class="code" href="group__Evas__Output__Size.html#gaaf571f18f97f4067f554ab7713f01063">evas_output_size_set</a>(canvas, width, height);</div>
<div class="line"> <a class="code" href="group__Evas__Output__Size.html#ga1d39edcaff429d884d4a70aa1fca0c08">evas_output_viewport_set</a>(canvas, 0, 0, width, height);</div>
<div class="line"></div>
<div class="line"> einfo = (Evas_Engine_Info_Buffer *)<a class="code" href="group__Evas__Output__Method.html#ga882d5f9411b5556719bdf28a134ee713">evas_engine_info_get</a>(canvas);</div>
<div class="line"> <span class="keywordflow">if</span> (!einfo)</div>
<div class="line"> {</div>
<div class="line"> fputs(<span class="stringliteral">"ERROR: could not get evas engine info!\n"</span>, stderr);</div>
<div class="line"> <a class="code" href="group__Evas__Canvas.html#ga45ab1883cc0b145bc3af130d3c00a21f">evas_free</a>(canvas);</div>
<div class="line"> <span class="keywordflow">return</span> NULL;</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="comment">// ARGB32 is sizeof(int), that is 4 bytes, per pixel</span></div>
<div class="line"> pixels = malloc(width * height * <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>));</div>
<div class="line"> <span class="keywordflow">if</span> (!pixels)</div>
<div class="line"> {</div>
<div class="line"> fputs(<span class="stringliteral">"ERROR: could not allocate canvas pixels!\n"</span>, stderr);</div>
<div class="line"> <a class="code" href="group__Evas__Canvas.html#ga45ab1883cc0b145bc3af130d3c00a21f">evas_free</a>(canvas);</div>
<div class="line"> <span class="keywordflow">return</span> NULL;</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;</div>
<div class="line"> einfo->info.dest_buffer = pixels;</div>
<div class="line"> einfo->info.dest_buffer_row_bytes = width * <span class="keyword">sizeof</span>(int);</div>
<div class="line"> einfo->info.use_color_key = 0;</div>
<div class="line"> einfo->info.alpha_threshold = 0;</div>
<div class="line"> einfo->info.func.new_update_region = NULL;</div>
<div class="line"> einfo->info.func.free_update_region = NULL;</div>
<div class="line"> <a class="code" href="group__Evas__Output__Method.html#gafeff04b89b4498eedf99c89e0a06e604">evas_engine_info_set</a>(canvas, (<a class="code" href="struct__Evas__Engine__Info.html">Evas_Engine_Info</a> *)einfo);</div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">return</span> canvas;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> destroy_canvas(<a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *canvas)</div>
<div class="line">{</div>
<div class="line"> Evas_Engine_Info_Buffer *einfo;</div>
<div class="line"></div>
<div class="line"> einfo = (Evas_Engine_Info_Buffer *)<a class="code" href="group__Evas__Output__Method.html#ga882d5f9411b5556719bdf28a134ee713">evas_engine_info_get</a>(canvas);</div>
<div class="line"> <span class="keywordflow">if</span> (!einfo)</div>
<div class="line"> {</div>
<div class="line"> fputs(<span class="stringliteral">"ERROR: could not get evas engine info!\n"</span>, stderr);</div>
<div class="line"> <a class="code" href="group__Evas__Canvas.html#ga45ab1883cc0b145bc3af130d3c00a21f">evas_free</a>(canvas);</div>
<div class="line"> <span class="keywordflow">return</span>;</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> free(einfo->info.dest_buffer);</div>
<div class="line"> <a class="code" href="group__Evas__Canvas.html#ga45ab1883cc0b145bc3af130d3c00a21f">evas_free</a>(canvas);</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> draw_scene(<a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *canvas)</div>
<div class="line">{</div>
<div class="line"> Eina_List *updates, *n;</div>
<div class="line"> Eina_Rectangle *update;</div>
<div class="line"></div>
<div class="line"> <span class="comment">// render and get the updated rectangles:</span></div>
<div class="line"> updates = <a class="code" href="group__Evas__Canvas.html#ga49650dcc731a151d4881106b56f7a5ca">evas_render_updates</a>(canvas);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// informative only here, just print the updated areas:</span></div>
<div class="line"> EINA_LIST_FOREACH(updates, n, update)</div>
<div class="line"> printf("UPDATED REGION: pos: %3d, %3d size: %3dx%3d\n",</div>
<div class="line"> update->x, update->y, update->w, update->h);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// free list of updates</span></div>
<div class="line"> <a class="code" href="group__Evas__Canvas.html#gae4889bb5ec0e6e4f6ce5d6ef99f8737b">evas_render_updates_free</a>(updates);</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line">static <span class="keywordtype">void</span> save_scene(<a class="code" href="group__Evas__Canvas.html#ga5ff87cc4ce6bc43e3b640a6d37f73043">Evas</a> *canvas, const <span class="keywordtype">char</span> *dest)</div>
<div class="line">{</div>
<div class="line"> Evas_Engine_Info_Buffer *einfo;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *pixels, *pixels_end;</div>
<div class="line"> <span class="keywordtype">int</span> width, height;</div>
<div class="line"> FILE *f;</div>
<div class="line"></div>
<div class="line"> einfo = (Evas_Engine_Info_Buffer *)<a class="code" href="group__Evas__Output__Method.html#ga882d5f9411b5556719bdf28a134ee713">evas_engine_info_get</a>(canvas);</div>
<div class="line"> <span class="keywordflow">if</span> (!einfo)</div>
<div class="line"> {</div>
<div class="line"> fputs(<span class="stringliteral">"ERROR: could not get evas engine info!\n"</span>, stderr);</div>
<div class="line"> <span class="keywordflow">return</span>;</div>
<div class="line"> }</div>
<div class="line"> <a class="code" href="group__Evas__Output__Size.html#ga1f3497644d526ff5ded49b19c1ec732a">evas_output_size_get</a>(canvas, &width, &height);</div>
<div class="line"></div>
<div class="line"> f = fopen(dest, <span class="stringliteral">"wb+"</span>);</div>
<div class="line"> <span class="keywordflow">if</span> (!f)</div>
<div class="line"> {</div>
<div class="line"> fprintf(stderr, <span class="stringliteral">"ERROR: could not open for writing '%s': %s\n"</span>,</div>
<div class="line"> dest, strerror(errno));</div>
<div class="line"> <span class="keywordflow">return</span>;</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> pixels = einfo->info.dest_buffer;</div>
<div class="line"> pixels_end = pixels + (width * height);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// PPM P6 format is dead simple to write:</span></div>
<div class="line"> fprintf(f, <span class="stringliteral">"P6\n%d %d\n255\n"</span>, width, height);</div>
<div class="line"> <span class="keywordflow">for</span> (; pixels < pixels_end; pixels++)</div>
<div class="line"> {</div>
<div class="line"> <span class="keywordtype">int</span> r, g, b;</div>
<div class="line"></div>
<div class="line"> r = ((*pixels) & 0xff0000) >> 16;</div>
<div class="line"> g = ((*pixels) & 0x00ff00) >> 8;</div>
<div class="line"> b = (*pixels) & 0x0000ff;</div>
<div class="line"></div>
<div class="line"> fprintf(f, <span class="stringliteral">"%c%c%c"</span>, r, g, b);</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> fclose(f);</div>
<div class="line"> printf(<span class="stringliteral">"saved scene as '%s'\n"</span>, dest);</div>
<div class="line">}</div>
</div><!-- fragment --> </div></div><!-- contents -->
<div id="push"></div>
</div> <!-- #content -->
</div> <!-- .layout -->
</div> <!-- #container -->
<div id="footer">
<table><tr>
<td class="poweredby"><img src="doxygen.png"></td>
<td>Samsung Electronics is supporting the EFL Documentation Project</td>
<td class="copyright">Copyright ©2014 Enlightenment</td>
<td class="generated">Docs generated Thu Feb 13 2014 09:58:51</td>
</tr></table>
</div>
</body>
</html>
|