From 511049e20da614bd14be2f57f8aa87315b97d69d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 13 Feb 2014 17:26:33 +0900 Subject: [PATCH] Evas filters: Improve doc automatization Include example filter codes from src/examples in Doxygen. Use these examples for the generation as well. --- doc/previews/Makefile.am | 7 ++- doc/previews/filter_blend.sh | 6 +- doc/previews/filter_blur.sh | 5 -- doc/previews/filter_bump.sh | 5 -- doc/previews/filter_curve.sh | 6 -- doc/previews/filter_example_1.sh | 7 --- doc/previews/filter_grow.sh | 6 -- doc/previews/filter_mask.sh | 7 --- doc/previews/filter_transform.sh | 6 -- src/examples/evas/filters/filter_blend.txt | 1 + src/examples/evas/filters/filter_blur.txt | 2 + src/examples/evas/filters/filter_bump.txt | 3 + src/examples/evas/filters/filter_curve.txt | 4 ++ .../evas/filters/filter_example_1.txt | 5 ++ src/examples/evas/filters/filter_grow.txt | 4 ++ src/examples/evas/filters/filter_mask.txt | 5 ++ .../evas/filters/filter_transform.txt | 4 ++ src/lib/evas/filters/evas_filter_parser.c | 55 ++++--------------- 18 files changed, 46 insertions(+), 92 deletions(-) create mode 100644 src/examples/evas/filters/filter_blend.txt create mode 100644 src/examples/evas/filters/filter_blur.txt create mode 100644 src/examples/evas/filters/filter_bump.txt create mode 100644 src/examples/evas/filters/filter_curve.txt create mode 100644 src/examples/evas/filters/filter_example_1.txt create mode 100644 src/examples/evas/filters/filter_grow.txt create mode 100644 src/examples/evas/filters/filter_mask.txt create mode 100644 src/examples/evas/filters/filter_transform.txt diff --git a/doc/previews/Makefile.am b/doc/previews/Makefile.am index fbfdd297dc..dd25cc1677 100644 --- a/doc/previews/Makefile.am +++ b/doc/previews/Makefile.am @@ -35,7 +35,12 @@ previews-data: $(MKDIR_P) $(HTMLDIR) @for a in $(PREVIEWS) ; do \ echo " GEN filter_$${a}.png" ; \ - source ${top_srcdir}/doc/previews/filter_$${a}.sh ; \ + FONT="Sans" ; \ + SIZE=24 ; \ + FILTER=`cat ${top_srcdir}/src/examples/evas/filters/filter_$${a}.txt` ; \ + if [ -e ${top_srcdir}/doc/previews/filter_$${a}.sh ] ; then \ + source ${top_srcdir}/doc/previews/filter_$${a}.sh ; \ + fi ; \ $(top_srcdir)/doc/previews/preview_text_filter "$${TEXT}" "$${FILTER}" "$(DATADIR)/filter_$${a}.png" "$${FONT}" "$${SIZE}" ; \ cp "$(DATADIR)/filter_$${a}.png" "$(HTMLDIR)/" ; \ done diff --git a/doc/previews/filter_blend.sh b/doc/previews/filter_blend.sh index eee04461be..0d13cea28c 100644 --- a/doc/previews/filter_blend.sh +++ b/doc/previews/filter_blend.sh @@ -1,5 +1 @@ -TEXT="Blend" -FONT="Sans:style=bold" -SIZE=32 -FILTER="blend (color = #3399FF);" - +TEXT="Blend Example" diff --git a/doc/previews/filter_blur.sh b/doc/previews/filter_blur.sh index a844419e39..59de6f4a48 100644 --- a/doc/previews/filter_blur.sh +++ b/doc/previews/filter_blur.sh @@ -1,8 +1,3 @@ TEXT="Blur" FONT="Sans:style=bold" SIZE=32 -FILTER=" -blur (10, color = black, oy = 5, ox = 5); -blend (); -" - diff --git a/doc/previews/filter_bump.sh b/doc/previews/filter_bump.sh index 7fa8787e74..76862f19bd 100644 --- a/doc/previews/filter_bump.sh +++ b/doc/previews/filter_bump.sh @@ -1,8 +1,3 @@ TEXT="Bump" FONT="Sans:style=bold" SIZE=64 -FILTER=" -buffer : a (alpha); -blur (5, dst = a); -bump (map = a, compensate = yes, color = cyan, specular = 10.0); -" diff --git a/doc/previews/filter_curve.sh b/doc/previews/filter_curve.sh index 96e3f11049..852e165c04 100644 --- a/doc/previews/filter_curve.sh +++ b/doc/previews/filter_curve.sh @@ -1,9 +1,3 @@ TEXT="Curve" FONT="Sans:style=bold" SIZE=64 -FILTER=" -buffer : a (alpha); -blur (4, dst = a); -curve (0:0 - 20:0 - 60:255 - 160:255 - 200:0 - 255:0, src = a, dst = a); -blend(src = a, color = black); -" diff --git a/doc/previews/filter_example_1.sh b/doc/previews/filter_example_1.sh index 0098a6b2a8..dfe587cea7 100644 --- a/doc/previews/filter_example_1.sh +++ b/doc/previews/filter_example_1.sh @@ -1,10 +1,3 @@ TEXT="Evas Filters" FONT="Sans" SIZE=50 -FILTER=" -buffer : fat (alpha); -grow (8, dst = fat); -blur (12, src = fat, color = darkblue); -blur (4, color = cyan); -blend (); -" diff --git a/doc/previews/filter_grow.sh b/doc/previews/filter_grow.sh index b675ab13ea..7a0b832944 100644 --- a/doc/previews/filter_grow.sh +++ b/doc/previews/filter_grow.sh @@ -1,9 +1,3 @@ TEXT="Grow - Contour" FONT="Sans:style=bold" SIZE=32 -FILTER=" -buffer : fat (alpha); -grow (4, dst = fat); -blend (src = fat, color = black); -blend (color = white); -" diff --git a/doc/previews/filter_mask.sh b/doc/previews/filter_mask.sh index ab22e5539c..706903eb67 100644 --- a/doc/previews/filter_mask.sh +++ b/doc/previews/filter_mask.sh @@ -1,10 +1,3 @@ TEXT="Mask" FONT="Sans:style=bold" SIZE=64 -FILTER=" -buffer: a (alpha); -blur(5, dst = a); -curve(points = 0:255 - 128:255 - 255:0, src = a, dst = a); -blend(color = black); -mask(mask = a, color = cyan); -" diff --git a/doc/previews/filter_transform.sh b/doc/previews/filter_transform.sh index 6acd8459c5..7d9f3c47a1 100644 --- a/doc/previews/filter_transform.sh +++ b/doc/previews/filter_transform.sh @@ -1,9 +1,3 @@ TEXT="Transform - Mirror effect" FONT="Sans" SIZE=50 -FILTER=" -buffer : t (alpha); -transform (oy = 20, dst = t); -blend (src = t, color = silver); -blend (color = white); -" diff --git a/src/examples/evas/filters/filter_blend.txt b/src/examples/evas/filters/filter_blend.txt new file mode 100644 index 0000000000..251c8c3150 --- /dev/null +++ b/src/examples/evas/filters/filter_blend.txt @@ -0,0 +1 @@ +blend (color = #3399FF); \ No newline at end of file diff --git a/src/examples/evas/filters/filter_blur.txt b/src/examples/evas/filters/filter_blur.txt new file mode 100644 index 0000000000..54b1953d6d --- /dev/null +++ b/src/examples/evas/filters/filter_blur.txt @@ -0,0 +1,2 @@ +blur (10, color = black, oy = 5, ox = 5); +blend (); diff --git a/src/examples/evas/filters/filter_bump.txt b/src/examples/evas/filters/filter_bump.txt new file mode 100644 index 0000000000..8110254c29 --- /dev/null +++ b/src/examples/evas/filters/filter_bump.txt @@ -0,0 +1,3 @@ +buffer : a (alpha); +blur (5, dst = a); +bump (map = a, compensate = yes, color = cyan, specular = 10.0); diff --git a/src/examples/evas/filters/filter_curve.txt b/src/examples/evas/filters/filter_curve.txt new file mode 100644 index 0000000000..e2e84f700b --- /dev/null +++ b/src/examples/evas/filters/filter_curve.txt @@ -0,0 +1,4 @@ +buffer : a (alpha); +blur (4, dst = a); +curve (0:0 - 20:0 - 60:255 - 160:255 - 200:0 - 255:0, src = a, dst = a); +blend(src = a, color = black); \ No newline at end of file diff --git a/src/examples/evas/filters/filter_example_1.txt b/src/examples/evas/filters/filter_example_1.txt new file mode 100644 index 0000000000..ed87d7efcb --- /dev/null +++ b/src/examples/evas/filters/filter_example_1.txt @@ -0,0 +1,5 @@ +buffer : fat (alpha); +grow (8, dst = fat); +blur (12, src = fat, color = darkblue); +blur (4, color = cyan); +blend (); \ No newline at end of file diff --git a/src/examples/evas/filters/filter_grow.txt b/src/examples/evas/filters/filter_grow.txt new file mode 100644 index 0000000000..2d57f4281a --- /dev/null +++ b/src/examples/evas/filters/filter_grow.txt @@ -0,0 +1,4 @@ +buffer : fat (alpha); +grow (4, dst = fat); +blend (src = fat, color = black); +blend (color = white); \ No newline at end of file diff --git a/src/examples/evas/filters/filter_mask.txt b/src/examples/evas/filters/filter_mask.txt new file mode 100644 index 0000000000..a43c23b695 --- /dev/null +++ b/src/examples/evas/filters/filter_mask.txt @@ -0,0 +1,5 @@ +buffer: a (alpha); +blur(5, dst = a); +curve(points = 0:255 - 128:255 - 255:0, src = a, dst = a); +blend(color = black); +mask(mask = a, color = cyan); \ No newline at end of file diff --git a/src/examples/evas/filters/filter_transform.txt b/src/examples/evas/filters/filter_transform.txt new file mode 100644 index 0000000000..322af27bbb --- /dev/null +++ b/src/examples/evas/filters/filter_transform.txt @@ -0,0 +1,4 @@ +buffer : t (alpha); +transform (oy = 20, dst = t); +blend (src = t, color = silver); +blend (color = white); \ No newline at end of file diff --git a/src/lib/evas/filters/evas_filter_parser.c b/src/lib/evas/filters/evas_filter_parser.c index 0a5ac7c109..3335dc57ab 100644 --- a/src/lib/evas/filters/evas_filter_parser.c +++ b/src/lib/evas/filters/evas_filter_parser.c @@ -67,13 +67,7 @@ Here is a simple example illustrating the syntax: - @code - buffer : fat (alpha); - grow (8, dst = fat); - blur (12, src = fat, color = darkblue); - blur (4, color = cyan); - blend (); - @endcode + @include filter_example_1.txt This example will display a cyan and dark blue glow surrounding the main text (its color depends on the object's theme). @@ -985,9 +979,7 @@ _blend_padding_update(Evas_Filter_Program *pgm, Evas_Filter_Instruction *instr, If @a src is an alpha buffer and @a dst is an RGBA buffer, then the @a color option should be set. - @code - blend (color = #3399FF); - @endcode + @include filter_blend.txt
@image html filter_blend.png @@ -1095,10 +1087,7 @@ _blur_padding_update(Evas_Filter_Program *pgm, Evas_Filter_Instruction *instr, If @a src is an alpha buffer and @a dst is an RGBA buffer, then the color option should be set. @a ox and @a oy can be used to move the blurry output by a few pixels, like a drop shadow. Example: - @code - blur (10, color = black, oy = 5, ox = 5); - blend (); - @endcode + @include filter_blur.txt
@image html filter_blur.png @@ -1159,11 +1148,7 @@ _blur_instruction_prepare(Evas_Filter_Instruction *instr) @note As of 2014/02/11, the ALPHA to RGBA support is of much better quality than ALPHA only, but @b very slow. RGBA sources are not supported yet. Here is a full example for a size 100 font, of a very simple bevel effect: - @code - buffer : a (alpha); - blur (5, dst = a); - bump (map = a, compensate = yes, color = cyan, specular = 10.0); - @endcode + @include filter_bump.txt
@image html filter_bump.png @@ -1230,12 +1215,7 @@ _bump_instruction_prepare(Evas_Filter_Instruction *instr) If ignored, y(x = 0) is 0 and y(x = 255) is 255. The following example will generate a 4px thick stroke around text letters: - @code - buffer : a (alpha); - blur (4, dst = a); - curve (0:0 - 20:0 - 60:255 - 160:255 - 200:0 - 255:0, src = a, dst = a); - blend(src = a, color = black); - @endcode + @include filter_curve.txt
@image html filter_curve.png @@ -1470,12 +1450,8 @@ _grow_padding_update(Evas_Filter_Program *pgm, Evas_Filter_Instruction *instr, @param dst Destination buffer for blending. This must be of same size and colorspace as @a src. Example: - @code - buffer : fat (alpha); - grow (4, dst = fat); - blend (src = fat, color = black); - blend (color = white); - @endcode + @include filter_grow.txt + This will first grow the letters in the buffer @c input by 4px, and then draw this buffer in black in the background. Blending white on top of that will give a simple impression of stroked text. @@ -1524,13 +1500,8 @@ _grow_instruction_prepare(Evas_Filter_Instruction *instr) Note that @a src and @a mask are interchangeable, if they have the same dimensions. Example: - @code - buffer: a (alpha); - blur(5, dst = a); - curve(points = 0:255 - 128:255 - 255:0, src = a, dst = a); - blend(color = black); - mask(mask = a, color = cyan); - @endcode + @include filter_mask.txt + This will create a simple cyan inner glow effect on black text.
@@ -1610,12 +1581,8 @@ _transform_padding_update(Evas_Filter_Program *pgm, @param oy Y offset. Example: - @code - buffer : t (alpha); - transform (oy = 20, dst = t); - blend (src = t, color = silver); - blend (color = white); - @endcode + @include filter_transform.txt + This will create a mirrored text effect, for a font of 50px.