@property
filter.code
@parameters
- [filter program as a string]
+ [filter program] OR [data name]
@effect
Applies a series of image filters to a TEXT or IMAGE part. The argument
to this field is the source code of a Lua program invoking various
filter operations. For more information, please refer to the page
"Evas filters reference".
+ The parameter can also be a parameter name as specified in the
+ data section (item or file property). This means external filter files
+ can be easily embedded in an edje file.
@see evasfiltersref
@endproperty
*/
eina_stringshare_del(rp->typedata.text->font);
eina_stringshare_del(rp->typedata.text->cache.in_str);
eina_stringshare_del(rp->typedata.text->cache.out_str);
- eina_stringshare_del(rp->typedata.text->filter.code);
+ if (!rp->typedata.text->filter.no_free)
+ eina_stringshare_del(rp->typedata.text->filter.code);
free(rp->typedata.text);
}
else if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
eina_stringshare_del(text->text.text_class);
eina_stringshare_del(text->text.style.str);
eina_stringshare_del(text->text.font.str);
- eina_stringshare_del(text->text.filter.code);
+ if (!text->text.filter.no_free)
+ eina_stringshare_del(text->text.filter.code);
}
break;
}
return font;
}
+static inline const char *
+_edje_filter_get(Edje *ed, Edje_Part_Description_Spec_Filter *filter)
+{
+ if (EINA_UNLIKELY(!filter->checked_data))
+ {
+ Edje_String *st;
+ filter->checked_data = 1;
+ st = eina_hash_find(ed->file->data, filter->code);
+ if (st)
+ {
+ eina_stringshare_del(filter->code);
+ filter->code = st->str;
+ filter->no_free = 1;
+ }
+ }
+ return filter->code;
+}
+
void
_edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
Edje_Calc_Params *params,
if (!text)
text = edje_string_get(&chosen_desc->text.text);
font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
- filter = chosen_desc->text.filter.code;
if (ep->typedata.text->text) text = ep->typedata.text->text;
if (ep->typedata.text->font) font = ep->typedata.text->font;
if (ep->typedata.text->size > 0) size = ep->typedata.text->size;
- if (ep->typedata.text->filter.code) filter = ep->typedata.text->filter.code;
+
+ if (ep->typedata.text->filter.code)
+ filter = _edje_filter_get(ed, &ep->typedata.text->filter);
+ else
+ filter = _edje_filter_get(ed, &chosen_desc->text.filter);
if (ep->typedata.text->filter.sources != chosen_desc->text.filter.sources)
{
prev_sources = ep->typedata.text->filter.sources;