2013-12-08 22:54:48 -08:00
# ifndef _EVAS_FILTER_H
# define _EVAS_FILTER_H
# include "evas_common_private.h"
2014-01-16 20:32:25 -08:00
# include "evas_private.h"
2013-12-08 22:54:48 -08:00
2016-12-22 02:41:04 -08:00
# include "efl_canvas_filter_internal.eo.h"
2015-04-28 05:24:11 -07:00
# ifdef EAPI
# undef EAPI
# endif
# ifdef _WIN32
2018-01-18 01:04:03 -08:00
# ifdef EFL_BUILD
2015-04-28 05:24:11 -07:00
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
2018-01-18 01:04:03 -08:00
# endif
2015-04-28 05:24:11 -07:00
# else
# define EAPI __declspec(dllimport)
2018-01-18 01:04:03 -08:00
# endif
2015-04-28 05:24:11 -07:00
# else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
# else
# define EAPI
# endif
2018-01-18 01:04:03 -08:00
# endif
2015-04-28 05:24:11 -07:00
2017-08-02 04:00:49 -07:00
# ifdef DEBUG
2017-04-12 20:08:31 -07:00
# define FILTERS_DEBUG
2017-08-02 04:00:49 -07:00
# endif
2017-04-12 20:08:31 -07:00
2013-12-08 22:54:48 -08:00
typedef struct _Evas_Filter_Instruction Evas_Filter_Instruction ;
typedef struct _Evas_Filter_Buffer Evas_Filter_Buffer ;
2014-02-05 03:09:05 -08:00
typedef struct _Evas_Filter_Proxy_Binding Evas_Filter_Proxy_Binding ;
2017-03-14 22:49:50 -07:00
typedef struct _Evas_Filter_Padding Evas_Filter_Padding ;
2013-12-08 22:54:48 -08:00
typedef enum _Evas_Filter_Mode Evas_Filter_Mode ;
typedef enum _Evas_Filter_Blur_Type Evas_Filter_Blur_Type ;
typedef enum _Evas_Filter_Channel Evas_Filter_Channel ;
typedef enum _Evas_Filter_Displacement_Flags Evas_Filter_Displacement_Flags ;
typedef enum _Evas_Filter_Bump_Flags Evas_Filter_Bump_Flags ;
2013-12-30 23:01:06 -08:00
typedef enum _Evas_Filter_Fill_Mode Evas_Filter_Fill_Mode ;
2014-01-06 23:44:10 -08:00
typedef enum _Evas_Filter_Transform_Flags Evas_Filter_Transform_Flags ;
2013-12-08 22:54:48 -08:00
2014-03-03 22:17:11 -08:00
typedef void ( * Evas_Filter_Cb ) ( Evas_Filter_Context * ctx , void * data , Eina_Bool success ) ;
2013-12-08 22:54:48 -08:00
# define EVAS_FILTER_BUFFER_RGBA EINA_FALSE
# define EVAS_FILTER_BUFFER_ALPHA EINA_TRUE
2014-02-03 19:32:15 -08:00
# define EVAS_FILTER_BUFFER_INPUT_ID 1
# define EVAS_FILTER_BUFFER_OUTPUT_ID 2
2015-05-25 22:58:56 -07:00
/** @internal */
2013-12-08 22:54:48 -08:00
enum _Evas_Filter_Mode
{
2017-01-23 00:55:17 -08:00
EVAS_FILTER_MODE_SKIP , /**< No operation */
2013-12-08 22:54:48 -08:00
EVAS_FILTER_MODE_BLEND , /**< Blend with current context render_op */
EVAS_FILTER_MODE_BLUR , /**< @see Evas_Filter_Blur_Type */
EVAS_FILTER_MODE_CURVE , /**< Apply color curve */
EVAS_FILTER_MODE_DISPLACE , /**< Apply XY displacement based on RG mask */
2013-12-12 00:46:46 -08:00
EVAS_FILTER_MODE_FILL , /**< Fill a buffer with a solid color */
2013-12-08 22:54:48 -08:00
EVAS_FILTER_MODE_MASK , /**< Apply Alpha or RGBA texture on image */
EVAS_FILTER_MODE_BUMP , /**< Apply bump mapping (light effect) */
2014-01-06 23:44:10 -08:00
EVAS_FILTER_MODE_TRANSFORM , /**< Apply a simple geometrical transformation */
2014-03-20 19:52:52 -07:00
EVAS_FILTER_MODE_PADDING_SET , /**< Special padding_set instruction to force a specific padding value */
2019-09-26 23:30:36 -07:00
EVAS_FILTER_MODE_GRAYSCALE , /**< Leave only grayscale information */
2013-12-08 22:54:48 -08:00
EVAS_FILTER_MODE_LAST
} ;
2015-05-25 22:58:56 -07:00
/** @internal */
2013-12-08 22:54:48 -08:00
enum _Evas_Filter_Blur_Type
{
2014-03-11 02:21:46 -07:00
EVAS_FILTER_BLUR_DEFAULT = 0x0 , // Default blur (GAUSSIAN or series of BOX)
2014-01-07 18:12:03 -08:00
EVAS_FILTER_BLUR_BOX = 0x1 , // Optimizable on CPU. But, UGLY. O(n)
2014-03-11 02:21:46 -07:00
EVAS_FILTER_BLUR_GAUSSIAN = 0x2 , // Gaussian blur (using sine curve)
2013-12-08 22:54:48 -08:00
EVAS_FILTER_BLUR_LAST ,
} ;
2015-05-25 22:58:56 -07:00
/** @internal */
2013-12-08 22:54:48 -08:00
enum _Evas_Filter_Channel
{
EVAS_FILTER_CHANNEL_ALPHA = 0 ,
EVAS_FILTER_CHANNEL_RED = 1 ,
EVAS_FILTER_CHANNEL_GREEN = 2 ,
EVAS_FILTER_CHANNEL_BLUE = 3 ,
EVAS_FILTER_CHANNEL_RGB = 4
} ;
2015-05-25 22:58:56 -07:00
/** @internal */
2013-12-08 22:54:48 -08:00
enum _Evas_Filter_Displacement_Flags
{
EVAS_FILTER_DISPLACE_NEAREST = 0x0 , /**< Interpolate between pixels (linear interpolation) */
2014-01-06 17:16:39 -08:00
EVAS_FILTER_DISPLACE_LINEAR = 0x1 , /**< Interpolate between pixels (linear interpolation) */
2013-12-08 22:54:48 -08:00
EVAS_FILTER_DISPLACE_BLACK = 0x0 , /**< Use black (or transparent) when going out of bounds) */
2014-01-06 17:16:39 -08:00
EVAS_FILTER_DISPLACE_STRETCH = 0x2 , /**< Stretch border pixels when going out of bounds */
EVAS_FILTER_DISPLACE_BITMASK = 0x3
2013-12-08 22:54:48 -08:00
} ;
2015-05-25 22:58:56 -07:00
/** @internal */
2013-12-08 22:54:48 -08:00
enum _Evas_Filter_Bump_Flags
{
EVAS_FILTER_BUMP_NORMAL = 0x0 ,
EVAS_FILTER_BUMP_COMPENSATE = 0x1 /**< Compensate for darkening (diffuse light) or brightening (specular light) of zero gradient surfaces */
} ;
2015-05-25 22:58:56 -07:00
/** @internal */
2013-12-30 23:01:06 -08:00
enum _Evas_Filter_Fill_Mode
{
EVAS_FILTER_FILL_MODE_NONE = 0x0 ,
EVAS_FILTER_FILL_MODE_STRETCH_X = 0x1 ,
EVAS_FILTER_FILL_MODE_STRETCH_Y = 0x2 ,
EVAS_FILTER_FILL_MODE_REPEAT_X = 0x4 ,
EVAS_FILTER_FILL_MODE_REPEAT_Y = 0x8 ,
EVAS_FILTER_FILL_MODE_REPEAT_X_STRETCH_Y = EVAS_FILTER_FILL_MODE_REPEAT_X | EVAS_FILTER_FILL_MODE_STRETCH_Y ,
EVAS_FILTER_FILL_MODE_REPEAT_Y_STRETCH_X = EVAS_FILTER_FILL_MODE_REPEAT_Y | EVAS_FILTER_FILL_MODE_STRETCH_X ,
EVAS_FILTER_FILL_MODE_REPEAT_XY = EVAS_FILTER_FILL_MODE_REPEAT_X | EVAS_FILTER_FILL_MODE_REPEAT_Y ,
EVAS_FILTER_FILL_MODE_STRETCH_XY = EVAS_FILTER_FILL_MODE_STRETCH_X | EVAS_FILTER_FILL_MODE_STRETCH_Y
} ;
2015-05-25 22:58:56 -07:00
/** @internal */
2014-01-06 23:44:10 -08:00
enum _Evas_Filter_Transform_Flags
{
EVAS_FILTER_TRANSFORM_VFLIP = 1
} ;
2017-03-14 22:49:50 -07:00
/** @internal */
struct _Evas_Filter_Padding
{
int l , r , t , b ;
} ;
2016-12-22 02:41:04 -08:00
# define EFL_CANVAS_FILTER_STATE_DEFAULT { {}, { 255, 255, 255, 255 }, { "default", 0.0 }, {}, 0, 0, 1.0, 0.0 }
2013-12-08 22:54:48 -08:00
/* Parser stuff (high level API) */
2014-03-17 00:10:03 -07:00
EAPI Evas_Filter_Program * evas_filter_program_new ( const char * name , Eina_Bool input_alpha ) ;
2016-12-22 02:41:04 -08:00
EAPI Eina_Bool evas_filter_program_state_set ( Evas_Filter_Program * pgm , const Efl_Canvas_Filter_State * state ) ;
2014-02-17 19:02:45 -08:00
EAPI Eina_Bool evas_filter_program_parse ( Evas_Filter_Program * pgm , const char * str ) ;
EAPI void evas_filter_program_del ( Evas_Filter_Program * pgm ) ;
2017-03-14 22:49:50 -07:00
EAPI Eina_Bool evas_filter_program_padding_get ( Evas_Filter_Program * pgm , Evas_Filter_Padding * final , Evas_Filter_Padding * calc ) ;
2014-02-17 19:02:45 -08:00
EAPI void evas_filter_program_source_set_all ( Evas_Filter_Program * pgm , Eina_Hash * sources ) ;
2015-06-23 00:40:51 -07:00
void evas_filter_program_data_set_all ( Evas_Filter_Program * pgm , Eina_Inlist * data ) ;
2013-12-08 22:54:48 -08:00
/* Filter context (low level) */
2017-01-05 04:29:32 -08:00
Evas_Filter_Context * evas_filter_context_new ( Evas_Public_Data * evas , Eina_Bool async , void * user_data ) ;
void * evas_filter_context_data_get ( Evas_Filter_Context * ctx ) ;
Eina_Bool evas_filter_context_async_get ( Evas_Filter_Context * ctx ) ;
2017-03-22 00:55:26 -07:00
void evas_filter_context_size_get ( Evas_Filter_Context * ctx , int * w , int * H ) ;
2017-09-04 03:08:02 -07:00
int evas_filter_context_ref ( Evas_Filter_Context * ctx ) ;
void evas_filter_context_unref ( Evas_Filter_Context * ctx ) ;
2017-08-25 10:51:53 -07:00
Eina_Bool evas_filter_context_program_use ( void * engine , void * output , Evas_Filter_Context * ctx , Evas_Filter_Program * pgm , Eina_Bool reuse , int object_x , int object_y ) ;
2017-08-25 10:52:29 -07:00
void evas_filter_context_proxy_render_all ( Evas_Filter_Context * ctx , Eo * eo_obj , void * output , Eina_Bool do_async ) ;
2013-12-08 22:54:48 -08:00
void evas_filter_context_post_run_callback_set ( Evas_Filter_Context * ctx , Evas_Filter_Cb cb , void * data ) ;
2015-05-18 01:35:49 -07:00
Eina_Bool evas_filter_context_buffers_allocate_all ( Evas_Filter_Context * ctx ) ;
2017-03-14 22:49:50 -07:00
void evas_filter_context_obscured_region_set ( Evas_Filter_Context * ctx , Eina_Rectangle rect ) ;
2013-12-08 22:54:48 -08:00
2017-03-22 00:55:26 -07:00
int evas_filter_buffer_empty_new ( Evas_Filter_Context * ctx , int w , int h , Eina_Bool alpha_only ) ;
int evas_filter_buffer_proxy_new ( Evas_Filter_Context * ctx , Evas_Filter_Proxy_Binding * pb , int * w , int * h ) ;
2017-03-22 00:16:22 -07:00
void * evas_filter_buffer_backing_get ( Evas_Filter_Context * ctx , int bufid , Eina_Bool render ) ;
2017-04-02 23:34:10 -07:00
Eina_Bool evas_filter_buffer_backing_set ( Evas_Filter_Context * ctx , int bufid , void * engine_buffer ) ;
2014-01-22 21:58:05 -08:00
2017-08-25 10:51:53 -07:00
Eina_Bool evas_filter_context_run ( void * engine , void * output , Evas_Filter_Context * ctx ) ;
2013-12-08 22:54:48 -08:00
2017-05-12 15:03:05 -07:00
Eina_Bool evas_filter_font_draw ( Evas_Filter_Context * ctx , void * engine , void * output , void * draw_context , int bufid , Evas_Font_Set * font , int x , int y , Evas_Text_Props * text_props , Eina_Bool do_async ) ;
2017-04-03 22:28:29 -07:00
Eina_Bool evas_filter_target_set ( Evas_Filter_Context * ctx , void * draw_context , void * surface , int x , int y , const RGBA_Map * map ) ;
2014-01-16 20:32:25 -08:00
2017-01-05 00:56:04 -08:00
// utility function
void _evas_filter_source_hash_free_cb ( void * data ) ;
2013-12-08 22:54:48 -08:00
/**
* @ brief Blend a source buffer into a destination buffer , allowing X , Y offsets , Alpha to RGBA conversion with color
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context . Current color is used when inbuf is ALPHA and outbuf is RGBA .
* @ param inbuf Source buffer : ALPHA or RGBA
* @ param outbuf Destination buffer : ALPHA or RGBA ( note : must be RGBA if inbuf is RGBA )
* @ param ox X offset in the destination buffer
* @ param oy Y offset in the destination buffer
2013-12-31 00:51:09 -08:00
* @ param fillmode Specifies whether to repeat or stretch the input onto its destination , and on which axes
2017-12-14 00:22:09 -08:00
* @ param alphaonly If true , discard RGB during RGBA - > Alpha conversions .
2013-12-08 22:54:48 -08:00
* @ return Filter command ID or - 1 in case of error
2015-05-25 22:58:56 -07:00
* @ internal
2013-12-08 22:54:48 -08:00
*/
2017-12-14 00:22:09 -08:00
Evas_Filter_Command * evas_filter_command_blend_add ( Evas_Filter_Context * ctx , void * draw_context , int inbuf , int outbuf , int ox , int oy , Evas_Filter_Fill_Mode fillmode , Eina_Bool alphaonly ) ;
2013-12-08 22:54:48 -08:00
/**
* @ brief Apply a blur effect on a buffer
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context . Current color is used when inbuf is ALPHA and outbuf is RGBA .
* @ param inbuf Source buffer : ALPHA or RGBA
* @ param outbuf Destination buffer : ALPHA or RGBA ( note : must be RGBA if inbuf is RGBA )
* @ param type Type of blur : BOX , GAUSSIAN or MOTION
* @ param dx X radius of blur . Can be negative ONLY for MOTION blur
* @ param dy Y radius of blur . Can be negative ONLY for MOTION blur
* @ param ox X offset in the destination buffer
* @ param oy Y offset in the destination buffer
2014-03-11 02:21:46 -07:00
* @ param count Number of times to repeat the operation ( used for smooth fast blurs with box blur )
2017-12-14 00:22:09 -08:00
* @ param alphaonly If true , discard RGB during RGBA - > Alpha conversions .
2013-12-08 22:54:48 -08:00
* @ return Filter command ID or - 1 in case of error
2015-05-25 22:58:56 -07:00
* @ internal
2013-12-08 22:54:48 -08:00
*/
2017-12-14 00:22:09 -08:00
Evas_Filter_Command * evas_filter_command_blur_add ( Evas_Filter_Context * ctx , void * draw_context , int inbuf , int outbuf , Evas_Filter_Blur_Type type , int dx , int dy , int ox , int oy , int count , Eina_Bool alphaonly ) ;
2013-12-08 22:54:48 -08:00
2013-12-12 00:46:46 -08:00
/**
* @ brief Fill a buffer with the current color
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context . Current color is used when buf is RGBA , and clip is used to specify the fill area .
* @ param buf Buffer : ALPHA or RGBA
* @ return Filter command ID or - 1 in case of error
* @ note The current draw context ' s render operation is ignored ( always uses COPY mode ) .
2015-05-25 22:58:56 -07:00
* @ internal
2013-12-12 00:46:46 -08:00
*/
evas filters: Refactor ector and gfx filters A LOT
Alright, so this is a massive patch that is the result of
trying to get rid of unused or poorly implemented classes in
ector. Originally ector was meant to support VG but extend to
things like filters as well. At the moment, ector's design
makes it quite hard to plug in the filters.
For now I think it's easier to implement the GL support for
the filters directly in the engine, where I hope to interfere
as little as possible.
This massive patch keeps only the required minimum to support
a versatile gl buffer that can be mapped, drawn or rendered to (FBO).
It's extremely inefficient as it relies on glReadPixels and lots
of texture uploads, as well as conversions between ARGB and Alpha.
Another type of GL buffer is a wrap around an existing GL image,
but that one is read-only (map or draw: no write map, no FBO).
No, all the filters run fine, and the high-level implementation
(evas_filters.c) does not need to know whether the underlying engine
is SW or GL. One problem though appears with the blending or blurring
of some Alpha buffers, the colors are wrong.
This patch removes more lines than it adds so it must be good ;)
2017-01-17 18:47:25 -08:00
Evas_Filter_Command * evas_filter_command_fill_add ( Evas_Filter_Context * ctx , void * draw_context , int buf ) ;
2014-01-01 22:57:44 -08:00
/**
* @ brief evas_filter_command_curve_add
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context . Current color is used when buf is RGBA , and clip is used to specify the fill area .
* @ param inbuf Input buffer , ALPHA or RGBA .
* @ param outbuf Output buffer , must have same colorspace as inbuf .
* @ param curve The data points to use , must contain 256 values .
* @ param channel Which channel to apply the curve ( red , green , blue , alpha or RGB )
* @ return Filter command ID or - 1 in case of error
2015-05-25 22:58:56 -07:00
* @ internal
2014-01-01 22:57:44 -08:00
*/
evas filters: Refactor ector and gfx filters A LOT
Alright, so this is a massive patch that is the result of
trying to get rid of unused or poorly implemented classes in
ector. Originally ector was meant to support VG but extend to
things like filters as well. At the moment, ector's design
makes it quite hard to plug in the filters.
For now I think it's easier to implement the GL support for
the filters directly in the engine, where I hope to interfere
as little as possible.
This massive patch keeps only the required minimum to support
a versatile gl buffer that can be mapped, drawn or rendered to (FBO).
It's extremely inefficient as it relies on glReadPixels and lots
of texture uploads, as well as conversions between ARGB and Alpha.
Another type of GL buffer is a wrap around an existing GL image,
but that one is read-only (map or draw: no write map, no FBO).
No, all the filters run fine, and the high-level implementation
(evas_filters.c) does not need to know whether the underlying engine
is SW or GL. One problem though appears with the blending or blurring
of some Alpha buffers, the colors are wrong.
This patch removes more lines than it adds so it must be good ;)
2017-01-17 18:47:25 -08:00
Evas_Filter_Command * evas_filter_command_curve_add ( Evas_Filter_Context * ctx , void * draw_context , int inbuf , int outbuf , DATA8 * curve /* 256 elements */ , Evas_Filter_Channel channel ) ;
2013-12-12 00:46:46 -08:00
2013-12-08 22:54:48 -08:00
/**
* @ brief Grow / Shrink an image , as defined in image processing ( this is not a scale algorithm ! )
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context . Current color is used when inbuf is ALPHA and outbuf is RGBA .
* @ param inbuf Source buffer : ALPHA or RGBA
* @ param outbuf Destination buffer : ALPHA or RGBA ( note : must be RGBA if inbuf is RGBA )
* @ param radius Number of pixels to grow by . If negative , shrink instead of grow
* @ param smooth Use smooth blur and curve for grow ( default : true )
2017-12-14 00:22:09 -08:00
* @ param alphaonly If true , discard RGB during RGBA - > Alpha conversions .
2013-12-08 22:54:48 -08:00
* @ return Filter command ID or - 1 in case of error
2015-05-25 22:58:56 -07:00
* @ internal
2013-12-08 22:54:48 -08:00
*/
2017-12-14 00:22:09 -08:00
Evas_Filter_Command * evas_filter_command_grow_add ( Evas_Filter_Context * ctx , void * draw_context , int inbuf , int outbuf , int radius , Eina_Bool smooth , Eina_Bool alphaonly ) ;
2013-12-08 22:54:48 -08:00
/**
* @ brief Apply a displacement map to a buffer . This will move pixels from the source to the destination based on pixel per pixel offset , as defined in the displacement map
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context ( ignored )
* @ param inbuf Input buffer ( Alpha or RGBA )
* @ param outbuf Output buffer ( Alpha or RGBA ) , same size as inbuf
* @ param dispbuf Displacement map . Should be an RGBA buffer , where the Red and Green channels are the displacement maps for X and Y . Can be also ALPHA buffer , in which case only one dimension can be specified ( X or Y ) .
* @ param flags Alters how the map is interpreted , @ see Evas_Filter_Displacement_Flags
* @ param intensity Maximum offset possible , if the map ' s value is maximal at this point ( ie . 0 or 255 )
2013-12-31 00:51:09 -08:00
* @ param fillmode Specifies how to repeat and stretch the map to fit the target size
2013-12-08 22:54:48 -08:00
* @ return Filter command ID or - 1 in case of error
2015-05-25 22:58:56 -07:00
* @ internal
2013-12-08 22:54:48 -08:00
*/
evas filters: Refactor ector and gfx filters A LOT
Alright, so this is a massive patch that is the result of
trying to get rid of unused or poorly implemented classes in
ector. Originally ector was meant to support VG but extend to
things like filters as well. At the moment, ector's design
makes it quite hard to plug in the filters.
For now I think it's easier to implement the GL support for
the filters directly in the engine, where I hope to interfere
as little as possible.
This massive patch keeps only the required minimum to support
a versatile gl buffer that can be mapped, drawn or rendered to (FBO).
It's extremely inefficient as it relies on glReadPixels and lots
of texture uploads, as well as conversions between ARGB and Alpha.
Another type of GL buffer is a wrap around an existing GL image,
but that one is read-only (map or draw: no write map, no FBO).
No, all the filters run fine, and the high-level implementation
(evas_filters.c) does not need to know whether the underlying engine
is SW or GL. One problem though appears with the blending or blurring
of some Alpha buffers, the colors are wrong.
This patch removes more lines than it adds so it must be good ;)
2017-01-17 18:47:25 -08:00
Evas_Filter_Command * evas_filter_command_displacement_map_add ( Evas_Filter_Context * ctx , void * draw_context , int inbuf , int outbuf , int dispbuf , Evas_Filter_Displacement_Flags flags , int intensity , Evas_Filter_Fill_Mode fillmode ) ;
2013-12-08 22:54:48 -08:00
/**
* @ brief Apply a texture to a buffer
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context ( ignored )
* @ param inbuf Input buffer ( Alpha or RGBA )
* @ param maskbuf Texture buffer ( Alpha or RGBA )
* @ param outbuf Output buffer ( Alpha or RGBA )
2013-12-31 00:51:09 -08:00
* @ param fillmode Specifies how to repeat and stretch the mask to fit the target size
2013-12-08 22:54:48 -08:00
* @ return Filter command ID or - 1 in case of error
* @ note For the moment , inbuf can only be ALPHA , and output must be RGBA if mask is RGBA as well
2015-05-25 22:58:56 -07:00
* @ internal
2013-12-08 22:54:48 -08:00
*/
evas filters: Refactor ector and gfx filters A LOT
Alright, so this is a massive patch that is the result of
trying to get rid of unused or poorly implemented classes in
ector. Originally ector was meant to support VG but extend to
things like filters as well. At the moment, ector's design
makes it quite hard to plug in the filters.
For now I think it's easier to implement the GL support for
the filters directly in the engine, where I hope to interfere
as little as possible.
This massive patch keeps only the required minimum to support
a versatile gl buffer that can be mapped, drawn or rendered to (FBO).
It's extremely inefficient as it relies on glReadPixels and lots
of texture uploads, as well as conversions between ARGB and Alpha.
Another type of GL buffer is a wrap around an existing GL image,
but that one is read-only (map or draw: no write map, no FBO).
No, all the filters run fine, and the high-level implementation
(evas_filters.c) does not need to know whether the underlying engine
is SW or GL. One problem though appears with the blending or blurring
of some Alpha buffers, the colors are wrong.
This patch removes more lines than it adds so it must be good ;)
2017-01-17 18:47:25 -08:00
Evas_Filter_Command * evas_filter_command_mask_add ( Evas_Filter_Context * ctx , void * draw_context , int inbuf , int maskbuf , int outbuf , Evas_Filter_Fill_Mode fillmode ) ;
2013-12-08 22:54:48 -08:00
/**
* @ brief Apply a relief effect based on a bump map ( Z map )
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context ( ignored )
* @ param inbuf Input buffer ( Alpha or RGBA )
* @ param bumpbuf Bump map ( Alpha only ) , same size as inbuf . By definition , lows are black ( alpha 0 ) and highs are white ( alpha 255 ) .
* @ param outbuf Output buffer ( Alpha or RGBA ) , same size as inbuf
* @ param azimuth CCW angle in degrees from the X axis of the light direction . 0 is light from the right , 90 from the top , 180 from the left , 270 from the bottom . All values are valid .
* @ param elevation Angle in degrees between the XY plane and the light . Only values from 0 ( light is perfectly horizontal ) to 90 ( light comes from the viewer herself ) are acceptable .
* @ param depth Max depth in the bump map . Default value is 10.
* @ param specular_factor Factor for the specular light effect ( shininess ) . Ranges from 1.0 to 1000 + with logarithmic effects
* @ param black Darkest color , defines the ambiant light
* @ param color Light ' s normal color
* @ param white Brightest color , used in the shininess effect
* @ param flags Optional flags : compensation for darkening
2013-12-31 00:51:09 -08:00
* @ param fillmode Specifies how to repeat and stretch the map to fit the target size
2013-12-08 22:54:48 -08:00
* @ return Filter command ID or - 1 in case of error
2015-05-25 22:58:56 -07:00
* @ internal
2013-12-08 22:54:48 -08:00
*/
evas filters: Refactor ector and gfx filters A LOT
Alright, so this is a massive patch that is the result of
trying to get rid of unused or poorly implemented classes in
ector. Originally ector was meant to support VG but extend to
things like filters as well. At the moment, ector's design
makes it quite hard to plug in the filters.
For now I think it's easier to implement the GL support for
the filters directly in the engine, where I hope to interfere
as little as possible.
This massive patch keeps only the required minimum to support
a versatile gl buffer that can be mapped, drawn or rendered to (FBO).
It's extremely inefficient as it relies on glReadPixels and lots
of texture uploads, as well as conversions between ARGB and Alpha.
Another type of GL buffer is a wrap around an existing GL image,
but that one is read-only (map or draw: no write map, no FBO).
No, all the filters run fine, and the high-level implementation
(evas_filters.c) does not need to know whether the underlying engine
is SW or GL. One problem though appears with the blending or blurring
of some Alpha buffers, the colors are wrong.
This patch removes more lines than it adds so it must be good ;)
2017-01-17 18:47:25 -08:00
Evas_Filter_Command * evas_filter_command_bump_map_add ( Evas_Filter_Context * ctx , void * draw_context , int inbuf , int bumpbuf , int outbuf , float azimuth , float elevation , float depth , float specular_factor , DATA32 black , DATA32 color , DATA32 white , Evas_Filter_Bump_Flags flags , Evas_Filter_Fill_Mode fillmode ) ;
2013-12-08 22:54:48 -08:00
2014-01-06 23:44:10 -08:00
/**
* @ brief Apply a geometrical transformation to the buffer
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context ( ignored )
* @ param inbuf Input buffer ( Alpha or RGBA )
* @ param outbuf Output buffer ( Alpha or RGBA ) , same size as inbuf
* @ param flags Specifies the operation to apply ( eg . vflip )
2014-01-07 01:38:22 -08:00
* @ param ox X offset
* @ param oy Y offset
2014-01-06 23:44:10 -08:00
* @ return Filter command ID or - 1 in case of error
2015-05-25 22:58:56 -07:00
* @ internal
2014-01-06 23:44:10 -08:00
*/
evas filters: Refactor ector and gfx filters A LOT
Alright, so this is a massive patch that is the result of
trying to get rid of unused or poorly implemented classes in
ector. Originally ector was meant to support VG but extend to
things like filters as well. At the moment, ector's design
makes it quite hard to plug in the filters.
For now I think it's easier to implement the GL support for
the filters directly in the engine, where I hope to interfere
as little as possible.
This massive patch keeps only the required minimum to support
a versatile gl buffer that can be mapped, drawn or rendered to (FBO).
It's extremely inefficient as it relies on glReadPixels and lots
of texture uploads, as well as conversions between ARGB and Alpha.
Another type of GL buffer is a wrap around an existing GL image,
but that one is read-only (map or draw: no write map, no FBO).
No, all the filters run fine, and the high-level implementation
(evas_filters.c) does not need to know whether the underlying engine
is SW or GL. One problem though appears with the blending or blurring
of some Alpha buffers, the colors are wrong.
This patch removes more lines than it adds so it must be good ;)
2017-01-17 18:47:25 -08:00
Evas_Filter_Command * evas_filter_command_transform_add ( Evas_Filter_Context * ctx , void * draw_context , int inbuf , int outbuf , Evas_Filter_Transform_Flags flags , int ox , int oy ) ;
2014-01-06 23:44:10 -08:00
2019-09-26 23:30:36 -07:00
/**
* @ brief Remove color information from the buffer
* @ param ctx Current filter chain
* @ param draw_context Current Evas draw context ( ignored )
* @ param inbuf Input buffer ( Alpha or RGBA )
* @ param outbuf Output buffer ( Alpha or RGBA ) , same size as inbuf
* @ return Filter command or NULL in case of error
* @ internal
*/
Evas_Filter_Command * evas_filter_command_grayscale_add ( Evas_Filter_Context * ctx , void * draw_context , int inbuf , int outbuf ) ;
2014-02-05 03:09:05 -08:00
/* Simple binding between a filter object and its sources */
struct _Evas_Filter_Proxy_Binding
{
Evas_Object * eo_proxy ;
Evas_Object * eo_source ;
Eina_Stringshare * name ;
} ;
2015-06-23 00:40:51 -07:00
struct _Evas_Filter_Data_Binding
{
EINA_INLIST ;
Eina_Stringshare * name ;
Eina_Stringshare * value ;
Eina_Bool execute : 1 ;
} ;
2015-04-28 05:24:11 -07:00
# undef EAPI
# define EAPI
2013-12-08 22:54:48 -08:00
2015-04-28 05:24:11 -07:00
# endif