\hypertarget{photocam_example_01_8c-example}{}\doxysection{photocam\+\_\+example\+\_\+01.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc -\/o photocam\_example\_01 photocam\_example\_01.c -\/g `pkg-\/config -\/-\/cflags -\/-\/libs elementary` -\/DDATA\_DIR="\(\backslash\)"<directory>\(\backslash\)""}}
\DoxyCodeLine{\textcolor{comment}{//where directory is the path where images/insanely\_huge\_test\_image.jpg can be found.}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Elementary.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_fit(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info);}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_unfit(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info);}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_zoom(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info);}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_bring\_in(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info);}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_orient(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info);}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_orient\_do(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Orient\_Data Orient\_Data;}
\DoxyCodeLine{\textcolor{keyword}{struct }\_Orient\_Data}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *ph;}
\DoxyCodeLine{   Evas\_Image\_Orient orient;}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{EAPI\_MAIN \textcolor{keywordtype}{int}}
\DoxyCodeLine{elm\_main(\textcolor{keywordtype}{int} argc \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{char} **argv \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *win, *obj, *photocam, *menu;}
\DoxyCodeLine{   Orient\_Data *orient\_data;}
\DoxyCodeLine{   \textcolor{keywordtype}{char} buf[PATH\_MAX];}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__App_ga0cefb59efb95841232561d67e34d9909}{elm\_app\_info\_set}}(elm\_main, \textcolor{stringliteral}{"elementary"}, \textcolor{stringliteral}{"images/insanely\_huge\_test\_image.jpg"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_ga7a05f37fd3a019da5e26c5fc91fcd937}{elm\_policy\_set}}(\mbox{\hyperlink{group__Elm__General_ggaa16f3378ecdbf660fa378402e3c5a0a9a02fadb6faada04b19d0fa42c11a8d32a}{ELM\_POLICY\_QUIT}}, \mbox{\hyperlink{group__Elm__General_gga46af37e6ac2c406321060be827117196abbe0962d88ae12afe1a173da881f56cd}{ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED}});}
\DoxyCodeLine{}
\DoxyCodeLine{   win = \mbox{\hyperlink{group__Elm__Win_gac75d7752662fab73d6420706ce5be996}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"photocam"}, \textcolor{stringliteral}{"Photocam"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{   photocam = \mbox{\hyperlink{group__Elm__Photocam_gabd50b6fda6afe732478a33e4999a1386}{elm\_photocam\_add}}(win);}
\DoxyCodeLine{   snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"\%s/images/insanely\_huge\_test\_image.jpg"}, \mbox{\hyperlink{group__Elm__App_ga92a09dbf88cc1ca3eab51c51dea589d0}{elm\_app\_data\_dir\_get}}());}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Photocam_gaa4cb6e360aab7307380ac92de4e04dd2}{elm\_photocam\_file\_set}}(photocam, buf);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Scroller_gae69101dbdb089598ca790c73bd9d7a42}{elm\_scroller\_bounce\_set}}(photocam, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}}, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(photocam, \textcolor{stringliteral}{"loaded,detail"}, \_bring\_in, NULL);}
\DoxyCodeLine{   evas\_object\_resize(photocam, 500, 400);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(photocam);}
\DoxyCodeLine{}
\DoxyCodeLine{   obj = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(obj, \textcolor{stringliteral}{"Fit"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(obj);}
\DoxyCodeLine{   evas\_object\_resize(obj, 50, 30);}
\DoxyCodeLine{   evas\_object\_move(obj, 10, 410);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(obj, \textcolor{stringliteral}{"clicked"}, \_fit, photocam);}
\DoxyCodeLine{}
\DoxyCodeLine{   obj = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(obj, \textcolor{stringliteral}{"Unfit"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(obj);}
\DoxyCodeLine{   evas\_object\_resize(obj, 70, 30);}
\DoxyCodeLine{   evas\_object\_move(obj, 70, 410);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(obj, \textcolor{stringliteral}{"clicked"}, \_unfit, photocam);}
\DoxyCodeLine{}
\DoxyCodeLine{   orient\_data = (Orient\_Data *)malloc(\textcolor{keyword}{sizeof}(Orient\_Data));}
\DoxyCodeLine{   orient\_data-\/>ph = photocam;}
\DoxyCodeLine{   orient\_data-\/>orient = 0;}
\DoxyCodeLine{   menu = \mbox{\hyperlink{group__Elm__Menu_gaaeecc450db4e359289c16c41489ca94b}{elm\_menu\_add}}(win);}
\DoxyCodeLine{   elm\_menu\_item\_add(menu, NULL, NULL, \textcolor{stringliteral}{"orient 0"}, \_orient\_do, orient\_data);}
\DoxyCodeLine{   orient\_data = (Orient\_Data *)malloc(\textcolor{keyword}{sizeof}(Orient\_Data));}
\DoxyCodeLine{   orient\_data-\/>ph = photocam;}
\DoxyCodeLine{   orient\_data-\/>orient = 1;}
\DoxyCodeLine{   elm\_menu\_item\_add(menu, NULL, NULL, \textcolor{stringliteral}{"orient 90"}, \_orient\_do, orient\_data);}
\DoxyCodeLine{   orient\_data = (Orient\_Data *)malloc(\textcolor{keyword}{sizeof}(Orient\_Data));}
\DoxyCodeLine{   orient\_data-\/>ph = photocam;}
\DoxyCodeLine{   orient\_data-\/>orient = 2;}
\DoxyCodeLine{   elm\_menu\_item\_add(menu, NULL, NULL, \textcolor{stringliteral}{"orient 180"}, \_orient\_do, orient\_data);}
\DoxyCodeLine{   orient\_data = (Orient\_Data *)malloc(\textcolor{keyword}{sizeof}(Orient\_Data));}
\DoxyCodeLine{   orient\_data-\/>ph = photocam;}
\DoxyCodeLine{   orient\_data-\/>orient = 3;}
\DoxyCodeLine{   elm\_menu\_item\_add(menu, NULL, NULL, \textcolor{stringliteral}{"orient 270"}, \_orient\_do, orient\_data);}
\DoxyCodeLine{   orient\_data = (Orient\_Data *)malloc(\textcolor{keyword}{sizeof}(Orient\_Data));}
\DoxyCodeLine{   orient\_data-\/>ph = photocam;}
\DoxyCodeLine{   orient\_data-\/>orient = 4;}
\DoxyCodeLine{   elm\_menu\_item\_add(menu, NULL, NULL, \textcolor{stringliteral}{"flip horizontal"}, \_orient\_do, orient\_data);}
\DoxyCodeLine{   orient\_data = (Orient\_Data *)malloc(\textcolor{keyword}{sizeof}(Orient\_Data));}
\DoxyCodeLine{   orient\_data-\/>ph = photocam;}
\DoxyCodeLine{   orient\_data-\/>orient = 5;}
\DoxyCodeLine{   elm\_menu\_item\_add(menu, NULL, NULL, \textcolor{stringliteral}{"flip vertical"}, \_orient\_do, orient\_data);}
\DoxyCodeLine{   orient\_data = (Orient\_Data *)malloc(\textcolor{keyword}{sizeof}(Orient\_Data));}
\DoxyCodeLine{   orient\_data-\/>ph = photocam;}
\DoxyCodeLine{   orient\_data-\/>orient = 6;}
\DoxyCodeLine{   elm\_menu\_item\_add(menu, NULL, NULL, \textcolor{stringliteral}{"flip transverse"}, \_orient\_do, orient\_data);}
\DoxyCodeLine{   orient\_data = (Orient\_Data *)malloc(\textcolor{keyword}{sizeof}(Orient\_Data));}
\DoxyCodeLine{   orient\_data-\/>ph = photocam;}
\DoxyCodeLine{   orient\_data-\/>orient = 7;}
\DoxyCodeLine{   elm\_menu\_item\_add(menu, NULL, NULL, \textcolor{stringliteral}{"flip transpose"}, \_orient\_do, orient\_data);}
\DoxyCodeLine{}
\DoxyCodeLine{   obj = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(obj, \textcolor{stringliteral}{"Orient"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(obj);}
\DoxyCodeLine{   evas\_object\_resize(obj, 70, 30);}
\DoxyCodeLine{   evas\_object\_move(obj, 470, 410);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(obj, \textcolor{stringliteral}{"clicked"}, \_orient, menu);}
\DoxyCodeLine{}
\DoxyCodeLine{   obj = \mbox{\hyperlink{group__Elm__Slider_ga15ade2fc52942975429bb3c864a8a258}{elm\_slider\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(obj, \textcolor{stringliteral}{"Zoom"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(obj);}
\DoxyCodeLine{   evas\_object\_resize(obj, 300, 30);}
\DoxyCodeLine{   evas\_object\_move(obj, 150, 410);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(obj, \textcolor{stringliteral}{"changed"}, \_zoom, photocam);}
\DoxyCodeLine{}
\DoxyCodeLine{   evas\_object\_resize(win, 500, 440);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(win);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_gadf2553f83e6b0b9c7fbe054019a664a1}{elm\_run}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\}}
\DoxyCodeLine{\mbox{\hyperlink{group__Elm__General_ga50fe52d513f7e89c9c770afd76de7ad9}{ELM\_MAIN}}()}
\DoxyCodeLine{}
\DoxyCodeLine{static \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_bring\_in(\textcolor{keywordtype}{void} *data \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{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} w, h;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Photocam_gae578f8117d96e92a27037947fabd3d15}{elm\_photocam\_image\_size\_get}}(obj, \&w, \&h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Photocam_ga51a9dd5b4e7c6593e9734d1838e11266}{elm\_photocam\_image\_region\_bring\_in}}(obj, w/2, h/2, 500, 400);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_fit(\textcolor{keywordtype}{void} *data, \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}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} x, y, w, h;}
\DoxyCodeLine{   elm\_photocam\_image\_region\_get(data, \&x, \&y, \&w, \&h);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"region: \{\%d, \%d, \%d, \%d\}\(\backslash\)n"}, x, y, w, h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Photocam_ga36acb49e545f2426115f74f4b33eb67f}{elm\_photocam\_zoom\_mode\_set}}(data, ELM\_PHOTOCAM\_ZOOM\_MODE\_AUTO\_FIT);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_unfit(\textcolor{keywordtype}{void} *data, \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}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Photocam_ga36acb49e545f2426115f74f4b33eb67f}{elm\_photocam\_zoom\_mode\_set}}(data, ELM\_PHOTOCAM\_ZOOM\_MODE\_MANUAL);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_zoom(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{double} z = \mbox{\hyperlink{group__Elm__Slider_ga2dd3f70cdbcb4a81b5d7a08a18afaa1d}{elm\_slider\_value\_get}}(obj) * 8;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Photocam_ga2f63118a574a0c42a615c0da60cf622a}{elm\_photocam\_zoom\_set}}(data, z);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_orient(\textcolor{keywordtype}{void} *data, \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}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *mn = data;}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!mn) \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(mn);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_orient\_do(\textcolor{keywordtype}{void} *data, \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}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Orient\_Data *orient\_data = data;}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!orient\_data) \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Photocam_gac575a889dbbdffb361c14160d2cbd4d4}{elm\_photocam\_image\_orient\_set}}(orient\_data-\/>ph, orient\_data-\/>orient);}
\DoxyCodeLine{\}}
\end{DoxyCodeInclude}
 