# HG changeset patch # User nenolod # Date 1163979448 28800 # Node ID 8f4dc0d6392531665cd74965da96820ef3e95c11 # Parent 219e0641d917e428469ccd086072fd4df6fce886 [svn] - add surface flip diff -r 219e0641d917 -r 8f4dc0d63925 ChangeLog --- 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 + 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 revision [580] - another preset diff -r 219e0641d917 -r 8f4dc0d63925 src/paranormal/builtins.c --- 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 **************** */ diff -r 219e0641d917 -r 8f4dc0d63925 src/paranormal/general.c --- 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 +};