\hypertarget{group__Evas__Object__Rectangle}{}\doxysection{Rectangle Object Functions}
\label{group__Evas__Object__Rectangle}\index{Rectangle Object Functions@{Rectangle Object Functions}}


Function to create evas rectangle objects.  


\begin{DoxyCompactItemize}
\item 
EVAS\+\_\+\+API \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\+\_\+\+Object}} $\ast$ \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\+\_\+object\+\_\+rectangle\+\_\+add}} (\mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} $\ast$e)
\begin{DoxyCompactList}\small\item\em Adds a rectangle to the given evas. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Function to create evas rectangle objects. 

There is only one function to deal with rectangle objects, this may make this function seem useless given there are no functions to manipulate the created rectangle, however the rectangle is actually very useful and should be manipulated using the generic \mbox{\hyperlink{group__Evas__Object__Group}{evas object functions}}.

The evas rectangle serves a number of key functions when working on evas programs\+: \begin{DoxyItemize}
\item Background \item Debugging \item Clipper\end{DoxyItemize}
\hypertarget{group__Evas__Object__Rectangle_Background}{}\doxysubsection{Background}\label{group__Evas__Object__Rectangle_Background}
One extremely common requirement of evas programs is to have a solid color background, this can be accomplished with the following very simple code\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *bg\ =\ \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(evas\_canvas);}
\DoxyCodeLine{\textcolor{comment}{//Here\ we\ set\ the\ rectangles\ red,\ green,\ blue\ and\ opacity\ levels}}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(bg,\ 255,\ 255,\ 255,\ 255);\ \textcolor{comment}{//\ opaque\ white\ background}}
\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);}

\end{DoxyCode}


This will have issues if the {\ttfamily evas\+\_\+canvas} is resized, however most windows are created using ecore evas and that has a solution to using the rectangle as a background\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *bg\ =\ \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(\mbox{\hyperlink{group__Ecore__Evas__Group_ga6f8d214cd55bc940d7cc62fecd8dbc06}{ecore\_evas\_get}}(ee));}
\DoxyCodeLine{\textcolor{comment}{//Here\ we\ set\ the\ rectangles\ red,\ green,\ blue\ and\ opacity\ levels}}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(bg,\ 255,\ 255,\ 255,\ 255);\ \textcolor{comment}{//\ opaque\ white\ background}}
\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{\mbox{\hyperlink{group__Ecore__Evas__Group_gac35627a5c3a766ee42762dbcc9eb733d}{ecore\_evas\_object\_associate}}(ee,\ bg,\ ECORE\_EVAS\_OBJECT\_ASSOCIATE\_BASE);}

\end{DoxyCode}
 So this gives us a white background to our window that will be resized together with it.\hypertarget{group__Evas__Object__Rectangle_Debugging}{}\doxysubsection{Debugging}\label{group__Evas__Object__Rectangle_Debugging}
Debugging is a major part of any programmers task and when debugging visual issues with evas programs the rectangle is an extremely useful tool. The rectangle\textquotesingle{}s simplicity means that it\textquotesingle{}s easier to pinpoint issues with it than with more complex objects. Therefore a common technique to use when writing an evas program and not getting the desired visual result is to replace the misbehaving object for a solid color rectangle and seeing how it interacts with the other elements, this often allows us to notice clipping, parenting or positioning issues. Once the issues have been identified and corrected the rectangle can be replaced for the original part and in all likelihood any remaining issues will be specific to that object\textquotesingle{}s type.\hypertarget{group__Evas__Object__Rectangle_clipping}{}\doxysubsection{Clipping}\label{group__Evas__Object__Rectangle_clipping}
Clipping serves two main functions\+: \begin{DoxyItemize}
\item Limiting visibility(i.\+e. hiding portions of an object). \item Applying a layer of color to an object.\end{DoxyItemize}
\hypertarget{group__Evas__Object__Rectangle_hiding}{}\doxysubsubsection{Limiting visibility}\label{group__Evas__Object__Rectangle_hiding}
It is often necessary to show only parts of an object, while it may be possible to create an object that corresponds only to the part that must be shown(and it isn\textquotesingle{}t always possible) it\textquotesingle{}s usually easier to use a a clipper. A clipper is a rectangle that defines what\textquotesingle{}s visible and what is not. The way to do this is to create a solid white rectangle(which is the default, no need to call evas\+\_\+object\+\_\+color\+\_\+set()) and give it a position and size of what should be visible. The following code exemplifies showing the center half of {\ttfamily my\+\_\+evas\+\_\+object\+:} 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *clipper\ =\ \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(evas\_canvas);}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(clipper,\ my\_evas\_object\_x\ /\ 4,\ my\_evas\_object\_y\ /\ 4);}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(clipper,\ my\_evas\_object\_width\ /\ 2,\ my\_evas\_object\_height\ /\ 2);}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga66f8c8350b182fe880d0242a26de2632}{evas\_object\_clip\_set}}(my\_evas\_object,\ clipper);}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(clipper);}

\end{DoxyCode}
\hypertarget{group__Evas__Object__Rectangle_color}{}\doxysubsubsection{Layer of color}\label{group__Evas__Object__Rectangle_color}
In the \mbox{\hyperlink{group__Evas__Object__Rectangle_clipping}{Clipping}} section we used a solid white clipper that produced no change in the color of the clipped object, it just hid what was outside the clippers area. It is however sometimes desirable to change the color of an object, this can be accomplished using a clipper that has a non-\/white color. Clippers with color work by multiplying the colors of clipped object. The following code will show how to remove all the red from an object\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *clipper\ =\ \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(evas);}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(clipper,\ my\_evas\_object\_x,\ my\_evas\_object\_y);}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(clipper,\ my\_evas\_object\_width,\ my\_evas\_object\_height);}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(clipper,\ 0,\ 255,\ 255,\ 255);}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga66f8c8350b182fe880d0242a26de2632}{evas\_object\_clip\_set}}(obj,\ clipper);}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(clipper);}

\end{DoxyCode}


\begin{DoxyWarning}{Warning}
We don\textquotesingle{}t guarantee any proper results if you create a Rectangle object without setting the evas engine.
\end{DoxyWarning}
For an example that more fully exercise the use of an evas object rectangle see \mbox{\hyperlink{Example_Evas_Object_Manipulation}{Evas objects basic manipulation example}}. 

\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}\label{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}} 
\index{Rectangle Object Functions@{Rectangle Object Functions}!evas\_object\_rectangle\_add@{evas\_object\_rectangle\_add}}
\index{evas\_object\_rectangle\_add@{evas\_object\_rectangle\_add}!Rectangle Object Functions@{Rectangle Object Functions}}
\doxysubsubsection{\texorpdfstring{evas\_object\_rectangle\_add()}{evas\_object\_rectangle\_add()}}
{\footnotesize\ttfamily EVAS\+\_\+\+API \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\+\_\+\+Object}} $\ast$ evas\+\_\+object\+\_\+rectangle\+\_\+add (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} $\ast$}]{e }\end{DoxyParamCaption})}



Adds a rectangle to the given evas. 


\begin{DoxyParams}{Parameters}
{\em e} & The given evas. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The new rectangle object. 
\end{DoxyReturn}


References \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gae7cf7b1d66fa9022242e09fd53c06bb2}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+FALSE\+\_\+\+RETURN\+\_\+\+VAL}}, and \mbox{\hyperlink{group__Evas__Canvas_ga7987306d8b2c49352b9d2c41585d0ce9}{EVAS\+\_\+\+CANVAS\+\_\+\+CLASS}}.



Referenced by \mbox{\hyperlink{group__Edje__Perspective_gab9535d9102c796181d633192b63bf25c}{edje\+\_\+perspective\+\_\+new()}}.

