forked from enlightenment/efl
Evas filters: Pass fillmode to the filters
I just need to actually implement them, now :)
This commit is contained in:
parent
a87ef5735d
commit
9623e1f238
|
@ -2165,7 +2165,7 @@ evas_object_text_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
|
||||
// FIXME: This final blend is not necessary. Needs to be removed.
|
||||
evas_filter_command_blend_add(filter, context, outbuf, targetbuf,
|
||||
X + x, Y + y);
|
||||
X + x, Y + y, EVAS_FILTER_FILL_MODE_NONE);
|
||||
|
||||
ENFN->context_free(ENDT, filter_ctx);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ static void _command_del(Evas_Filter_Context *ctx, Evas_Filter_Command *cmd);
|
|||
|
||||
#define DRAW_COLOR_SET(r, g, b, a) do { cmd->draw.R = r; cmd->draw.G = g; cmd->draw.B = b; cmd->draw.A = a; } while (0)
|
||||
#define DRAW_CLIP_SET(x, y, w, h) do { cmd->draw.clipx = x; cmd->draw.clipy = y; cmd->draw.clipw = w; cmd->draw.cliph = h; } while (0)
|
||||
#define DRAW_FILL_SET(fmode) do { cmd->draw.fillmode = fmode; } while (0)
|
||||
|
||||
typedef struct _Evas_Filter_Thread_Command Evas_Filter_Thread_Command;
|
||||
struct _Evas_Filter_Thread_Command
|
||||
|
@ -729,7 +730,7 @@ evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
|
|||
{
|
||||
INF("Add copy %d -> %d", copybuf->id, blur_out->id);
|
||||
cmd->ENFN->context_color_set(cmd->ENDT, drawctx, 0, 0, 0, 255);
|
||||
id = evas_filter_command_blend_add(ctx, drawctx, copybuf->id, blur_out->id, ox, oy);
|
||||
id = evas_filter_command_blend_add(ctx, drawctx, copybuf->id, blur_out->id, ox, oy, EVAS_FILTER_FILL_MODE_NONE);
|
||||
cmd->ENFN->context_color_set(cmd->ENDT, drawctx, R, G, B, A);
|
||||
if (id < 0) goto fail;
|
||||
}
|
||||
|
@ -737,7 +738,7 @@ evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
|
|||
if (convert)
|
||||
{
|
||||
INF("Add convert %d -> %d", blur_out->id, out->id);
|
||||
id = evas_filter_command_blend_add(ctx, drawctx, blur_out->id, out->id, ox, oy);
|
||||
id = evas_filter_command_blend_add(ctx, drawctx, blur_out->id, out->id, ox, oy, EVAS_FILTER_FILL_MODE_NONE);
|
||||
if (id < 0) goto fail;
|
||||
}
|
||||
|
||||
|
@ -752,7 +753,8 @@ fail:
|
|||
|
||||
int
|
||||
evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *drawctx,
|
||||
int inbuf, int outbuf, int ox, int oy)
|
||||
int inbuf, int outbuf, int ox, int oy,
|
||||
Evas_Filter_Fill_Mode fillmode)
|
||||
{
|
||||
Evas_Filter_Command *cmd;
|
||||
Evas_Filter_Buffer *in, *out;
|
||||
|
@ -785,6 +787,7 @@ evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *drawctx,
|
|||
|
||||
ENFN->context_color_get(ENDT, drawctx, &R, &G, &B, &A);
|
||||
DRAW_COLOR_SET(R, G, B, A);
|
||||
DRAW_FILL_SET(fillmode);
|
||||
cmd->draw.ox = ox;
|
||||
cmd->draw.oy = oy;
|
||||
cmd->draw.render_op = ENFN->context_render_op_get(ENDT, drawctx);
|
||||
|
@ -889,7 +892,8 @@ evas_filter_command_displacement_map_add(Evas_Filter_Context *ctx,
|
|||
void *draw_context EINA_UNUSED,
|
||||
int inbuf, int outbuf, int dispbuf,
|
||||
Evas_Filter_Displacement_Flags flags,
|
||||
int intensity)
|
||||
int intensity,
|
||||
Evas_Filter_Fill_Mode fillmode)
|
||||
{
|
||||
Evas_Filter_Command *cmd;
|
||||
Evas_Filter_Buffer *in, *out, *map, *tmp = NULL, *disp_out;
|
||||
|
@ -925,6 +929,7 @@ evas_filter_command_displacement_map_add(Evas_Filter_Context *ctx,
|
|||
cmd = _command_new(ctx, EVAS_FILTER_MODE_DISPLACE, in, map, disp_out);
|
||||
if (!cmd) goto end;
|
||||
|
||||
DRAW_FILL_SET(fillmode);
|
||||
cmd->displacement.flags = flags & EVAS_FILTER_DISPLACE_BITMASK;
|
||||
cmd->displacement.intensity = intensity;
|
||||
cmdid = cmd->id;
|
||||
|
@ -946,7 +951,8 @@ evas_filter_command_displacement_map_add(Evas_Filter_Context *ctx,
|
|||
if (tmp)
|
||||
{
|
||||
if (evas_filter_command_blend_add(ctx, draw_context, disp_out->id,
|
||||
out->id, 0, 0) < 0)
|
||||
out->id, 0, 0,
|
||||
EVAS_FILTER_FILL_MODE_NONE) < 0)
|
||||
{
|
||||
_command_del(ctx, _command_get(ctx, cmdid));
|
||||
cmdid = -1;
|
||||
|
@ -960,7 +966,8 @@ end:
|
|||
|
||||
int
|
||||
evas_filter_command_mask_add(Evas_Filter_Context *ctx, void *draw_context,
|
||||
int inbuf, int maskbuf, int outbuf)
|
||||
int inbuf, int maskbuf, int outbuf,
|
||||
Evas_Filter_Fill_Mode fillmode)
|
||||
{
|
||||
Evas_Filter_Command *cmd;
|
||||
Evas_Filter_Buffer *in, *out, *mask;
|
||||
|
@ -987,6 +994,7 @@ evas_filter_command_mask_add(Evas_Filter_Context *ctx, void *draw_context,
|
|||
|
||||
cmd->draw.render_op = render_op;
|
||||
DRAW_COLOR_SET(R, G, B, A);
|
||||
DRAW_FILL_SET(fillmode);
|
||||
|
||||
cmdid = cmd->id;
|
||||
|
||||
|
@ -1002,7 +1010,8 @@ evas_filter_command_bump_map_add(Evas_Filter_Context *ctx,
|
|||
float xyangle, float zangle, float elevation,
|
||||
float sf,
|
||||
DATA32 black, DATA32 color, DATA32 white,
|
||||
Evas_Filter_Bump_Flags flags)
|
||||
Evas_Filter_Bump_Flags flags,
|
||||
Evas_Filter_Fill_Mode fillmode)
|
||||
{
|
||||
Evas_Filter_Command *cmd;
|
||||
Evas_Filter_Buffer *in, *out, *bumpmap;
|
||||
|
@ -1027,6 +1036,7 @@ evas_filter_command_bump_map_add(Evas_Filter_Context *ctx,
|
|||
cmd = _command_new(ctx, EVAS_FILTER_MODE_BUMP, in, bumpmap, out);
|
||||
if (!cmd) goto end;
|
||||
|
||||
DRAW_FILL_SET(fillmode);
|
||||
cmd->bump.xyangle = xyangle;
|
||||
cmd->bump.zangle = zangle;
|
||||
cmd->bump.specular_factor = sf;
|
||||
|
|
|
@ -284,7 +284,7 @@ _instruction_param_gets(Evas_Filter_Instruction *instr, const char *name,
|
|||
|
||||
#define CHARS_ALPHABET "abcdefghijklmnopqrstuvwxyzABCDEFGHJIKLMNOPQRSTUVWXYZ"
|
||||
#define CHARS_NUMS "0123456789"
|
||||
#define CHARS_DELIMS "=-(),;#.:"
|
||||
#define CHARS_DELIMS "=-(),;#.:_"
|
||||
static const char *allowed_chars = CHARS_ALPHABET CHARS_NUMS "_";
|
||||
static const char *allowed_delim = CHARS_DELIMS;
|
||||
|
||||
|
@ -372,7 +372,7 @@ _is_valid_string(const char *str)
|
|||
if (!isalpha(*str++))
|
||||
return EINA_FALSE;
|
||||
for (; *str; str++)
|
||||
if (!isalpha(*str) && !isdigit(*str))
|
||||
if (!isalpha(*str) && !isdigit(*str) && (*str != '_'))
|
||||
return EINA_FALSE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ _blend_instruction_prepare(Evas_Filter_Instruction *instr)
|
|||
_instruction_param_seq_add(instr, "ox", VT_INT, 0);
|
||||
_instruction_param_seq_add(instr, "oy", VT_INT, 0);
|
||||
_instruction_param_name_add(instr, "color", VT_COLOR, 0xFFFFFFFF);
|
||||
_instruction_param_name_add(instr, "fill", VT_STRING, "none");
|
||||
_instruction_param_name_add(instr, "fillmode", VT_STRING, "none");
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ _bump_instruction_prepare(Evas_Filter_Instruction *instr)
|
|||
_instruction_param_name_add(instr, "dst", VT_BUFFER, "output");
|
||||
_instruction_param_name_add(instr, "black", VT_COLOR, 0xFF000000);
|
||||
_instruction_param_name_add(instr, "white", VT_COLOR, 0xFFFFFFFF);
|
||||
_instruction_param_name_add(instr, "fill", VT_STRING, "repeat");
|
||||
_instruction_param_name_add(instr, "fillmode", VT_STRING, "repeat");
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ _displace_instruction_prepare(Evas_Filter_Instruction *instr)
|
|||
_instruction_param_seq_add(instr, "flags", VT_INT, 0x0); // FIXME
|
||||
_instruction_param_name_add(instr, "src", VT_BUFFER, "input");
|
||||
_instruction_param_name_add(instr, "dst", VT_BUFFER, "output");
|
||||
_instruction_param_name_add(instr, "fill", VT_STRING, "repeat");
|
||||
_instruction_param_name_add(instr, "fillmode", VT_STRING, "repeat");
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ _mask_instruction_prepare(Evas_Filter_Instruction *instr)
|
|||
_instruction_param_seq_add(instr, "src", VT_BUFFER, "input");
|
||||
_instruction_param_seq_add(instr, "dst", VT_BUFFER, "output");
|
||||
_instruction_param_name_add(instr, "color", VT_COLOR, 0xFFFFFFFF);
|
||||
_instruction_param_name_add(instr, "fill", VT_STRING, "none");
|
||||
_instruction_param_name_add(instr, "fillmode", VT_STRING, "none");
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -1297,7 +1297,7 @@ _fill_mode_get(Evas_Filter_Instruction *instr)
|
|||
unsigned k;
|
||||
|
||||
if (!instr) return EVAS_FILTER_FILL_MODE_NONE;
|
||||
fill = _instruction_param_gets(instr, "fill", NULL);
|
||||
fill = _instruction_param_gets(instr, "fillmode", NULL);
|
||||
|
||||
for (k = 0; k < sizeof(fill_modes) / sizeof(fill_modes[0]); k++)
|
||||
{
|
||||
|
@ -1329,7 +1329,8 @@ _instr2cmd_blend(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm,
|
|||
out = _buffer_get(pgm, dst);
|
||||
|
||||
if (isset) SETCOLOR(color);
|
||||
cmdid = evas_filter_command_blend_add(ctx, dc, in->cid, out->cid, ox, oy);
|
||||
cmdid = evas_filter_command_blend_add(ctx, dc, in->cid, out->cid, ox, oy,
|
||||
fillmode);
|
||||
if (isset) RESETCOLOR();
|
||||
|
||||
return cmdid;
|
||||
|
@ -1412,7 +1413,8 @@ _instr2cmd_bump(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm,
|
|||
|
||||
cmdid = evas_filter_command_bump_map_add(ctx, dc, in->cid, bump->cid, out->cid,
|
||||
azimuth, elevation, depth, specular,
|
||||
black, color, white, flags);
|
||||
black, color, white, flags,
|
||||
fillmode);
|
||||
|
||||
return cmdid;
|
||||
}
|
||||
|
@ -1439,7 +1441,8 @@ _instr2cmd_displace(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm,
|
|||
mask = _buffer_get(pgm, map);
|
||||
|
||||
cmdid = evas_filter_command_displacement_map_add(ctx, dc, in->cid, out->cid,
|
||||
mask->cid, flags, intensity);
|
||||
mask->cid, flags, intensity,
|
||||
fillmode);
|
||||
|
||||
return cmdid;
|
||||
}
|
||||
|
@ -1514,7 +1517,7 @@ _instr2cmd_mask(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm,
|
|||
|
||||
ENFN->context_color_get(ENDT, dc, &R, &G, &B, &A);
|
||||
ENFN->context_color_set(ENDT, dc, R_VAL(&color), G_VAL(&color), B_VAL(&color), A_VAL(&color));
|
||||
cmdid = evas_filter_command_mask_add(ctx, dc, in->cid, mask->cid, out->cid);
|
||||
cmdid = evas_filter_command_mask_add(ctx, dc, in->cid, mask->cid, out->cid, fillmode);
|
||||
ENFN->context_color_set(ENDT, dc, R, G, B, A);
|
||||
|
||||
return cmdid;
|
||||
|
|
|
@ -102,6 +102,7 @@ struct _Evas_Filter_Command
|
|||
int R, G, B, A;
|
||||
int ox, oy;
|
||||
int clipx, clipy, clipw, cliph;
|
||||
Evas_Filter_Fill_Mode fillmode;
|
||||
} draw;
|
||||
};
|
||||
|
||||
|
|
|
@ -121,9 +121,10 @@ Eina_Bool evas_filter_run(Evas_Filter_Context *ctx, Eina_Bool do_
|
|||
* @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
|
||||
* @param fillmode Specifies whether to repeat or stretch the input onto its destination, and on which axes
|
||||
* @return Filter command ID or -1 in case of error
|
||||
*/
|
||||
int evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *draw_context, int inbuf, int outbuf, int ox, int oy);
|
||||
int 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);
|
||||
|
||||
/**
|
||||
* @brief Apply a blur effect on a buffer
|
||||
|
@ -172,9 +173,10 @@ int evas_filter_command_grow_add(Evas_Filter_Context *ctx,
|
|||
* @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)
|
||||
* @param fillmode Specifies how to repeat and stretch the map to fit the target size
|
||||
* @return Filter command ID or -1 in case of error
|
||||
*/
|
||||
int 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);
|
||||
int 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);
|
||||
|
||||
/**
|
||||
* @brief Apply a texture to a buffer
|
||||
|
@ -183,10 +185,11 @@ int evas_filter_command_displacement_map_add(Evas_Filter_Co
|
|||
* @param inbuf Input buffer (Alpha or RGBA)
|
||||
* @param maskbuf Texture buffer (Alpha or RGBA)
|
||||
* @param outbuf Output buffer (Alpha or RGBA)
|
||||
* @param fillmode Specifies how to repeat and stretch the mask to fit the target size
|
||||
* @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
|
||||
*/
|
||||
int evas_filter_command_mask_add(Evas_Filter_Context *ctx, void *draw_context, int inbuf, int maskbuf, int outbuf);
|
||||
int evas_filter_command_mask_add(Evas_Filter_Context *ctx, void *draw_context, int inbuf, int maskbuf, int outbuf, Evas_Filter_Fill_Mode fillmode);
|
||||
|
||||
/**
|
||||
* @brief Apply a relief effect based on a bump map (Z map)
|
||||
|
@ -203,9 +206,10 @@ int evas_filter_command_mask_add(Evas_Filter_Context *ctx,
|
|||
* @param color Light's normal color
|
||||
* @param white Brightest color, used in the shininess effect
|
||||
* @param flags Optional flags: compensation for darkening
|
||||
* @param fillmode Specifies how to repeat and stretch the map to fit the target size
|
||||
* @return Filter command ID or -1 in case of error
|
||||
*/
|
||||
int 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);
|
||||
int 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);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue