Commit Graph

85 Commits

Author SHA1 Message Date
Jean-Philippe Andre d00378edcf Edje/evas filters: Add filter.source support
This should preserve ABI stability with earlier versions of
edje_cc while still providing more advanced control over
proxy bindings for evas filters from EDC.

Also fix proxy binding for filters.

@feature
2015-06-25 14:36:09 +09:00
Jean-Philippe Andre 4882788527 Evas filters: Reduce debugging with default compile opts
When using debug compile flags, full-on filter debug will happen.
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre f3e16bc485 Evas filters: Implement Lua classes for colors & buffer
Reuse previous code for buffer. Keeps API stability.

The new class "color" is here for a more convenient color
representation. This way, colors can be represented in more
natural ways like: {r,g,b[,a]}, 0xaarrggbb, "red", "#rrggbb"

Class color is implemented in pure Lua, and adds a .lua file
to Evas' share folder.
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre 93797e3b0d Evas filters: Create specific log domain
This will improve the debug output of evas and specifically
allow setting "evas_filter" log level to a higher or lower
value depending on what you are debugging :)
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre 225c0f937a Evas filters: Pass edje state name & value to the filters
From Edje, pass the current state info (name and value) as well
as the next state and the transition position when applicable.
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre 4ade39c0ea Evas filters: Pass object scale to Lua state 2015-06-25 14:36:08 +09:00
Jean-Philippe Andre 70efb699a5 Evas filters: Implement table & function support for curve
Now the points can be specified by passing a table or a proper Lua
function. The previous functionality (parsing a string) is still
valid.
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre 1b2819f2cb Evas filters: Implement __index for Lua buffer objects 2015-06-25 14:36:08 +09:00
Jean-Philippe Andre ffea07a049 Evas filters: Pass text colors to the parser
This does not implement the full feature yet (Lua variable
is not set). This commit also brings various fixes.
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre d148c0f0d2 Evas filters: Fix runtime, allow state change on the fly
Now we're ready to implement runtime changes to the filters'
state (color classes, edje state, etc...), as the Lua function
will be run whenver required.
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre 148a886cc7 Evas filters: Refactor parser code
This is to prepare the changeable states (animation, color, scale...)

- Remove use of Eina_Value (simplifies code)
- Use proper Lua type for buffers (with pretty __tostring)
   This adds the buffer methods: width, height, type, name, source
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre c25467ff5c Evas filters: Implement very basic print function 2015-06-25 14:36:08 +09:00
Jean-Philippe Andre 2faaef966e Evas filters: Add internal function _program_run
This will allow changing the state of the filter and re-run it
without re-creating the Lua_State object. This is to handle size,
color, animation state and scale changes (amongst other things).
2015-06-25 14:36:08 +09:00
Jean-Philippe ANDRE e096a3490b Evas filters: Fix parsing of argument lists
Make check would even fail on 32bit machines because of that:
Lua tables are not arrays and lua_next doesn't ensure the order
of the elements as I wrongly assumed.

@fix
Fixes T1615
2014-09-19 10:33:24 +09:00
Jean-Philippe Andre 793e2ee21e Evas filters: Report parsing error message from lua
Also, re-enable legacy code compatibility layer, as it
can still be used for compat with older code.
2014-06-11 10:02:42 +09:00
Jean-Philippe Andre f731f8ffb4 Evas filters: Fix NULL dereference (legacy_strdup)
CID 1210809
CID 1210813

+ remove comment
2014-05-14 18:42:05 +09:00
Jean-Philippe Andre 2a5b3e2482 Evas filters: Fix NULL dereferences
CID 1210807
CID 1210808
2014-05-14 18:39:53 +09:00
Jean-Philippe Andre 8c8816aca6 Evas filters: Fix some parsing errors 2014-05-09 16:57:39 +09:00
Jean-Philippe Andre 139f7bc178 Evas doc: Add example for padding_set (filters)
With preview and all.
2014-05-09 16:57:39 +09:00
Jean-Philippe Andre 87e09ff25e Evas doc: Move filters reference doc to Lua
Part 2: improve doc design, translate examples to Lua syntax and
        add a few words about Lua itself.
2014-05-09 16:57:39 +09:00
Jean-Philippe Andre 8a1b335bb1 Evas doc: Move filters examples to Lua
Part 1: auto-generated examples with previews
2014-05-09 16:57:39 +09:00
Jérémy Zurcher 9a79d1e864 silence a few warnings 2014-05-08 00:15:53 +02:00
Cedric Bail d590ad8041 evas: reuse buffer instead of leaking it.
CID 1210816
2014-05-04 00:18:55 +02:00
Jean-Philippe Andre 27650fb94a Evas filters: Fix parsing of instructions with unnamed arguments 2014-04-30 14:52:39 +09:00
Jean-Philippe Andre 64baafe176 Evas filters: Premultiply colors after parsing integers 2014-04-30 14:52:39 +09:00
Jean-Philippe Andre 59cf013db9 Evas filters: Add support for Evas_Object_Image
This adds filter support to Image objects as well.
The exact same filters can run on Text and on Images
(provided some colorspace limitations are respected).

This basically adds:
- Support for RGBA input buffer
- Eo entry points for Image filter support
- Implement basic filter support in Evas_Image
2014-04-27 17:41:40 +09:00
Jean-Philippe Andre de4969ccb2 Evas filters: Remove legacy code
The compatibility layer and Lua implementation are now complete.
2014-04-27 17:40:55 +09:00
Jean-Philippe Andre 103d8d08fa Evas filters: switch script language to Lua
It was a pretty stupid idea to write a parser for a custom language
when we already have Lua as a dependency and it's so beautiful and
easy.

There is a fallback function to allow for compatibility with legacy
filters. But that broken syntax is not recommended. I'll probably
remove it soon.

All the test cases I have in my example app work fine with this
compatibily layer.
2014-04-27 17:40:55 +09:00
Jean-Philippe Andre 27d97110cc Evas filters: Default mask fillmode should be repeat
Fillmode "NONE" has basically no practical use and shouldn't be
the default.
2014-03-26 10:48:12 +09:00
Jean-Philippe Andre 7e731ea10a Evas filters: Ignore ox,oy when stretching in the same direction
During padding calculation, ox and oy should be ignored unless the
blend operation is neither repeating nor stretching. Otherwise,
the buffer will grow without necessity.
2014-03-26 10:48:12 +09:00
Jean-Philippe Andre 91a471b4dc Evas filters: Add new instruction padding_set
This will allow forcing a specific value for the filter padding,
instead of relying on auto calculation.

Two advantages:
- Auto calculation can't be perfect, since it will add as much
  padding as required for the full blur effect
- This prepares the path for animations with effects, where the
  object size does not change over time
2014-03-21 15:23:02 +09:00
Jean-Philippe Andre 2a1ba1b908 Evas filters: Use box blur by default
BOX blur is a lot faster (and easier to optimize, too)
than GAUSSIAN blur. Repeating 2x or 3x BOX blur will also
give similar results to GAUSSIAN blur (very smooth), but
in much less time.

Add a count parameter to the BOX blur instruction.
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre a37a1d458d Evas filters: Fix uninitialized variable warning 2014-03-12 14:08:02 +09:00
Jean-Philippe Andre cc21f8f173 Evas filters: Clean up some duplicate includes
No functional change
2014-03-04 13:58:53 +09:00
Jean-Philippe ANDRE 7f63b4a3eb Evas filters: Avoid CRI message when using the GL engine
A CRItical message was always displayed when setting a filter
on a text object, saying that proxy rendering is not supported on GL.

Reduce CRI to ERR and skip proxy rendering altogether if there are
no proxy sources.

This @fix needs to be backported.

Thanks zmike for reporting this.

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2014-03-04 10:37:03 +09:00
Jean-Philippe Andre afcbabb004 Doc: Fix filters documentation
Since the doc mentions colors in the examples, fix it to match the
new dox theme :)
2014-02-24 11:18:10 +09:00
Jean-Philippe Andre bdb3ccd1dd Evas filters: Add a note to the transform doc
This is a special operation, with a simplistic implementation.
2014-02-20 13:27:43 +09:00
Jean-Philippe Andre c256bdc367 Evas filters: Fix documentation for color with rgba buffers
The documentation said color was used as a multiplier, but in
reality the image drawing functions don't use the context's
color when drawing. So the color is only defined for Alpha -> RGBA
operations.
2014-02-20 13:27:43 +09:00
Jean-Philippe Andre 74d8403217 Evas filters: Grow filter should gracefully blend
If grow() was used on top of another effect, it was simply
erasing all pixels. We need to use a temporary buffer and
blend it to the output.
2014-02-20 13:27:42 +09:00
Jean-Philippe Andre 0d9ffc2624 Evas filters: Fix padding in blur with offset
Test case was: blur(ox=40, rx=40);
This would crop the blurred text instead of having proper padding.
2014-02-20 13:27:42 +09:00
Jean-Philippe Andre 8a694314a4 Evas filters: Fix options parsing
Test case "blend() blend();" did not fail when it should have.
Also, return an error if the program was empty (all whitespaces).
2014-02-20 13:27:42 +09:00
Jean-Philippe Andre ddf267e506 Evas filters: Fix padding in blur filter
The wrong value was used for the command's padding.
Also, remove mention of "motion" blur which is not
implemented.
2014-02-20 13:27:42 +09:00
Jean-Philippe Andre 126cbbc7a9 Evas filters: Mark parser functions as EAPI for tests
The filter unit test case will directly call the parser functions.
2014-02-20 13:27:42 +09:00
Jean-Philippe Andre 6067c88b56 Evas filters: Use strtok instead of strtok_r for mingw
The Windows build (mingw) does not know about strtok_r.
So, let's use the non-safe variant strtok instead.
Currently, this function is called from the main thread only,
so this should be fine :)

In the future it would be nice to not use strtok anymore,
but strtok_r everywhere, and add it to evil. Considering the
release coming soon, I'm not going to change something like that
now.
2014-02-19 11:30:11 +09:00
Jean-Philippe Andre 54129dfcaa Evas filters: Fix documentation for displace
fillmode "none" is not supported, as it does not make much sense
(how do we displace pixels without an underlying displacement map?)
2014-02-18 10:22:50 +09:00
Jean-Philippe Andre ded097461d Evas filters: Fix padding with "blend"
Test case was:
buffer : a (alpha);
blur (20, dst = a);
blend (src = a, ox = 30);

In that case, padding was 20, 30, 20, 20.
So the blurred buffer was clipped on screen.
2014-02-18 10:22:50 +09:00
Jean-Philippe Andre 7cf02ca75b Evas filters doc: Add link to "fillmode" 2014-02-18 10:22:50 +09:00
Jean-Philippe Andre a4ecf34316 Evas filters: More clang fixes
NULL ptr dereference.
2014-02-14 13:06:05 +09:00
Jean-Philippe Andre 6642d16a7d Evas filters: Fix more clang stuff and add safety checks
The prepare function should not fail, unless something is very
wrong. Also, return NULL instead of EINA_FALSE.
2014-02-14 13:06:00 +09:00
Carsten Haitzler c7aa6039c8 evas filter - fix uninitialized pointer in evas
fixes CID 1174077
2014-02-13 19:05:43 +09:00