\hypertarget{evas-images2_8c-example}{}\section{evas-\/images2.\+c}

\begin{DoxyCodeInclude}

\textcolor{preprocessor}{#ifdef HAVE\_CONFIG\_H}
\textcolor{preprocessor}{#include "config.h"}
\textcolor{preprocessor}{#else}
\textcolor{preprocessor}{#define PACKAGE\_EXAMPLES\_DIR "."}
\textcolor{preprocessor}{#endif}

\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}}>}
\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <errno.h>}
\textcolor{preprocessor}{#include "evas-common.h"}

\textcolor{preprocessor}{#define WIDTH  (320)}
\textcolor{preprocessor}{#define HEIGHT (240)}

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *img\_path = PACKAGE\_EXAMPLES\_DIR EVAS\_IMAGE\_FOLDER \textcolor{stringliteral}{"/enlightenment.png"};
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tp - change proxy image's source\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ts - print noise image's stride value\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ta - save noise image to disk (/tmp dir)\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tv - change source visibility\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)te - enable/disable source events\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"};

\textcolor{keyword}{const} \textcolor{keywordtype}{char} *file\_path = \textcolor{stringliteral}{"/tmp/evas-images2-example.png"};
\textcolor{keyword}{const} \textcolor{keywordtype}{char} *quality\_str = \textcolor{stringliteral}{"quality=100"};

\textcolor{keyword}{struct }test\_data
\{
   Ecore\_Evas  *ee;
   \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *\mbox{\hyperlink{namespaceevas}{evas}};
   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *logo, *noise\_img, *proxy\_img, *text\_obj, *bg;
\};

\textcolor{keyword}{static} \textcolor{keyword}{struct }test\_data d = \{0\};

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_mouse\_down(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,
            \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Mouse__Down}{Evas\_Event\_Mouse\_Down}} *ev = event\_info;
   printf(\textcolor{stringliteral}{"Mouse Down - obj(%p), coords(%d %d)\(\backslash\)n"},
          obj, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Down_adcaa4cd5eadd8c04cc5510a5b2514eb5}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad809771faf3700a1492e4465336e6b1e}{x}}, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Down_adcaa4cd5eadd8c04cc5510a5b2514eb5}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad7450d6ad43e6a7394af6807721144f7}{y}});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_mouse\_move(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,
            \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Mouse__Move}{Evas\_Event\_Mouse\_Move}} *ev = event\_info;
   printf(\textcolor{stringliteral}{"Mouse Move - obj(%p), coords(%d %d)\(\backslash\)n"},
          obj, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Move_a652812079b71cc4c52053a75c4b574e2}{cur}}.\mbox{\hyperlink{struct__Evas__Position_a7e8e1417868ef65b1c2cee1f9f02e4eb}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad809771faf3700a1492e4465336e6b1e}{x}}, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Move_a652812079b71cc4c52053a75c4b574e2}{cur}}.\mbox{\hyperlink{struct__Evas__Position_a7e8e1417868ef65b1c2cee1f9f02e4eb}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad7450d6ad43e6a7394af6807721144f7}{y}});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_mouse\_up(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,
          \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Mouse__Up}{Evas\_Event\_Mouse\_Up}} *ev = event\_info;
   printf(\textcolor{stringliteral}{"Mouse Up - obj(%p), coords(%d %d)\(\backslash\)n"},
          obj, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Up_a6da4d82e2ec11b37fe971b17c5ac01dc}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad809771faf3700a1492e4465336e6b1e}{x}}, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Up_a6da4d82e2ec11b37fe971b17c5ac01dc}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad7450d6ad43e6a7394af6807721144f7}{y}});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_multi\_down(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,
            \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Multi__Down}{Evas\_Event\_Multi\_Down}} *ev = event\_info;
   printf(\textcolor{stringliteral}{"Multi Down - obj(%p), coords(%d %d)\(\backslash\)n"},
          obj, ev->canvas.\mbox{\hyperlink{struct__Evas__Coord__Precision__Point_a8cab3483eece4600b298d56f4a46fc60}{x}}, ev->canvas.\mbox{\hyperlink{struct__Evas__Coord__Precision__Point_a76cb7d78f6840bcad39739cbe26227d2}{y}});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_multi\_move(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,
             \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Multi__Move}{Evas\_Event\_Multi\_Move}} *ev = event\_info;
   printf(\textcolor{stringliteral}{"Multi Move - obj(%p), coords(%d %d)\(\backslash\)n"},
          obj, ev->cur.\mbox{\hyperlink{struct__Evas__Precision__Position_a4ee2ba8991b6657d668397b75f939eb7}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Precision__Point_a8cab3483eece4600b298d56f4a46fc60}{x}}, ev->cur.\mbox{\hyperlink{struct__Evas__Precision__Position_a4ee2ba8991b6657d668397b75f939eb7}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Precision__Point_a76cb7d78f6840bcad39739cbe26227d2}{y}});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_multi\_up(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,
          \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Multi__Up}{Evas\_Event\_Multi\_Up}} *ev = event\_info;
   printf(\textcolor{stringliteral}{"Multi Up - obj(%p), coords(%d %d)\(\backslash\)n"},
          obj, ev->canvas.\mbox{\hyperlink{struct__Evas__Coord__Precision__Point_a8cab3483eece4600b298d56f4a46fc60}{x}}, ev->canvas.\mbox{\hyperlink{struct__Evas__Coord__Precision__Point_a76cb7d78f6840bcad39739cbe26227d2}{y}});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_mouse\_in(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,
          \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Mouse__In}{Evas\_Event\_Mouse\_In}} *ev = event\_info;
   printf(\textcolor{stringliteral}{"Mouse In - obj(%p), coords(%d %d)\(\backslash\)n"},
          obj, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__In_a8b899409a50a9caf027cb195bf68683f}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad809771faf3700a1492e4465336e6b1e}{x}}, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__In_a8b899409a50a9caf027cb195bf68683f}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad7450d6ad43e6a7394af6807721144f7}{y}});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_mouse\_out(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,
           \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Mouse__Out}{Evas\_Event\_Mouse\_Out}} *ev = event\_info;
   printf(\textcolor{stringliteral}{"Mouse Out - obj(%p), coords(%d %d)\(\backslash\)n"},
          obj, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Out_abd681a1b6fc7f555c30ac86c664de696}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad809771faf3700a1492e4465336e6b1e}{x}}, ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Out_abd681a1b6fc7f555c30ac86c664de696}{canvas}}.\mbox{\hyperlink{struct__Evas__Coord__Point_ad7450d6ad43e6a7394af6807721144f7}{y}});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_hold(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,
      \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Hold}{Evas\_Event\_Hold}} *ev = event\_info;
   printf(\textcolor{stringliteral}{"Hold - obj(%p), hold(%d)\(\backslash\)n"}, obj, ev->\mbox{\hyperlink{struct__Evas__Event__Hold_a21f7238382ebd994e083623f777853f3}{hold}});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_preloaded(\textcolor{keywordtype}{void}        *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},
              \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},
              \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},
              \textcolor{keywordtype}{void}        *event\_info \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})
\{
    printf(\textcolor{stringliteral}{"Image has been pre-loaded!\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_destroy(Ecore\_Evas *ee \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})
\{
   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();
\}

\textcolor{comment}{/* Keep the example's window size in sync with the background image's size */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_canvas\_resize\_cb(Ecore\_Evas *ee)
\{
   \textcolor{keywordtype}{int} w, h;

   \mbox{\hyperlink{group__Ecore__Evas__Group_ga931aadf4603731e73e8a84e4b14f1493}{ecore\_evas\_geometry\_get}}(ee, NULL, NULL, &w, &h);
   evas\_object\_resize(d.bg, w, h);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_keydown(\textcolor{keywordtype}{void}        *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},
            \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *\mbox{\hyperlink{namespaceevas}{evas}} \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},
            \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},
            \textcolor{keywordtype}{void}        *einfo)
\{
   \mbox{\hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down}} *ev = einfo;

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"h"}) == 0) \textcolor{comment}{/* print help */}
     \{
        puts(commands);
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"s"}) == 0) \textcolor{comment}{/* print proxy image' stride value */}
     \{
        \textcolor{keywordtype}{int} stride = evas\_object\_image\_stride\_get(d.noise\_img);

        printf(\textcolor{stringliteral}{"Image has row stride value of %d, which accounts"}
               \textcolor{stringliteral}{" for %d pixels\(\backslash\)n"}, stride, stride / 4);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"p"}) == 0) \textcolor{comment}{/* change proxy's source */}
     \{
        \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *source = evas\_object\_image\_source\_get(d.proxy\_img);

        \textcolor{keywordflow}{if} (source == d.logo) source = d.noise\_img;
        \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (source == d.noise\_img) source = d.text\_obj;
        \textcolor{keywordflow}{else} source = d.logo;

        evas\_object\_image\_source\_set(d.proxy\_img, source);

        printf(\textcolor{stringliteral}{"Proxy image's source changed\(\backslash\)n"});

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"a"}) == 0) \textcolor{comment}{/* save noise image to disk */}
     \{
        \textcolor{keywordflow}{if} (!evas\_object\_image\_save(d.noise\_img, file\_path, NULL, quality\_str))
          fprintf(stderr, \textcolor{stringliteral}{"Cannot save image to '%s' (flags '%s')\(\backslash\)n"},
                  file\_path, quality\_str);
        \textcolor{keywordflow}{else}
          printf(\textcolor{stringliteral}{"Image saved to '%s' (flags '%s'), check it out with "}
                 \textcolor{stringliteral}{"an image viewer\(\backslash\)n"}, file\_path, quality\_str);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"v"}) == 0) \textcolor{comment}{/* change source visibility */}
     \{
        \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} src\_visible =
           evas\_object\_image\_source\_visible\_get(d.proxy\_img);
        evas\_object\_image\_source\_visible\_set(d.proxy\_img, !src\_visible);
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"e"}) == 0) \textcolor{comment}{/* change source events */}
     \{
        \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} src\_events = evas\_object\_image\_source\_events\_get(d.proxy\_img);
        evas\_object\_image\_source\_events\_set(d.proxy\_img, !src\_events);
        \textcolor{keywordflow}{return};
     \}
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} i;
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} pixels[(WIDTH / 4) * (HEIGHT / 4)];
   \mbox{\hyperlink{group__Evas__Object__Textblock_ga0936b029caf5493691f7fd523f8b885c}{Evas\_Textblock\_Style}} *st;

   srand(time(NULL));

   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}}())
     \textcolor{keywordflow}{return} EXIT\_FAILURE;

   \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}
\textcolor{comment}{    * engine available */}
   d.ee = \mbox{\hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}}(NULL, 10, 10, WIDTH, HEIGHT, NULL);
   \textcolor{keywordflow}{if} (!d.ee)
     \textcolor{keywordflow}{goto} \mbox{\hyperlink{namespaceefl_1_1eina_1_1log__level_a0eec9fe47d243634f680b56a7d768ec7}{error}};

   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3680b5c89157167318192157a5d24ec4}{ecore\_evas\_callback\_destroy\_set}}(d.ee, \_on\_destroy);
   \mbox{\hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}}(d.ee, \_canvas\_resize\_cb);
   \mbox{\hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}}(d.ee);

   \textcolor{comment}{/* the canvas pointer, de facto */}
   d.evas = \mbox{\hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(d.ee);

   d.bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(d.evas);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(d.bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}
   evas\_object\_move(d.bg, 0, 0); \textcolor{comment}{/* at canvas' origin */}
   evas\_object\_resize(d.bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.bg);

   evas\_object\_focus\_set(d.bg, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(
     d.bg, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a336b86bad4f145f84c155e4922335584}{EVAS\_CALLBACK\_KEY\_DOWN}}, \_on\_keydown, NULL);

   d.logo = evas\_object\_image\_filled\_add(d.evas);

   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(
       d.logo, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a5cd5ca5f4dcd51dd2429f020cb2dfa9e}{EVAS\_CALLBACK\_IMAGE\_PRELOADED}}, \_on\_preloaded, NULL);
   evas\_object\_image\_preload(d.logo, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});

   evas\_object\_image\_file\_set(d.logo, img\_path, NULL);
   evas\_object\_resize(d.logo, WIDTH / 2, HEIGHT / 2);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(d.logo, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}}, \_mouse\_down, 0);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(d.logo, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a23fb97fb7cbccded54ccf3fc4e1dab8a}{EVAS\_CALLBACK\_MOUSE\_MOVE}}, \_mouse\_move, 0);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(d.logo, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a8c1b22c99dd0231cd9ba1fecbffffac7}{EVAS\_CALLBACK\_MOUSE\_UP}}, \_mouse\_up, 0);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(d.logo, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a598c57bc146639618157159a319f11af}{EVAS\_CALLBACK\_MOUSE\_IN}}, \_mouse\_in, 0);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(d.logo, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a91aaa30a57047d0ee8a734e603751c25}{EVAS\_CALLBACK\_MOUSE\_OUT}}, \_mouse\_out, 0);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(d.logo, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968ab5bb0de31eaeed655255e71ffe518b80}{EVAS\_CALLBACK\_MULTI\_DOWN}}, \_multi\_down, 0);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(d.logo, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a4328f52cfb700b5c705edf7173afdd94}{EVAS\_CALLBACK\_MULTI\_UP}}, \_multi\_up, 0);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(d.logo, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a6d0ade7e69dc62f728fa2e29168e923f}{EVAS\_CALLBACK\_MULTI\_MOVE}}, \_multi\_move, 0);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(d.logo, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a585e05307b99c361e54df68a4f341a85}{EVAS\_CALLBACK\_HOLD}}, \_hold, 0);

   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.logo);

   \textcolor{comment}{/* creating noise image */}
   \textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof}(pixels) / \textcolor{keyword}{sizeof}(pixels[0]); i++)
     pixels[i] = rand();

   d.noise\_img = \mbox{\hyperlink{group__Evas__Object__Image_gadd901a6b181c38dc040537b3fd76fcc6}{evas\_object\_image\_add}}(d.evas);
   evas\_object\_image\_size\_set(d.noise\_img, WIDTH / 4, HEIGHT / 4);
   evas\_object\_image\_data\_set(d.noise\_img, pixels);
   evas\_object\_image\_filled\_set(d.noise\_img, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});
   evas\_object\_move(d.noise\_img, (WIDTH * 5) / 8, HEIGHT / 8);
   evas\_object\_resize(d.noise\_img, WIDTH / 4, HEIGHT / 4);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.noise\_img);
   printf(\textcolor{stringliteral}{"Creating noise image with size %d, %d\(\backslash\)n"},
          WIDTH / 4, HEIGHT / 4);

   d.text\_obj = \mbox{\hyperlink{group__Evas__Object__Textblock_ga5059cda84291080e59bcc72ead81ca93}{evas\_object\_textblock\_add}}(d.evas);
   \mbox{\hyperlink{group__Evas__Object__Textblock_gac35fdf7b795b08a884f62cf479b9901b}{evas\_object\_textblock\_text\_markup\_set}}(d.text\_obj, \textcolor{stringliteral}{"Hello world! :)"}
      );
   st = \mbox{\hyperlink{group__Evas__Object__Textblock_ga5047d80b99150342ce3cd5518b474df8}{evas\_textblock\_style\_new}}();
   \mbox{\hyperlink{group__Evas__Object__Textblock_gaf536f7e63f652e36a125006e31cf5457}{evas\_textblock\_style\_set}}(st, \textcolor{stringliteral}{"DEFAULT='font=Sans font\_size=16 color=#114
       wrap=word'"});
   \mbox{\hyperlink{group__Evas__Object__Textblock_ga14c222cd68f4c101dc9e52361c47c35e}{evas\_object\_textblock\_style\_set}}(d.text\_obj, st);
   evas\_object\_move(d.text\_obj, WIDTH / 16, HEIGHT * 9 / 16);
   evas\_object\_resize(d.text\_obj, WIDTH / 4, 0);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.text\_obj);

   d.proxy\_img = evas\_object\_image\_filled\_add(d.evas);
   evas\_object\_image\_source\_set(d.proxy\_img, d.logo);
   evas\_object\_move(d.proxy\_img, WIDTH / 2, HEIGHT / 2);
   evas\_object\_resize(d.proxy\_img, WIDTH / 2, HEIGHT / 2);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.proxy\_img);

   puts(commands);
   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();

   \mbox{\hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}}(d.ee);
   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();
   \textcolor{keywordflow}{return} 0;

\mbox{\hyperlink{namespaceefl_1_1eina_1_1log__level_a0eec9fe47d243634f680b56a7d768ec7}{error}}:
   fprintf(stderr, \textcolor{stringliteral}{"you got to have at least one evas engine built and linked"}
                   \textcolor{stringliteral}{" up to ecore-evas for this example to run properly.\(\backslash\)n"});
   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();
   \textcolor{keywordflow}{return} -1;
\}
\end{DoxyCodeInclude}
 