# HG changeset patch # User nenolod # Date 1162371619 28800 # Node ID 5635841a0686a0f7eee3b8ab197bcb384405ddee # Parent 3d98be3d74c2303aa6377f6f8e503ae2320ca961 [svn] - make mosaic sizable. diff -r 3d98be3d74c2 -r 5635841a0686 ChangeLog --- a/ChangeLog Wed Nov 01 00:54:36 2006 -0800 +++ b/ChangeLog Wed Nov 01 01:00:19 2006 -0800 @@ -1,3 +1,15 @@ +2006-11-01 08:54:36 +0000 William Pitcock + revision [348] + - mosaic effect (in progress, custom size will be in the next commit) + - new preset: retroscope which demonstrates it ;) + + trunk/src/paranormal/builtins.c | 2 + trunk/src/paranormal/general.c | 45 ++++++++++++++++++ + trunk/src/paranormal/presets/Makefile | 3 - + trunk/src/paranormal/presets/nenolod_-_retroscope.pnv | 23 +++++++++ + 4 files changed, 72 insertions(+), 1 deletion(-) + + 2006-11-01 07:43:46 +0000 William Pitcock revision [346] - branchscope preset... a very advanced example of branching, multiple diff -r 3d98be3d74c2 -r 5635841a0686 src/paranormal/general.c --- a/src/paranormal/general.c Wed Nov 01 00:54:36 2006 -0800 +++ b/src/paranormal/general.c Wed Nov 01 01:00:19 2006 -0800 @@ -14,7 +14,7 @@ { "amount", "The amount by which the color index of each " "pixel should be decreased by each frame (MAX 255)", OPT_TYPE_INT, { ival: 3 } }, - { 0 } + { NULL } }; static void @@ -98,6 +98,13 @@ /* **************** general_mosaic **************** */ /* FIXME: add a variable radius */ /* FIXME: SPEEEED */ +static struct pn_actuator_option_desc general_mosaic_opts[] = +{ + { "radius", "The pixel radius that should be used for the effect.", + OPT_TYPE_INT, { ival: 6 } }, + { NULL } +}; + static void general_mosaic_exec (const struct pn_actuator_option *opts, gpointer data) @@ -106,16 +113,17 @@ register guchar *srcptr = pn_image_data->surface[0]; register guchar *destptr = pn_image_data->surface[1]; register int sum; + int radius = opts[0].val.ival; - for (j=0; jheight; j += 6) - for (i=0; iwidth; i += 6) + for (j=0; jheight; j += radius) + for (i=0; iwidth; i += radius) { int ii = 0, jj = 0; guchar bval = 0; /* find the brightest colour */ - for (jj = 0; jj < 6 && (j + jj < pn_image_data->height); jj++) - for (ii = 0; ii < 6 && (i + ii < pn_image_data->width); ii++) + for (jj = 0; jj < radius && (j + jj < pn_image_data->height); jj++) + for (ii = 0; ii < radius && (i + ii < pn_image_data->width); ii++) { guchar val = srcptr[PN_IMG_INDEX(i + ii, j + jj)]; @@ -123,8 +131,8 @@ bval = val; } - for (jj = 0; jj < 6 && (j + jj < pn_image_data->height); jj++) - for (ii = 0; ii < 6 && (i + ii < pn_image_data->width); ii++) + for (jj = 0; jj < radius && (j + jj < pn_image_data->height); jj++) + for (ii = 0; ii < radius && (i + ii < pn_image_data->width); ii++) { destptr[PN_IMG_INDEX(i + ii, j + jj)] = bval; } @@ -136,6 +144,6 @@ struct pn_actuator_desc builtin_general_mosaic = { "general_mosaic", "Mosaic", "A simple 6 pixel radius Mosaic", - 0, NULL, + 0, general_mosaic_opts, NULL, NULL, general_mosaic_exec };