\begin{DoxyWarning}{Warning}
A new online documentation is available on the Wiki under \href{https://www.enlightenment.org/docs/efl/advanced/eflgfxfilters}{\tt E\+F\+L Graphics Filters}. The documentation below is mostly still valid but incomplete. This page may be removed in the future.
\end{DoxyWarning}
The Evas filters are a combination of filters used to apply specific effects to an \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas Object}. For the moment, these effects are specific to the \hyperlink{group__Evas__Object__Text}{Text} and \hyperlink{group__Evas__Object__Image}{Image Objects}.

The filters can be applied to an object using simple Lua scripts. A script will contain a series of buffer declarations and filter commands to apply to these buffers. The Lua programming language reference can be found \href{http://www.lua.org/manual/5.1/manual.html}{\tt here}.

Basically, when applying an effect to a \hyperlink{group__Evas__Object__Text}{Text Object}, an alpha-\/only {\ttfamily input} buffer is created, where the text is rendered, and an R\+G\+B\+A {\ttfamily output} buffer is created, where the text with effects shall be finally rendered.

The script language being Lua, it respects the usual Lua syntax and concepts. As these are simple filters, the scripts should be kept as small and simple as possible.

Note\+: Lua has been used since 1.\+10. The previous filters syntax is not garanteed to be compatible with 1.\+10 and newer versions.

Here are the available commands\+: 
\begin{DoxyItemize}
\item \hyperlink{evasfiltersref_sec_syntax}{Syntax}  
\item \hyperlink{evasfiltersref_sec_buffers}{Buffer management}  
\begin{DoxyItemize}
\item \hyperlink{evasfiltersref_sec_buffers_cspace}{Colorspaces}  
\item \hyperlink{evasfiltersref_sec_buffers_auto}{Automatic buffers}  
\item \hyperlink{evasfiltersref_sec_buffers_cmd}{{\ttfamily buffer} command}  
\end{DoxyItemize}
\item \hyperlink{evasfiltersref_sec_commands}{Commands}  
\begin{DoxyItemize}
\item \hyperlink{evasfiltersref_sec_commands_blend}{{\ttfamily blend} command} 
\item \hyperlink{evasfiltersref_sec_commands_blur}{{\ttfamily blur} command} 
\item \hyperlink{evasfiltersref_sec_commands_grow}{{\ttfamily grow} command} 
\item \hyperlink{evasfiltersref_sec_commands_curve}{{\ttfamily curve} command} 
\item \hyperlink{evasfiltersref_sec_commands_fill}{{\ttfamily fill} command} 
\item \hyperlink{evasfiltersref_sec_commands_mask}{{\ttfamily mask} command} 
\item \hyperlink{evasfiltersref_sec_commands_bump}{{\ttfamily bump} command} 
\item \hyperlink{evasfiltersref_sec_commands_displace}{{\ttfamily displace} command} 
\item \hyperlink{evasfiltersref_sec_commands_transform}{{\ttfamily transform} command} 
\end{DoxyItemize}
\end{DoxyItemize}

All the examples in this page can (should) be directly used in evas\+\_\+obj\+\_\+text\+\_\+filter\+\_\+program\+\_\+set.

Note that most of the text effects work better with larger font sizes ($>$ 50px), and so do the examples in this page (embedded devices in mind).\hypertarget{evasfiltersref_sec_syntax}{}\section{Syntax}\label{evasfiltersref_sec_syntax}
Here is a simple example illustrating the syntax\+:


\begin{DoxyVerbInclude}
\end{DoxyVerbInclude}


This example will display a cyan and dark blue glow surrounding the main text (its color depends on the object\textquotesingle{}s theme).

\begin{center}  \end{center} 

The syntax is pretty simple and follows a small set of rules\+: 
\begin{DoxyItemize}
\item All dimensions are in pixels 
\item The commands will be executed in sequential order 
\item Most commands have default values 
\item A command argument can either be set by name, or sequentially omitting the name. So that\+:~\newline
 \begin{DoxyVerb}function (arg1, arg2, arg3) \end{DoxyVerb}
 
\item is equivalent to\+:~\newline
 \begin{DoxyVerb}function ({ arg1, arg2, arg2 }) \end{DoxyVerb}
 
\item or even (considering opt1, opt2 and opt3 are the first 3 arguments)\+:~\newline
 \begin{DoxyVerb}function ({ opt1 = arg1, opt2 = arg2, opt3 = arg3 }) \end{DoxyVerb}
 
\item and since this is Lua, we can also write it as\+:~\newline
 \begin{DoxyVerb}function { arg1, opt3 = arg3, opt2 = arg2 } \end{DoxyVerb}
 
\item Boolean values are {\ttfamily true/{\ttfamily false} but} 1/0 and special string values are also accepted\+: \textquotesingle{}yes\textquotesingle{}/\textquotesingle{}no\textquotesingle{}, \textquotesingle{}enabled\textquotesingle{}/\textquotesingle{}disabled\textquotesingle{} 
\end{DoxyItemize}

\subsubsection*{Special keywords and their values}

Some options accept a certain set of values (like enums)\+: 
\begin{DoxyItemize}
\item {\ttfamily color} \label{evasfiltersref_evasfilters_color}%
\hypertarget{evasfiltersref_evasfilters_color}{}%
 
\begin{DoxyItemize}
\item Colors can be referred to by strings or integers\+: 
\item An integer can refer to any R\+G\+B or A\+R\+G\+B values\+: {\ttfamily 0x\+R\+R\+G\+G\+B\+B} or {\ttfamily 0x\+A\+A\+R\+R\+G\+G\+B\+B}. If alpha is zero, the color will be opaque (alpha = {\ttfamily 0x\+F\+F}), unless R=G=B=0 (invisible). These colors are {\bfseries not} premultiplied.  
\item Hexademical values\+: {\ttfamily \textquotesingle{}\#\+R\+R\+G\+G\+B\+B\textquotesingle{}}, {\ttfamily \textquotesingle{}\#\+R\+R\+G\+G\+B\+B\+A\+A\textquotesingle{}}, {\ttfamily \textquotesingle{}\#\+R\+G\+B\textquotesingle{}}, {\ttfamily \textquotesingle{}\#\+R\+G\+B\+A\textquotesingle{}} 
\item The following string values are also accepted\+: {\ttfamily 
\begin{DoxyItemize}
\item \textquotesingle{}white\textquotesingle{} == \textquotesingle{}\#\+F\+F\+F\+F\+F\+F\textquotesingle{} 
\item \textquotesingle{}black\textquotesingle{} == \textquotesingle{}\#000000\textquotesingle{} 
\item \textquotesingle{}red\textquotesingle{} == \textquotesingle{}\#\+F\+F0000\textquotesingle{} 
\item \textquotesingle{}green\textquotesingle{} == \textquotesingle{}\#008000\textquotesingle{} 
\item \textquotesingle{}blue\textquotesingle{} == \textquotesingle{}\#0000\+F\+F\textquotesingle{} 
\item \textquotesingle{}darkblue\textquotesingle{} == \textquotesingle{}\#0000\+A0\textquotesingle{} 
\item \textquotesingle{}yellow\textquotesingle{} == \textquotesingle{}\#\+F\+F\+F\+F00\textquotesingle{} 
\item \textquotesingle{}magenta\textquotesingle{} == \textquotesingle{}\#\+F\+F00\+F\+F\textquotesingle{} 
\item \textquotesingle{}cyan\textquotesingle{} == \textquotesingle{}\#00\+F\+F\+F\+F\textquotesingle{} 
\item \textquotesingle{}orange\textquotesingle{} == \textquotesingle{}\#\+F\+F\+A500\textquotesingle{} 
\item \textquotesingle{}purple\textquotesingle{} == \textquotesingle{}\#800080\textquotesingle{} 
\item \textquotesingle{}brown\textquotesingle{} == \textquotesingle{}\#\+A52\+A2\+A\textquotesingle{} 
\item \textquotesingle{}maroon\textquotesingle{} == \textquotesingle{}\#800000\textquotesingle{} 
\item \textquotesingle{}lime\textquotesingle{} == \textquotesingle{}\#00\+F\+F00\textquotesingle{} 
\item \textquotesingle{}gray\textquotesingle{} == \textquotesingle{}\#808080\textquotesingle{} 
\item \textquotesingle{}grey\textquotesingle{} == \textquotesingle{}\#808080\textquotesingle{} 
\item \textquotesingle{}silver\textquotesingle{} == \textquotesingle{}\#\+C0\+C0\+C0\textquotesingle{} 
\item \textquotesingle{}olive\textquotesingle{} == \textquotesingle{}\#808000\textquotesingle{} 
\item \textquotesingle{}invisible\textquotesingle{}, \textquotesingle{}transparent\textquotesingle{} == \textquotesingle{}\#0000\textquotesingle{} -- (alpha is zero) 
\end{DoxyItemize}} 
\end{DoxyItemize}
\item {\ttfamily fillmode} \label{evasfiltersref_evasfilter_fillmode}%
\hypertarget{evasfiltersref_evasfilter_fillmode}{}%
 {\ttfamily 
\begin{DoxyItemize}
\item \textquotesingle{}none\textquotesingle{} 
\item \textquotesingle{}stretch\+\_\+x\textquotesingle{} 
\item \textquotesingle{}stretch\+\_\+y\textquotesingle{} 
\item \textquotesingle{}repeat\+\_\+x\textquotesingle{} 
\item \textquotesingle{}repeat\+\_\+y\textquotesingle{} 
\item \textquotesingle{}repeat\+\_\+x\+\_\+stretch\+\_\+y\textquotesingle{}, \textquotesingle{}stretch\+\_\+y\+\_\+repeat\+\_\+x\textquotesingle{} 
\item \textquotesingle{}repeat\+\_\+y\+\_\+stretch\+\_\+x\textquotesingle{}, \textquotesingle{}stretch\+\_\+x\+\_\+repeat\+\_\+y\textquotesingle{} 
\item \textquotesingle{}repeat\textquotesingle{}, \textquotesingle{}repeat\+\_\+xy\textquotesingle{} 
\item \textquotesingle{}stretch\textquotesingle{}, \textquotesingle{}stretch\+\_\+xy\textquotesingle{} 
\end{DoxyItemize}} 
\end{DoxyItemize}\hypertarget{evasfiltersref_sec_buffers}{}\section{Buffer management}\label{evasfiltersref_sec_buffers}
The Evas filters subsystem is based on the concept of using various buffers as image layers and drawing or applying filters to these buffers. Think of it as how image drawing tools like The Gimp can combine multiple layers and apply operations on them.

Most of the buffers are allocated automatically at runtime, depending on the various inputs and commands used (eg. 2-\/\+D blur will require a temporary intermediate buffer).\hypertarget{evasfiltersref_sec_buffers_cspace}{}\subsection{Colorspaces and size}\label{evasfiltersref_sec_buffers_cspace}
The buffers\textquotesingle{} size will be automatically defined at runtime, based on the content of the input and the series of operations to apply (eg. blur adds some necessary margins).

The buffers can be either A\+L\+P\+H\+A (1 color channel only) or R\+G\+B\+A (full color). Some operations might require specifically an A\+L\+P\+H\+A buffer, some others R\+G\+B\+A.

Most buffers will have the same size, except those specified by an external source.\hypertarget{evasfiltersref_sec_buffers_auto}{}\subsection{Automatic buffers}\label{evasfiltersref_sec_buffers_auto}
The two most important buffers, input and output, are statically defined and always present when running a filter. input is an A\+L\+P\+H\+A buffer, containing the \hyperlink{group__Evas__Object__Text}{Text Object}\textquotesingle{}s rendered text, and output is the final target on which to render as R\+G\+B\+A.

Some operations, like 2-\/\+D blur might require temporary intermediate buffers, that will be allocated automatically. Those buffers are internal only and can\textquotesingle{}t be used from the script.

Finally, if a buffer is created using another Evas Object as source (see \hyperlink{evasfiltersref_sec_buffers_cmd}{buffer} for more details), its pixel data will be filled by rendering the Evas Object into this buffer. This is how it will be possible to load external images, textures and even animations into a buffer.

\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_buffers_cmd}{}\subsection{Buffer command}\label{evasfiltersref_sec_buffers_cmd}
Create a new buffer.

\begin{DoxyVerb}name1 = buffer()
name2 = buffer("alpha")
name3 = buffer("rgba")
name4 = buffer({ type = "rgba" })
name5 = buffer({ src = "partname" })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em type} & Buffer type\+: {\ttfamily rgba} (default) or {\ttfamily alpha} \\
\hline
{\em src} & An optional source. If set, {\itshape type} will be {\ttfamily rgba}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A new buffer. This value must not be saved to a variable.
\end{DoxyReturn}
This creates a new named buffer, specify its colorspace or source. Possible options\+: \begin{DoxyItemize}
\item {\ttfamily alpha\+:} Create an alpha-\/only buffer (1 channel, no color) \item {\ttfamily rgba\+:} Create an R\+G\+B\+A buffer (4 channels, full color) \item {\ttfamily \{src = \char`\"{}partname\char`\"{}\}}\+: Use another {\ttfamily Evas Object} as source for this buffer\textquotesingle{}s pixels. The name can either be an Edje part name or the one specified in {\ttfamily evas\+\_\+obj\+\_\+text\+\_\+filter\+\_\+source\+\_\+set}.\end{DoxyItemize}
If no option is given, an R\+G\+B\+A buffer will be created. All buffers have the same size, unless they are based on an external source.

\begin{DoxySeeAlso}{See also}
evas\+\_\+obj\+\_\+text\+\_\+filter\+\_\+source\+\_\+set
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\+10
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands}{}\section{Filter commands}\label{evasfiltersref_sec_commands}
This section will present the various filter instructions, their syntax and their effects.\hypertarget{evasfiltersref_sec_commands_blend}{}\subsection{Blend}\label{evasfiltersref_sec_commands_blend}
Blend a buffer onto another. This is the simplest filter, as it just renders one buffer on another, potentially using a color, an offset and fill options.

\begin{DoxyVerb}blend ({ src = input, dst = output, ox = 0, oy = 0, color = 'white', fillmode = 'none' })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em src} & Source buffer to blend. \\
\hline
{\em dst} & Destination buffer for blending. \\
\hline
{\em ox} & X offset. Moves the buffer to the right (ox $>$ 0) or to the left (ox $<$ 0) by N pixels. \\
\hline
{\em oy} & Y offset. Moves the buffer to the bottom (oy $>$ 0) or to the top (oy $<$ 0) by N pixels. \\
\hline
{\em color} & A color to use for alpha to R\+G\+B\+A conversion. See \hyperlink{evasfiltersref_evasfilters_color}{colors}. ~\newline
 If the input is an alpha buffer and the output is R\+G\+B\+A, this will draw the buffer in this color. If both buffers are R\+G\+B\+A, this will have no effect. \\
\hline
{\em fillmode} & Map the input onto the whole surface of the output by stretching or repeating it. See \hyperlink{evasfiltersref_evasfilter_fillmode}{fillmodes}.\\
\hline
\end{DoxyParams}
If {\itshape src} is an alpha buffer and {\itshape dst} is an R\+G\+B\+A buffer, then the {\itshape color} option should be set.


\begin{DoxyVerbInclude}
\end{DoxyVerbInclude}


\begin{center}  \end{center} 

\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands_blur}{}\subsection{Blur}\label{evasfiltersref_sec_commands_blur}
Apply blur effect on a buffer (box or gaussian).

\begin{DoxyVerb}blur ({ rx = 3, ry = nil, type = 'default', ox = 0, oy = 0, color = 'white', src = input, dst = output })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em rx} & X radius. Specifies the radius of the blurring kernel (X direction). \\
\hline
{\em ry} & Y radius. Specifies the radius of the blurring kernel (Y direction). If -\/1 is used, then {\itshape ry} = {\itshape rx}. \\
\hline
{\em type} & Blur type to apply. One of {\ttfamily default}, {\ttfamily box} or {\ttfamily gaussian}. See below for details about {\ttfamily default}. \\
\hline
{\em ox} & X offset. Moves the buffer to the right ({\itshape ox} $>$ 0) or to the left ({\itshape ox} $<$ 0) by N pixels. \\
\hline
{\em oy} & Y offset. Moves the buffer to the bottom ({\itshape oy} $>$ 0) or to the top ({\itshape oy} $<$ 0) by N pixels. \\
\hline
{\em color} & A color to use for alpha to R\+G\+B\+A conversion. See \hyperlink{evasfiltersref_evasfilters_color}{colors}. ~\newline
 If the input is an alpha buffer and the output is R\+G\+B\+A, this will draw the buffer in this color. \\
\hline
{\em src} & Source buffer to blur. \\
\hline
{\em dst} & Destination buffer for blending. \\
\hline
{\em count} & Number of times to repeat the blur. Only valid with {\ttfamily box} blur. Valid range is\+: 1 to 6.\\
\hline
\end{DoxyParams}
The blur type {\ttfamily default} is {\bfseries recommended in all situations} as it will select the smoothest and fastest operation possible depending on the kernel size. Instead of running a real gaussian blur, 2 or 3 box blurs may be chained to produce a similar effect at a much higher speed. The value {\itshape count} can be set to a value from 1 to 6 if blur type {\ttfamily box} has been specified.

The speedups of {\ttfamily box} over {\ttfamily gaussian} are of orders of 4x to more than 20x faster.

If {\itshape src} is an alpha buffer and {\itshape dst} is an R\+G\+B\+A buffer, then the color option should be set.

{\itshape ox} and {\itshape oy} can be used to move the blurry output by a few pixels, like a drop shadow. Example\+: 
\begin{DoxyVerbInclude}
\end{DoxyVerbInclude}


\begin{center}  \end{center} 

\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands_bump}{}\subsection{Bump}\label{evasfiltersref_sec_commands_bump}
Apply a light effect (ambient light, specular reflection and shadows) based on a bump map.

This can be used to give a relief effect on the object.

\begin{DoxyVerb}bump ({ map, azimuth = 135.0, elevation = 45.0, depth = 8.0, specular = 0.0,
        color = 'white', compensate = false, src = input, dst = output,
        black = 'black', white = 'white', fillmode = 'repeat' })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em map} & An alpha buffer treated like a Z map for the light effect (bump map). Must be specified. \\
\hline
{\em azimuth} & The angle between the light vector and the X axis in the X\+Y plane (Z = 0). 135.\+0 means 45 degrees from the top-\/left. Counter-\/clockwise notation. \\
\hline
{\em elevation} & The angle between the light vector and the Z axis. 45.\+0 means 45 degrees to the screen\textquotesingle{}s plane. Ranges from 0 to 90 only. \\
\hline
{\em depth} & The depth of the object in an arbitrary unit. More depth means the shadows will be stronger. Default is 8.\+0. \\
\hline
{\em specular} & An arbitrary unit for the specular light effect. Default is 0.\+0, but a common value would be 40.\+0. \\
\hline
{\em color} & The main color of the object if src is an alpha buffer. This represents the light\textquotesingle{}s normal color. See \hyperlink{evasfiltersref_evasfilters_color}{colors}. \\
\hline
{\em compensate} & If set to true, compensate for whitening or darkening on flat surfaces. Default is false but it is recommended if specular light is wanted. \\
\hline
{\em src} & Source buffer. This should be an alpha buffer. \\
\hline
{\em dst} & Destination buffer. This should be an R\+G\+B\+A buffer (although alpha is supported). Must be of the same size as {\itshape src}. \\
\hline
{\em black} & The shadows\textquotesingle{} color. Usually this will be black ({\ttfamily \#000}). \\
\hline
{\em white} & The specular light\textquotesingle{}s color. Usually this will be white ({\ttfamily \#\+F\+F\+F}). \\
\hline
{\em fillmode} & This specifies how to handle {\itshape map} when its dimensions don\textquotesingle{}t match those of {\itshape src} and {\itshape dst}. Default is to {\ttfamily repeat}. See \hyperlink{evasfiltersref_evasfilter_fillmode}{fillmodes}.\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
As of 2014/02/11, the A\+L\+P\+H\+A to R\+G\+B\+A support is of much better quality than A\+L\+P\+H\+A only, but {\bfseries very} slow. R\+G\+B\+A sources are not supported yet.
\end{DoxyNote}
Here is a full example of a very simple bevel effect\+: 
\begin{DoxyVerbInclude}
\end{DoxyVerbInclude}


\begin{center}  \end{center} 

\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands_curve}{}\subsection{Curve}\label{evasfiltersref_sec_commands_curve}
Apply a color curve to a specific channel in a buffer.

\begin{DoxyVerb}curve ({ points, interpolation = 'linear', channel = 'rgb', src = input, dst = output })
\end{DoxyVerb}


Modify the colors of a buffer. This applies a color curve y = f(x) to every pixel.


\begin{DoxyParams}{Parameters}
{\em points} & The color curve to apply. See below for the syntax. \\
\hline
{\em interpolation} & How to interpolate between points. One of {\ttfamily linear} (y = ax + b) or {\ttfamily none} (y = Yk). \\
\hline
{\em channel} & Target channel for the color modification. One of {\ttfamily R(ed)}, {\ttfamily G(reen)}, {\ttfamily B(lue)}, {\ttfamily A(lpha)}, {\ttfamily R\+G\+B} and {\ttfamily R\+G\+B\+A}. If {\itshape src} is an alpha buffer, this parameter will be ignored. \\
\hline
{\em src} & Source buffer. \\
\hline
{\em dst} & Destination buffer, must be of same dimensions and color space as {\itshape src}.\\
\hline
\end{DoxyParams}
The {\itshape points} argument contains a list of (X,Y) points in the range 0..255, describing a function {\ttfamily f(x) = y} to apply to all pixel values.

The syntax of this {\itshape points} string is {\ttfamily \textquotesingle{}x1\+:y1 -\/ x2\+:y2 -\/ x3\+:y3 -\/ ... -\/ xn\+:yn\textquotesingle{}} (remember that all spaces are discarded). The points {\ttfamily xn} are in {\itshape increasing} order\+: {\ttfamily x1 $<$ x2 $<$ x3 $<$ ... $<$ xn}, and all values {\ttfamily xn} or {\ttfamily yn} are within the range 0..255.

The identity curve is then described as {\ttfamily \textquotesingle{}0\+:0-\/255\+:255\textquotesingle{}}, with linear interpolation\+: \begin{DoxyVerb}curve ({ points = '0:0 - 255:255', interpolation = linear })
\end{DoxyVerb}
 If ignored, y(x = 0) is 0 and y(x = 255) is 255.

The following example will generate a 4px thick stroke around text letters\+: 
\begin{DoxyVerbInclude}
\end{DoxyVerbInclude}


\begin{center}  \end{center} 

The curve command can be used to alter the output of a blur operation.

\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands_displace}{}\subsection{Displace}\label{evasfiltersref_sec_commands_displace}
Apply a displacement map on a buffer.

\begin{DoxyVerb}displace ({ map, intensity = 10, flags = 0, src = input, dst = output, fillmode = 'repeat' })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em map} & An R\+G\+B\+A buffer containing a displacement map. See below for more details. \\
\hline
{\em intensity} & Maximum distance for the displacement. This means 0 and 255 will represent a displacement of {\ttfamily intensity} pixels. \\
\hline
{\em flags} & One of {\ttfamily default}, {\ttfamily nearest}, {\ttfamily smooth}, {\ttfamily nearest\+\_\+stretch} or {\ttfamily smooth\+\_\+stretch}. This defines how pixels should be treated when going out of the {\itshape src} image bounds. {\ttfamily default} is equivalent to {\ttfamily smooth\+\_\+stretch}. \\
\hline
{\em src} & Source buffer \\
\hline
{\em dst} & Destination buffer. Must be of same color format and size as {\itshape src}. \\
\hline
{\em fillmode} & Defines how to handle cases where the map has a different size from {\itshape src} and {\itshape dst}. It should be a combination of {\ttfamily stretch} or {\ttfamily repeat\+:} {\ttfamily none} is not supported. See \hyperlink{evasfiltersref_evasfilter_fillmode}{fillmodes}.\\
\hline
\end{DoxyParams}
\subsubsection*{Displacement map}

The {\itshape map} buffer is an R\+G\+B\+A image containing displacement and alpha values. Its size can be different from {\ttfamily src} or {\ttfamily dst}.

The {\bfseries red} channel is used for X displacements while the {\bfseries green} channel is used for Y displacements. All subpixel values are in the range 0..255. A value of 128 means 0 displacement, lower means displace to the top/left and higher than 128 displace to the bottom/right.

If {\ttfamily signed char} is used instead of {\ttfamily unsigned char} to represent these R and G values, then $<$ 0 means displace top/left while $>$ 0 means bottom/right.

The {\ttfamily alpha} channel is used as an alpha multiplier for blending.

Considering {\ttfamily I(x, y)} represents the pixel at position (x, y) in the image I, then here is how the displacement is applied to {\itshape dst\+:} \begin{DoxyVerb}D = map (x, y)
dst (x, y) = D.alpha * src (x + (D.red - 128) * intensity / 128, y + (D.green - 128) * intensity / 128) / 255 + (255 - D.alpha) * dst (x, y) / 255
\end{DoxyVerb}
 Of course, the real algorithm takes into account interpolation between pixels as well.

\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands_fill}{}\subsection{Fill}\label{evasfiltersref_sec_commands_fill}
Fill a buffer with a specific color. Not blending, can be used to clear a buffer.

\begin{DoxyVerb}fill ({ dst = output, color = 'transparent', l = 0, r = 0, t = 0, b = 0 })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em dst} & Target buffer to fill with {\itshape color}. \\
\hline
{\em color} & The color used to fill the buffer. All pixels within the fill area will be reset to this value. See \hyperlink{evasfiltersref_evasfilters_color}{colors}. \\
\hline
{\em l} & Left padding\+: skip {\itshape l} pixels from the left border of the buffer \\
\hline
{\em r} & Right padding\+: skip {\itshape r} pixels from the right border of the buffer \\
\hline
{\em t} & Top padding\+: skip {\itshape t} pixels from the top border of the buffer \\
\hline
{\em b} & Bottom padding\+: skip {\itshape b} pixels from the bottom border of the buffer\\
\hline
\end{DoxyParams}
This function should generally not be used, except for\+: 
\begin{DoxyItemize}
\item {\itshape Testing} an effect over a specific background color 
\item Clearing out a buffer with either white or transparent color 
\end{DoxyItemize}

\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands_grow}{}\subsection{Grow}\label{evasfiltersref_sec_commands_grow}
Grow or shrink a buffer\textquotesingle{}s contents. This is not a zoom effect.

\begin{DoxyVerb}grow ({ radius, smooth = true, src = input, dst = output })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em radius} & The radius of the grow kernel. If a negative value is specified, the contents will shrink rather than grow. \\
\hline
{\em smooth} & If {\ttfamily true}, use a smooth transitions between black and white (smooth blur and smoother curve). \\
\hline
{\em src} & Source buffer to blur. \\
\hline
{\em dst} & Destination buffer for blending. This must be of same size and colorspace as {\itshape src}.\\
\hline
\end{DoxyParams}
Example\+: 
\begin{DoxyVerbInclude}
\end{DoxyVerbInclude}


This will first grow the letters in the buffer {\ttfamily input} by a few pixels, and then draw this buffer in black in the background.

\begin{center}  \end{center} 

\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands_mask}{}\subsection{Mask}\label{evasfiltersref_sec_commands_mask}
Blend two input buffers into a third (target).

\begin{DoxyVerb}mask ({ mask, src = input, dst = output, color = 'white', fillmode = 'repeat' })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em mask} & A mask or texture to blend with the input {\itshape src} into the target {\itshape dst}. \\
\hline
{\em src} & Source buffer. This can also be thought of a mask if {\itshape src} is alpha and {\itshape mask} is R\+G\+B\+A. \\
\hline
{\em dst} & Destination buffer for blending. This must be of same size and colorspace as {\itshape src}. \\
\hline
{\em color} & A color to use for alpha to R\+G\+B\+A conversion for the blend operations. White means no change. See \hyperlink{evasfiltersref_evasfilters_color}{colors}. This will have no effect on R\+G\+B\+A sources. \\
\hline
{\em fillmode} & Defines whether to stretch or repeat the {\itshape mask} if its size that of . Should be set when masking with external textures. Default is repeat. See \hyperlink{evasfiltersref_evasfilter_fillmode}{fillmodes}.\\
\hline
\end{DoxyParams}
Note that {\itshape src} and {\itshape mask} are interchangeable, if they have the same dimensions.

Example\+: 
\begin{DoxyVerbInclude}
\end{DoxyVerbInclude}


This will create an inner shadow effect.

\begin{center}  \end{center} 

\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands_transform}{}\subsection{Transform}\label{evasfiltersref_sec_commands_transform}
Apply a geometrical transformation to a buffer.

Right now, only {\bfseries vertical flip} is implemented and available. This operation does not blend and assumes the destination buffer is empty.

\begin{DoxyVerb}transform ({ dst, op = 'vflip', src = input, oy = 0 })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em dst} & Destination buffer. Must be of the same colorspace as {\itshape src}. Must be specified. \\
\hline
{\em op} & Must be {\ttfamily \textquotesingle{}vflip\textquotesingle{}}. There is no other operation yet. \\
\hline
{\em src} & Source buffer to transform. \\
\hline
{\em oy} & Y offset.\\
\hline
\end{DoxyParams}
Example\+: 
\begin{DoxyVerbInclude}
\end{DoxyVerbInclude}


This will create a mirrored text effect, for a font of 50px.

\begin{center}  \end{center} 

\begin{DoxyNote}{Note}
Because of the meaning of {\itshape oy}, this effect probably needs to be customized for a single font size (F\+I\+X\+M\+E).
\end{DoxyNote}
\begin{DoxySince}{Since}
1.\+9
\end{DoxySince}
\hypertarget{evasfiltersref_sec_commands_padding_set}{}\subsection{Padding\+\_\+\+Set}\label{evasfiltersref_sec_commands_padding_set}
Forcily set a specific padding for this filter.

\begin{DoxyVerb}padding_set ({ l, r = [l], t = [r], b = [t] })
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em l} & Padding on the left side in pixels. \\
\hline
{\em r} & Padding on the right side in pixels. If unset, defaults to {\itshape l}. \\
\hline
{\em t} & Padding on the top in pixels. If unset, defaults to {\itshape r}. \\
\hline
{\em b} & Padding on the bottom in pixels. If unset, defaults to {\itshape t}.\\
\hline
\end{DoxyParams}
All values must be $>$= 0. When filtering \textquotesingle{}filled\textquotesingle{} images, some values may be too high and would result in completely hiding the image.

It is not possible to set only one of those without forcing the others as well. A common use case will be when changing a blur size during an animation, or when applying a mask that will hide most of the (blurred) text.

Example (the {\ttfamily fill} command is used for illustration purposes)\+: 
\begin{DoxyVerbInclude}
\end{DoxyVerbInclude}


This will set the left, right, top and bottom paddings to their respective values, and some effects may look like they\textquotesingle{}ve been \char`\"{}clipped\char`\"{} out.

\begin{center}  \end{center} 

\begin{DoxySince}{Since}
1.\+10 
\end{DoxySince}
