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


Function to create evas rectangle objects.  


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


\subsection{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 \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}{}\subsection{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}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(evas\_canvas);
\textcolor{comment}{//Here we set the rectangles red, green, blue and opacity levels}
\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(bg, 255, 255, 255, 255); \textcolor{comment}{// opaque white background}
evas\_object\_resize(bg, WIDTH, HEIGHT); \textcolor{comment}{// covers full canvas}
\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(bg);
\end{DoxyCode}


This however 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}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(
      \hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}(ee));
\textcolor{comment}{//Here we set the rectangles red, green, blue and opacity levels}
\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(bg, 255, 255, 255, 255); \textcolor{comment}{// opaque white background}
evas\_object\_resize(bg, WIDTH, HEIGHT); \textcolor{comment}{// covers full canvas}
\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(bg);
\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}{}\subsection{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's simplicity means that it'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's type.\hypertarget{group__Evas__Object__Rectangle_clipping}{}\subsection{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}{}\subsubsection{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't always possible) it's usually easier to use a a clipper. A clipper is a rectangle that defines what'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 \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{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}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *clipper = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(evas\_canvas);
evas\_object\_move(clipper, my\_evas\_object\_x / 4, my\_evas\_object\_y / 4);
evas\_object\_resize(clipper, my\_evas\_object\_width / 2, my\_evas\_object\_height / 2);
evas\_object\_clip\_set(my\_evas\_object, clipper);
\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(clipper);
\end{DoxyCode}
\hypertarget{group__Evas__Object__Rectangle_color}{}\subsubsection{Layer of color}\label{group__Evas__Object__Rectangle_color}
In the \hyperlink{group__Evas__Object__Rectangle_clipping}{Clipping} section we used a solid white clipper, which 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 of color 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}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *clipper = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(evas);
evas\_object\_move(clipper, my\_evas\_object\_x, my\_evas\_object\_y);
evas\_object\_resize(clipper, my\_evas\_object\_width, my\_evas\_object\_height);
\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(clipper, 0, 255, 255, 255);
evas\_object\_clip\_set(obj, clipper);
\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(clipper);
\end{DoxyCode}


\begin{DoxyWarning}{Warning}
We don'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 \hyperlink{Example_Evas_Object_Manipulation}{Evas objects basic manipulation example}. 

\subsection{Function Documentation}
\hypertarget{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{\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}}
\subsubsection[{evas\+\_\+object\+\_\+rectangle\+\_\+add}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Evas\+\_\+\+Object}$\ast$ evas\+\_\+object\+\_\+rectangle\+\_\+add (
\begin{DoxyParamCaption}
\item[{{\bf Evas} $\ast$}]{e}
\end{DoxyParamCaption}
)}}\label{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}


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}


Referenced by ecore\+\_\+evas\+\_\+ews\+\_\+background\+\_\+set(), and edje\+\_\+perspective\+\_\+new().

