Use the mapped rendering to implement repeat and stretch
with rgba to alpha buffers blending.
If stretch is required, it will add one more (expensive)
scaling step.
This patch implements the final draw from RGBA_Image to the
OpenGL surface. We can even steal the output buffer and
redraw it quickly, without having to re-render everything
(same as in SW).
Since the filters will have to decide on which engine (SW, GL) to
choose from to render the font and the effects, move the font
draw call inside the filters module.
Quick and dirty solution to support the OpenGL engine:
[1] Allocate CPU buffers
[2] Render text and process all effects to these buffers
[3] Push final image as an OpenGL texture.
This patch implements [1].
Well, raster did some great job at optimizing font draw... but only
to RGBA32 targets. In this font effects case, we also want to render
text on ALPHA buffers.
For now, reuse the existing alpha blending & glyph decompress
functions. It's MUCH easier, and works. Definitely slower than
decompressing on-the-fly and optimizing everything. But for now,
this will not even be the performance bottleneck in an effect
(blur will be a lot slower).
It is not possible to logically handle padding and offset at the same
time for a proper mirror effect, unless this is handled directly at the
transformation level.
Also, add support for blend() operation padding computation.
This is the simplest solution I can come up with for "mirror" effects.
Displacement maps are HARD to generate and use properly, since the buffer
size is unknown until runtime.
Even if we align the map to the text itself (using the padding information),
it's still hard to describe properly how to apply the displacement map, and
to generate it... So let's just add a simple flip operation.
The displacement effect is way too complicated. Let's keep it
simple and have only one displacement map format (RG + Alpha).
Here's what's missing now:
- Alpha support, to blend in the input with a variable intensity
- Extra padding (see below)
Also, the intensity VS. map values are not perfectly defined yet.
Problems: How to create a complete mirror effect (map needs to go
over boundaries... add extra padding to the buffers).
This is the first possible optimization: save the rendered
text (since we already have the output buffer anyways), and
reuse it if the text + filter didn't change.
Add parameters l, r, t, b to clip the fill area.
While l=x and t=y, the width and height of the clip are determined
at filter run-time, since we don't know the buffer size before.
Brutal method for now: allocate YET ANOTHER buffer,
render scaled image to it (smooth scaling, oh yeah),
use this as a new mask.
For now, supports:
Alpha Input, RGBA mask, RGBA output, X,Y,XY stretching
Syntax was: buffer(name=bla,alpha=bool);
Changed to: buffer:bla(alpha);
There's a semicolon between buffer and its name because ALL whitespaces
are discarded. This might prove useful sometime in the future, so let's
keep it this way for now :)
Padding was brutally calculated by suming ALL the filters'
individual paddings. Now we try to be a bit smarter and propagate
the padding between buffers in the filter chain.
If the buffer is smaller than the blur kernel, then artifacts appear
and CRASHES happen because we read/write out of the buffer bounds.
Output buffer must be larger than the kernel diameter.
Input buffer's size is used to reduce the blurring effect on the edges.
malloc() and mmap() don't return empty buffers, so blending on top
will present tons of artifacts.
Visible mostly on very small buffers as they are malloc()'ed from
previously used memory segments.
So, the (font) effects will be described by a string. It's
basically a new language (yeah yeah sorry), VERY simple, based
on function calls a la Python, with sequential and named arguments.
This string is intended to be passed directly to an evas text object
and embedded into the evas textblock's markup tags.
This file implements both the basic parsing functions, the
compilation of instructions into a queue of commands, and the glue
code for the rest of the filter infrastructure.
These bump maps implement two light effects at once:
- 3D Shadows
- Specular lights
The specular light is activated by a flag.
Another flag enables compensation for darkening/whitening of
horizontal surfaces.
NOTE: This implementation is VERY SLOW.
It uses double values and divisions all over the place.
It might be possible to optimize by computing two LUTs before
running the algorithm.
Displacement maps are a simple but powerful tool to move pixels
around in a buffer, based on a displacement map (image).
Currently, various modes are implemented:
- X, Y or XY displacement
- Alpha map or RGBA map where R and G only are used
An intensity parameter is given as well.
Some of these might not be useful, we can just strip them off when
the final API is decided.
Color curves are a very simple tool to alter the colors of an image,
on a per-pixel basis. This implementation will simply map each pixel
to a 256 bytes buffer, provided by the application.
NOTE: There are no convenience functions yet for easy curve
generation, but this is the plan (give point A, B, B and interpolate
between them to generate the 256 values array).
Currently supported:
- Box blur for Alpha and RGBA
- Gaussian blur for Alpha and RGBA
Motion blur is not implemented.
These effects are SLOW. Gaussian blur is based on a true gaussian
curve for small radii, or a sine-based approximation.
The true gaussian might need to be removed for consistency, since
it gives slightly different results from the sine one (less blur).
It is not possible to mix Alpha and RGBA surfaces in this filter.
These functions differ from normal blending as they will use
a mask on top of input and output buffers.
So, basically they blend input+mask into a third buffer output.
If output is RGBA then mask or input MUST be RGBA.
evas_filter.c contains the entry points for the evas filters subsystem,
in particular, the filter API, the (yet very basic) buffer management
system, the command queue and main context handling functions.
Right now, the Evas engine is left untouched, so these implementations
will work ONLY in the software engine.
NOTE: This will not compile on its own (thus, not added to Makefile.am),
as it will require the filter implementations to be linked.