This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via d10318c0369619faa73b93abe840ea8e67cb5a52 (commit) via db1bbab2baeb3c556862cacaa9ac9e0fa15ce859 (commit) from 2f824b15387739be5c32dd417b6fabbf54234bc8 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/d10318c0369619faa73b93abe840ea8e67cb5...
commit d10318c0369619faa73b93abe840ea8e67cb5a52 Author: Cyril Hrubis metan@ucw.cz Date: Sun Dec 11 16:39:32 2011 +0000
core: Added MIX_PIXELS + basic tests.
diff --git a/include/core/GP_MixPixels.gen.h.t b/include/core/GP_MixPixels.gen.h.t new file mode 100644 index 0000000..ab611aa --- /dev/null +++ b/include/core/GP_MixPixels.gen.h.t @@ -0,0 +1,35 @@ +%% extends "base.h.t" + +%% block descr +Macros to mix two pixels accordingly to percentage. +%% endblock + +%% block body + + +#include "GP_Pixel.h" + +%% for pt in pixeltypes +%% if not pt.is_unknown() +/* + * Mixes two {{ pt.name }} pixels. + * + * The percentage is expected as 8 bit unsigned integer [0 .. 255] + */ +#define GP_MIX_PIXELS_{{ pt.name }}(pix1, pix2, perc) ({ +%% for c in pt.chanslist + GP_Pixel {{ c[0] }}; ++ {{ c[0] }} = GP_Pixel_GET_{{ c[0] }}_{{ pt.name }}(pix1) * perc; + {{ c[0] }} += GP_Pixel_GET_{{ c[0] }}_{{ pt.name }}(pix2) * (255 - perc); + {{ c[0] }} = ({{ c[0] }} + 128) / 255; ++%% endfor ++ GP_Pixel_CREATE_{{ pt.name }}({{ pt.chanslist[0][0] }}{% for c in pt.chanslist[1:] %}, {{ c[0] }}{% endfor %}); +}) + +%% endif +%% endfor + +%% endblock body diff --git a/include/core/Makefile b/include/core/Makefile index 186b6dd..48eb3d2 100644 --- a/include/core/Makefile +++ b/include/core/Makefile @@ -1,6 +1,7 @@ TOPDIR=../.. GENHEADERS=GP_Convert_Scale.gen.h GP_Blit.gen.h GP_Pixel.gen.h - GP_GetPutPixel.gen.h GP_Convert.gen.h GP_FnPerBpp.gen.h + GP_GetPutPixel.gen.h GP_Convert.gen.h GP_FnPerBpp.gen.h + GP_MixPixels.gen.h LIBNAME=core include $(TOPDIR)/gen.mk include $(TOPDIR)/include.mk diff --git a/tests/core/GP_MixPixels.test.gen.c.t b/tests/core/GP_MixPixels.test.gen.c.t new file mode 100644 index 0000000..ffb9d6d --- /dev/null +++ b/tests/core/GP_MixPixels.test.gen.c.t @@ -0,0 +1,37 @@ +%% extends "base.test.c.t" + +%% block body +#include "GP_Tests.h" +#include "GP_Core.h" +#include "GP_MixPixels.gen.h" +#include "GP_TestingCore.h" + +GP_SUITE(GP_MixPixels) + +%% call(pt) test_for_all_pixeltypes("MixPixelsWhiteStaysWhite_via", + opts="loop_start=0, loop_end=4", + palette=False) + GP_Pixel p1 = GP_RGBToPixel(255, 255, 255, GP_PIXEL_{{ pt.name }}); + GP_Pixel p2 = GP_RGBToPixel(255, 255, 255, GP_PIXEL_{{ pt.name }}); + GP_Pixel p3; + int i; + for (i = 0; i < 256; i++) { + p3 = GP_MIX_PIXELS_{{ pt.name }}(p1, p2, i); + GP_CHECK_EqualColors(p1, GP_PIXEL_{{ pt.name }}, p3, GP_PIXEL_{{ pt.name }}); + } +%% endcall + +%% call(pt) test_for_all_pixeltypes("MixPixelsBlackStaysBlack_via", + opts="loop_start=0, loop_end=4", + palette=False) + GP_Pixel p1 = GP_RGBToPixel(0, 0, 0, GP_PIXEL_{{ pt.name }}); + GP_Pixel p2 = GP_RGBToPixel(0, 0, 0, GP_PIXEL_{{ pt.name }}); + GP_Pixel p3; + int i; + for (i = 0; i < 256; i++) { + p3 = GP_MIX_PIXELS_{{ pt.name }}(p1, p2, i); + GP_CHECK_EqualColors(p1, GP_PIXEL_{{ pt.name }}, p3, GP_PIXEL_{{ pt.name }}); + } +%% endcall + +%% endblock body diff --git a/tests/core/Makefile b/tests/core/Makefile index 67d52e1..56955b9 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -3,7 +3,8 @@ TOPDIR=../.. LIBNAME=core TESTSUITE=core_suite LDLIBS+=-lGP -L$(TOPDIR)/build/ -lcheck -lm -ldl -GENSOURCES+=GP_Convert.test.gen.c GP_WritePixel.test.gen.c +GENSOURCES+=GP_Convert.test.gen.c GP_WritePixel.test.gen.c + GP_MixPixels.test.gen.c
all: $(TESTSUITE)
http://repo.or.cz/w/gfxprim.git/commit/db1bbab2baeb3c556862cacaa9ac9e0fa15ce...
commit db1bbab2baeb3c556862cacaa9ac9e0fa15ce859 Author: Cyril Hrubis metan@ucw.cz Date: Sun Dec 11 15:19:10 2011 +0000
gfx: fix build broken by previous commit
diff --git a/include/gfx/GP_Gfx.h b/include/gfx/GP_Gfx.h index 5ab2f03..3c36bf0 100644 --- a/include/gfx/GP_Gfx.h +++ b/include/gfx/GP_Gfx.h @@ -46,6 +46,7 @@ #include "GP_Triangle.h" #include "GP_Tetragon.h" #include "GP_Circle.h" +#include "GP_Arc.h" #include "GP_Ellipse.h" #include "GP_Polygon.h" #include "GP_Symbol.h"
-----------------------------------------------------------------------
Summary of changes: include/core/GP_MixPixels.gen.h.t | 35 ++++++++++++++++++++++++++++++++ include/core/Makefile | 3 +- include/gfx/GP_Gfx.h | 1 + tests/core/GP_MixPixels.test.gen.c.t | 37 ++++++++++++++++++++++++++++++++++ tests/core/Makefile | 3 +- 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 include/core/GP_MixPixels.gen.h.t create mode 100644 tests/core/GP_MixPixels.test.gen.c.t
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.