In this example, we\textquotesingle{}ll demonstrate the use of \mbox{\hyperlink{group__Ecore__Evas__Group_ga94ab8c823c98ba58a6a61ce8aaebe32e}{ecore\+\_\+evas\+\_\+object\+\_\+image\+\_\+new()}}. The idea is to have the same scene created for \mbox{\hyperlink{Ecore_Evas_Buffer_Example_01_c}{Ecore\+\_\+\+Evas buffer example}} as the contents of an image object.

The canvas receiving this image object will have a white background, a red border image to delimit this image\textquotesingle{}s boundaries and the image itself. After we create the special image, we set its \char`\"{}fill\char`\"{} property, place and resize it as we want. We have also to resize its underlying {\ttfamily Ecore\+\_\+\+Evas} too, to the same dimensions\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   img = \mbox{\hyperlink{group__Ecore__Evas__Group_ga94ab8c823c98ba58a6a61ce8aaebe32e}{ecore\_evas\_object\_image\_new}}(ee);}
\DoxyCodeLine{   evas\_object\_image\_filled\_set(img, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   evas\_object\_image\_size\_set(}
\DoxyCodeLine{     img, ((2 * WIDTH) / 3) -\/ 6, ((2 * HEIGHT) / 3) -\/ 6);}
\DoxyCodeLine{   sub\_ee = \mbox{\hyperlink{group__Ecore__Evas__Group_ga70c5492c4d2086b2a38d52fd4a281c65}{ecore\_evas\_object\_ecore\_evas\_get}}(img);}
\DoxyCodeLine{   sub\_canvas = \mbox{\hyperlink{group__Ecore__Evas__Group_ga31d4f9dd1586c8ce2680cf9f3d891f3c}{ecore\_evas\_object\_evas\_get}}(img);}
\DoxyCodeLine{}
\DoxyCodeLine{   evas\_object\_move(img, (WIDTH / 6) + 3, (HEIGHT / 6) + 3);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* apply the same size on both! */}}
\DoxyCodeLine{   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);}

\end{DoxyCodeInclude}


Now, we re-\/create the scene we cited, using the sub-\/canvas of our image to parent the objects in question. Because image objects are created with the alpha channel enabled, by default, we\textquotesingle{}ll be seeing our white rectangle beneath the scene\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   r0 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(r0, 0, 0, 0, 255); \textcolor{comment}{/* 100\% opaque black bg */}}
\DoxyCodeLine{   evas\_object\_move(r0, 0, 0);}
\DoxyCodeLine{   evas\_object\_resize(r0, ((2 * WIDTH) / 3) -\/ 6, ((2 * HEIGHT) / 3) -\/ 6);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(r0);}
\DoxyCodeLine{   }
\DoxyCodeLine{   r1 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(r1, 255, 0, 0, 255); \textcolor{comment}{/* 100\% opaque red */}}
\DoxyCodeLine{   evas\_object\_move(r1, 10, 10);}
\DoxyCodeLine{   evas\_object\_resize(r1, 100, 100);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(r1);}
\DoxyCodeLine{}
\DoxyCodeLine{   r2 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(r2, 0, 128, 0, 128); \textcolor{comment}{/* 50\% opaque green */}}
\DoxyCodeLine{   evas\_object\_move(r2, 10, 10);}
\DoxyCodeLine{   evas\_object\_resize(r2, 50, 50);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(r2);}
\DoxyCodeLine{}
\DoxyCodeLine{   r3 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(r3, 0, 128, 0, 255); \textcolor{comment}{/* 100\% opaque dark green */}}
\DoxyCodeLine{   evas\_object\_move(r3, 60, 60);}
\DoxyCodeLine{   evas\_object\_resize(r3, 50, 50);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(r3);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(img);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}

\end{DoxyCodeInclude}


And that\textquotesingle{}s all. The contents of our image could be updated as one wished, and they would always be mirrored in the image\textquotesingle{}s area.

Check that destination file for the result. The full example follows.


\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_gac7f2cdbcb79635c34317c1183dd04cb0}{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_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(ee);}
\DoxyCodeLine{}
\DoxyCodeLine{   bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}}
\DoxyCodeLine{   evas\_object\_move(bg, 0, 0); \textcolor{comment}{/* at origin */}}
\DoxyCodeLine{   evas\_object\_resize(bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{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 = evas\_object\_image\_filled\_add(canvas);}
\DoxyCodeLine{   evas\_object\_image\_file\_set(border, border\_img\_path, NULL);}
\DoxyCodeLine{   evas\_object\_image\_border\_set(border, 3, 3, 3, 3);}
\DoxyCodeLine{   evas\_object\_image\_border\_center\_fill\_set(border, EVAS\_BORDER\_FILL\_NONE);}
\DoxyCodeLine{}
\DoxyCodeLine{   evas\_object\_move(border, WIDTH / 6, HEIGHT / 6);}
\DoxyCodeLine{   evas\_object\_resize(border, (2 * WIDTH) / 3, (2 * HEIGHT) / 3);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(border);}
\DoxyCodeLine{}
\DoxyCodeLine{   img = \mbox{\hyperlink{group__Ecore__Evas__Group_ga94ab8c823c98ba58a6a61ce8aaebe32e}{ecore\_evas\_object\_image\_new}}(ee);}
\DoxyCodeLine{   evas\_object\_image\_filled\_set(img, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   evas\_object\_image\_size\_set(}
\DoxyCodeLine{     img, ((2 * WIDTH) / 3) -\/ 6, ((2 * HEIGHT) / 3) -\/ 6);}
\DoxyCodeLine{   sub\_ee = \mbox{\hyperlink{group__Ecore__Evas__Group_ga70c5492c4d2086b2a38d52fd4a281c65}{ecore\_evas\_object\_ecore\_evas\_get}}(img);}
\DoxyCodeLine{   sub\_canvas = \mbox{\hyperlink{group__Ecore__Evas__Group_ga31d4f9dd1586c8ce2680cf9f3d891f3c}{ecore\_evas\_object\_evas\_get}}(img);}
\DoxyCodeLine{}
\DoxyCodeLine{   evas\_object\_move(img, (WIDTH / 6) + 3, (HEIGHT / 6) + 3);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* apply the same size on both! */}}
\DoxyCodeLine{   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_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(r0, 0, 0, 0, 255); \textcolor{comment}{/* 100\% opaque black bg */}}
\DoxyCodeLine{   evas\_object\_move(r0, 0, 0);}
\DoxyCodeLine{   evas\_object\_resize(r0, ((2 * WIDTH) / 3) -\/ 6, ((2 * HEIGHT) / 3) -\/ 6);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(r0);}
\DoxyCodeLine{   }
\DoxyCodeLine{   r1 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(r1, 255, 0, 0, 255); \textcolor{comment}{/* 100\% opaque red */}}
\DoxyCodeLine{   evas\_object\_move(r1, 10, 10);}
\DoxyCodeLine{   evas\_object\_resize(r1, 100, 100);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(r1);}
\DoxyCodeLine{}
\DoxyCodeLine{   r2 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(r2, 0, 128, 0, 128); \textcolor{comment}{/* 50\% opaque green */}}
\DoxyCodeLine{   evas\_object\_move(r2, 10, 10);}
\DoxyCodeLine{   evas\_object\_resize(r2, 50, 50);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(r2);}
\DoxyCodeLine{}
\DoxyCodeLine{   r3 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(sub\_canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(r3, 0, 128, 0, 255); \textcolor{comment}{/* 100\% opaque dark green */}}
\DoxyCodeLine{   evas\_object\_move(r3, 60, 60);}
\DoxyCodeLine{   evas\_object\_resize(r3, 50, 50);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(r3);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{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}
 