Mercurial > audlegacy-plugins
changeset 278:8f4dc0d63925 trunk
[svn] - add surface flip
author | nenolod |
---|---|
date | Sun, 19 Nov 2006 15:37:28 -0800 |
parents | 219e0641d917 |
children | 1983383db0f5 |
files | ChangeLog src/paranormal/builtins.c src/paranormal/general.c |
diffstat | 3 files changed, 54 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Nov 19 14:54:33 2006 -0800 +++ b/ChangeLog Sun Nov 19 15:37:28 2006 -0800 @@ -1,3 +1,12 @@ +2006-11-19 22:54:33 +0000 William Pitcock <nenolod@nenolod.net> + revision [582] + - more presets + + trunk/src/paranormal/presets/Makefile | 1 + trunk/src/paranormal/presets/nenolod_-_cubism.pnv | 54 ++++++++++++++++++++++ + 2 files changed, 55 insertions(+) + + 2006-11-19 22:35:54 +0000 William Pitcock <nenolod@nenolod.net> revision [580] - another preset
--- a/src/paranormal/builtins.c Sun Nov 19 14:54:33 2006 -0800 +++ b/src/paranormal/builtins.c Sun Nov 19 15:37:28 2006 -0800 @@ -32,6 +32,7 @@ DECLARE_ACTUATOR (general_replace); DECLARE_ACTUATOR (general_swap); DECLARE_ACTUATOR (general_copy); +DECLARE_ACTUATOR (general_flip); /* **************** misc **************** */ DECLARE_ACTUATOR (misc_floater); @@ -74,6 +75,7 @@ &builtin_general_replace, &builtin_general_swap, &builtin_general_copy, + &builtin_general_flip, /* **************** misc **************** */ &builtin_misc_floater, /* **************** wave **************** */
--- a/src/paranormal/general.c Sun Nov 19 14:54:33 2006 -0800 +++ b/src/paranormal/general.c Sun Nov 19 15:37:28 2006 -0800 @@ -266,3 +266,46 @@ 0, NULL, NULL, NULL, general_copy_exec }; + +/* **************** general_flip **************** */ +static struct pn_actuator_option_desc general_flip_opts[] = +{ + { "direction", "Negative is horizontal, positive is vertical.", + OPT_TYPE_INT, { ival: -1 } }, + { NULL } +}; + +static void +general_flip_exec (const struct pn_actuator_option *opts, + gpointer data) +{ + gint x, y; + + if (opts[0].val.ival < 0) + { + for (y = 0; y < pn_image_data->height; y++) + for (x = 0; x < pn_image_data->width; x++) + { + pn_image_data->surface[1][PN_IMG_INDEX(pn_image_data->width - x, y)] = + pn_image_data->surface[0][PN_IMG_INDEX(x, y)]; + } + } + else + { + for (y = 0; y < pn_image_data->height; y++) + for (x = 0; x < pn_image_data->width; x++) + { + pn_image_data->surface[1][PN_IMG_INDEX(x, pn_image_data->height - y)] = + pn_image_data->surface[0][PN_IMG_INDEX(x, y)]; + } + } + + pn_swap_surfaces (); +} + +struct pn_actuator_desc builtin_general_flip = +{ + "general_flip", "Flip Surface", "Flips the surface.", + 0, general_flip_opts, + NULL, NULL, general_flip_exec +};