\hypertarget{ecore_evas_buffer_example_02_8c-example}{}\doxysection{ecore\+\_\+evas\+\_\+buffer\+\_\+example\+\_\+02.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#ifdef HAVE\_CONFIG\_H}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include "{}config.h"{}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define EINA\_UNUSED}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define PACKAGE\_EXAMPLES\_DIR "{}."{}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Ecore.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <stdio.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define WIDTH  (320)}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define HEIGHT (240)}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} Ecore\_Evas *ee;}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *border\_img\_path = PACKAGE\_EXAMPLES\_DIR \textcolor{stringliteral}{"{}/red.png"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_destroy(Ecore\_Evas *ee\_ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *canvas, *sub\_canvas;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *bg, *r0, *r1, *r2, *r3; \textcolor{comment}{/* "{}sub"{} canvas objects */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *border, *img; \textcolor{comment}{/* canvas objects */}}
\DoxyCodeLine{   Ecore\_Evas *sub\_ee;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}}
\DoxyCodeLine{\textcolor{comment}{    * engine available */}}
\DoxyCodeLine{   ee = \mbox{\hyperlink{group__Ecore__Evas__Group_gaaa770b6f2f1395f9eeb0e50e26c3f933}{ecore\_evas\_new}}(NULL, 0, 0, WIDTH, HEIGHT, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!ee) \textcolor{keywordflow}{goto} error;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga63abcee3b625bd6410fe8eb46b2a5d9c}{ecore\_evas\_size\_min\_set}}(ee, WIDTH, HEIGHT);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gac9ad3e25ab3f2bea8be726d24df62902}{ecore\_evas\_size\_max\_set}}(ee, WIDTH, HEIGHT);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3d478e975e2101b9b821ef24baf3dd9e}{ecore\_evas\_callback\_delete\_request\_set}}(ee, \_on\_destroy);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}}(ee, \textcolor{stringliteral}{"{}Ecore\_Evas buffer (image) example"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}}(ee);}
\DoxyCodeLine{}
\DoxyCodeLine{   canvas = \mbox{\hyperlink{group__Ecore__Evas__Group_ga6f8d214cd55bc940d7cc62fecd8dbc06}{ecore\_evas\_get}}(ee);}
\DoxyCodeLine{}
\DoxyCodeLine{   bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(bg, 0, 0); \textcolor{comment}{/* at origin */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bg);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* this is a border around the image containing a scene of another}}
\DoxyCodeLine{\textcolor{comment}{    * canvas */}}
\DoxyCodeLine{   border = \mbox{\hyperlink{group__Evas__Object__Image_gafb52be265f315186a28d43af2d559ec6}{evas\_object\_image\_filled\_add}}(canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_gac2e588476b16b04f85ca9a594c140c1d}{evas\_object\_image\_file\_set}}(border, border\_img\_path, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga063e5ad38b43897311bbdecfe8dc312d}{evas\_object\_image\_border\_set}}(border, 3, 3, 3, 3);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga5749943ce62e85ead67a1440960677fa}{evas\_object\_image\_border\_center\_fill\_set}}(border, \mbox{\hyperlink{group__Evas__Object__Image_gga9f789224285e646309b7dd81a2401910a2ad856ac6aab5e2659c3a584a37aec70}{EVAS\_BORDER\_FILL\_NONE}});}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(border, WIDTH / 6, HEIGHT / 6);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(border, (2 * WIDTH) / 3, (2 * HEIGHT) / 3);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(border);}
\DoxyCodeLine{}
\DoxyCodeLine{   img = \mbox{\hyperlink{group__Ecore__Evas__Group_gaca412094dad41a3bb020656b0eee97e2}{ecore\_evas\_object\_image\_new}}(ee);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_gaf3dae548e4434e771dafea8f791e7164}{evas\_object\_image\_filled\_set}}(img, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga4bef461d2edd675516ec8460a4c62e8d}{evas\_object\_image\_size\_set}}(}
\DoxyCodeLine{     img, ((2 * WIDTH) / 3) -\/ 6, ((2 * HEIGHT) / 3) -\/ 6);}
\DoxyCodeLine{   sub\_ee = \mbox{\hyperlink{group__Ecore__Evas__Group_gae8e0f84de093a975cac8f26b2cc4a7d5}{ecore\_evas\_object\_ecore\_evas\_get}}(img);}
\DoxyCodeLine{   sub\_canvas = \mbox{\hyperlink{group__Ecore__Evas__Group_ga40b4c25d38b797a5793c1cd87ac874da}{ecore\_evas\_object\_evas\_get}}(img);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(img, (WIDTH / 6) + 3, (HEIGHT / 6) + 3);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* apply the same size on both! */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(img, ((2 * WIDTH) / 3) -\/ 6, ((2 * HEIGHT) / 3) -\/ 6);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3109b574eca21cd8b57a749c362dba3e}{ecore\_evas\_resize}}(sub\_ee, ((2 * WIDTH) / 3) -\/ 6, ((2 * HEIGHT) / 3) -\/ 6);}
\DoxyCodeLine{}
\DoxyCodeLine{   r0 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(r0, 0, 0, 0, 255); \textcolor{comment}{/* 100\% opaque black bg */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(r0, 0, 0);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(r0, ((2 * WIDTH) / 3) -\/ 6, ((2 * HEIGHT) / 3) -\/ 6);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(r0);}
\DoxyCodeLine{}
\DoxyCodeLine{   r1 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(r1, 255, 0, 0, 255); \textcolor{comment}{/* 100\% opaque red */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(r1, 10, 10);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(r1, 100, 100);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(r1);}
\DoxyCodeLine{}
\DoxyCodeLine{   r2 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(r2, 0, 128, 0, 128); \textcolor{comment}{/* 50\% opaque green */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(r2, 10, 10);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(r2, 50, 50);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(r2);}
\DoxyCodeLine{}
\DoxyCodeLine{   r3 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(r3, 0, 128, 0, 255); \textcolor{comment}{/* 100\% opaque dark green */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(r3, 60, 60);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(r3, 50, 50);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(r3);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(img);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}}(ee);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{}
\DoxyCodeLine{error:}
\DoxyCodeLine{   fprintf(stderr, \textcolor{stringliteral}{"{}error: Requires at least one Evas engine built"{}}}
\DoxyCodeLine{                   \textcolor{stringliteral}{"{} and linked to ecore-\/evas for this example to run"{}}}
\DoxyCodeLine{                   \textcolor{stringliteral}{"{} properly.\(\backslash\)n"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();}
\DoxyCodeLine{   \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}

\end{DoxyCodeInclude}
 