forked from old/legacy-imlib2
parent
1a457d0029
commit
b595fe6a65
174
doc/index.html
174
doc/index.html
|
@ -1976,9 +1976,17 @@ and <b>b</b> defines the vertical amplitude.</blockquote>
|
|||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_image_filter(void);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>Imlib_Filter imlib_create_filter(int initsize);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_free_filter(void);</font></font></tt></b></pre>
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_filter_set(int xoff,
|
||||
int yoff,
|
||||
|
@ -1987,6 +1995,9 @@ and <b>b</b> defines the vertical amplitude.</blockquote>
|
|||
int g,
|
||||
int b);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_filter_set_alpha(int xoff,
|
||||
int yoff,
|
||||
int a,
|
||||
|
@ -1994,6 +2005,9 @@ and <b>b</b> defines the vertical amplitude.</blockquote>
|
|||
int g,
|
||||
int b);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_filter_set_red(int xoff,
|
||||
int yoff,
|
||||
int a,
|
||||
|
@ -2001,6 +2015,9 @@ and <b>b</b> defines the vertical amplitude.</blockquote>
|
|||
int g,
|
||||
int b);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_filter_set_green(int xoff,
|
||||
int yoff,
|
||||
int a,
|
||||
|
@ -2008,6 +2025,9 @@ and <b>b</b> defines the vertical amplitude.</blockquote>
|
|||
int g,
|
||||
int b);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_filter_set_blue(int xoff,
|
||||
int yoff,
|
||||
int a,
|
||||
|
@ -2015,17 +2035,171 @@ and <b>b</b> defines the vertical amplitude.</blockquote>
|
|||
int g,
|
||||
int b);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_filter_constants(int a,
|
||||
int r,
|
||||
int g,
|
||||
int b);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_filter_divisors(int a,
|
||||
int r,
|
||||
int g,
|
||||
int b);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_apply_filter( char *script, ... );</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
<b>Imlib 2 Dynamic Filters</b>
|
||||
<p>
|
||||
Imlib2 has built in features allowing filters and effects to be applied at
|
||||
run time through a very small scripting language, this is similar to that
|
||||
of script-fu found in the GIMP (http://www.gimp.org). There are two parts
|
||||
to the system, the client library call ``imlib_apply_filter'' and the
|
||||
library side filters. The library side filters are synonymous with image
|
||||
loaders.
|
||||
<p>
|
||||
To run a script on an image you need to set the context image then call:
|
||||
<p>
|
||||
<blockquote>
|
||||
<pre>
|
||||
imlib_apply_filter( script_string, ... );
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
The script_string variable is made up of the script language, which is
|
||||
very simple and made up of only function calls. Functions calls look like
|
||||
this:
|
||||
<p>
|
||||
<blockquote>
|
||||
<pre>
|
||||
filter name( key=value [, ...] );
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
Where,
|
||||
<p>
|
||||
<blockquote>
|
||||
<b>filter name</b> is the name of the filter you wish to apply<br>
|
||||
<b>key</b> is an expected value<br>
|
||||
<b>value</b> is a ``string'', a number, or an actual variable in<br>
|
||||
</blockquote>
|
||||
<p>
|
||||
the program, or the result of another filter.
|
||||
<p>
|
||||
eg.
|
||||
<p>
|
||||
<blockquote>
|
||||
<pre>
|
||||
bump_map( map=tint(red=50,tint=200), blue=10 );
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
This example would bump map using a a map generated from the tint filter.
|
||||
<p>
|
||||
It is also possible to pass application information to the filters via the
|
||||
usage of the [] operator. When the script is being compiled the sciprt
|
||||
engine looks on the paramters passed to it and picks up a pointer for
|
||||
every [] found.
|
||||
<p>
|
||||
eg2.
|
||||
<p>
|
||||
<blockquote>
|
||||
<pre>
|
||||
imlib_apply_filter( "tint( x=[], y=[], red=255, alpha=55 );", &myxint, &myyint );
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
This will cause a tint to the current image at (myxint,myyint) to be
|
||||
done. This is very useful for when you want the filters to dynamically
|
||||
change acording to program variables.
|
||||
The system is very quick as the code is psuedo-compiled and then run. The
|
||||
advantage of having the scripting system allows customisation of the image
|
||||
manipulations, this is particularily useful in applications that allow
|
||||
modifcations to be done (eg. image viewers).
|
||||
<p>
|
||||
<b>Filter Library</b>
|
||||
<p>
|
||||
There are three functions that must be in every filter library
|
||||
<p>
|
||||
<blockquote>
|
||||
<pre>
|
||||
void init( struct imlib_filter_info *info ); - Called once on loading of the filter
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
info - a structure passed to the filter to be filled in with information about the filter
|
||||
info->name - Name of the filter library<br>
|
||||
info->author - Name of the library author<br>
|
||||
info->description - Description of the filter library<br>
|
||||
info->num_filters - Number of filters the library exports<br>
|
||||
info->filters - An array of ``char *'' with each filter name in it.<br>
|
||||
<p>
|
||||
<blockquote>
|
||||
<pre>
|
||||
void deinit(); - Called when the filter is closed
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
<blockquote>
|
||||
<pre>
|
||||
void *exec( char *filter, void *im, pIFunctionParam params ); - Called every time a filter the library exports is called
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
filter - The name of the filter being asked for
|
||||
im - The image that the filter should be applied against
|
||||
params - A linked list of parameters.
|
||||
<p>
|
||||
The best way to get all the values is such:
|
||||
<blockquote>
|
||||
Declare all parameters and initialise them to there default values.
|
||||
<blockquote>
|
||||
<pre>
|
||||
for( ptr = params; ptr != NULL; ptr = ptr->next )
|
||||
{
|
||||
..MACRO TO GET VALUE..
|
||||
}
|
||||
</pre>
|
||||
</blockquote>
|
||||
Current Macros are:
|
||||
<blockquote>
|
||||
<pre>
|
||||
ASSIGN_INT( keyname, local variable )
|
||||
ASSIGN_DATA8( keyname, local variable )
|
||||
ASSIGN_IMAGE( keyname, local variable )
|
||||
</pre>
|
||||
</blockquote>
|
||||
eg.
|
||||
<blockquote>
|
||||
<pre>
|
||||
int r = 50;
|
||||
IFunctionParam *ptr;
|
||||
|
||||
for( ptr = params; ptr != NULL; ptr = ptr->next )
|
||||
{
|
||||
ASSIGN_INT( "red", r );
|
||||
}
|
||||
</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p>
|
||||
If the value "red" is not passed to the filter then it will remain
|
||||
at 50, but it a value is passed, it will be assign to r.
|
||||
<p>
|
||||
return type - Imlib_Image, this is the result of filter.
|
||||
<p>
|
||||
|
||||
</td>
|
||||
|
||||
<td><img SRC="blank.gif" height=1 width=1></td>
|
||||
|
|
Loading…
Reference in New Issue