Add a new module in Evas to implement text effects.
The basic idea is to create some buffers (alpha/rgba),
draw some text into them, and apply various filters in a
sequential way.
A small script language allows you to set a filter to a
text object. This can then be passed through an Eo API
or using Edje directly (under the field description.text.filter).
Right now, the software engine should work fine, but GL rendering
suffers from a few limitations (no scaling and no proxy rendering,
which means a few effects might not work well).
More documentation will follow, and examples as well.
But, please bear in mind: this is a HIGHLY EXPERIMENTAL feature.
I'm including it to EFL 1.9 so that people can play with it,
but it should not be considered stable at this point in time.
Well, proxy sources are rendered to a... GL texture! But we
actually want the image pixels. So we'll need to call glReadPixels
to get them.
Yes, it will be horribly slow. But there isn't really a way around.
This will require a new internal API. For now, just disable the
feature. Hopefully I can make it work soon enough for the release?
If source_set was called after program_set, then parsing would fail.
It used to work because the program was re-parsed at source_set.
Now, save the code, mark the filter as changed, and reparse again
if the source changed (keep track of invalid programs to avoid
excessive parsing).
In async mode, the filter runs in the render thread, so can't
allocate buffers on the fly.
This case should not happen, unless maybe a source has a null
size (eg. it's invisible and not properly rendered).
Proxy sources & objects were not properly unset.
This results either in crashes (especially in the Edje tests)
or dangling objects with tons of references.
Remove the refcount increase/decrease, as it is redundant.
Store pairs proxy+source instead of just the source in all hashes,
so we can unset the is_proxy flag on the proxy when there are no
sources anymore.
Remove compilation warnings: we don't really need cubic
interpolation at this point, we can still add it back
later if wanted.
Also, make it clear that buffer #2 is the output buffer.
Remove meaningless FIXME.
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.