changeset 174:3d98be3d74c2 trunk

[svn] - mosaic effect (in progress, custom size will be in the next commit) - new preset: retroscope which demonstrates it ;)
author nenolod
date Wed, 01 Nov 2006 00:54:36 -0800
parents 4494b6141b65
children 5635841a0686
files ChangeLog src/paranormal/builtins.c src/paranormal/general.c src/paranormal/presets/Makefile src/paranormal/presets/nenolod_-_retroscope.pnv
diffstat 5 files changed, 83 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 31 23:43:46 2006 -0800
+++ b/ChangeLog	Wed Nov 01 00:54:36 2006 -0800
@@ -1,3 +1,14 @@
+2006-11-01 07:43:46 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [346]
+  - branchscope preset... a very advanced example of branching, multiple 
+    branches and well, if you didn't know better, you'd probably call it a 
+    demo. ;)
+  
+  trunk/src/paranormal/presets/Makefile                  |    3 
+  trunk/src/paranormal/presets/nenolod_-_branchscope.pnv |   98 +++++++++++++++++
+  2 files changed, 100 insertions(+), 1 deletion(-)
+
+
 2006-11-01 07:24:22 +0000  William Pitcock <nenolod@nenolod.net>
   revision [344]
   - fix typoes
--- a/src/paranormal/builtins.c	Tue Oct 31 23:43:46 2006 -0800
+++ b/src/paranormal/builtins.c	Wed Nov 01 00:54:36 2006 -0800
@@ -25,6 +25,7 @@
 /* **************** general **************** */
 DECLARE_ACTUATOR (general_fade);
 DECLARE_ACTUATOR (general_blur);
+DECLARE_ACTUATOR (general_mosaic);
 
 /* **************** wave **************** */
 DECLARE_ACTUATOR (wave_horizontal);
@@ -56,6 +57,7 @@
   /* **************** general **************** */
   &builtin_general_fade,
   &builtin_general_blur,
+  &builtin_general_mosaic,
   /* **************** wave **************** */
   &builtin_wave_horizontal,
   &builtin_wave_vertical,
--- a/src/paranormal/general.c	Tue Oct 31 23:43:46 2006 -0800
+++ b/src/paranormal/general.c	Wed Nov 01 00:54:36 2006 -0800
@@ -94,3 +94,48 @@
   0, NULL,
   NULL, NULL, general_blur_exec
 };
+
+/* **************** general_mosaic **************** */
+/* FIXME: add a variable radius */
+/* FIXME: SPEEEED */
+static void
+general_mosaic_exec (const struct pn_actuator_option *opts,
+	   gpointer data)
+{
+  int i,j;
+  register guchar *srcptr = pn_image_data->surface[0];
+  register guchar *destptr = pn_image_data->surface[1];
+  register int sum;
+
+  for (j=0; j<pn_image_data->height; j += 6)
+    for (i=0; i<pn_image_data->width; i += 6)
+      {
+        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++)
+            {
+               guchar val = srcptr[PN_IMG_INDEX(i + ii,  j + jj)];
+
+               if (val > bval)
+                 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++)
+            {
+               destptr[PN_IMG_INDEX(i + ii, j + jj)] = bval;
+            }
+      }
+
+  pn_swap_surfaces ();
+}
+
+struct pn_actuator_desc builtin_general_mosaic = 
+{
+  "general_mosaic", "Mosaic", "A simple 6 pixel radius Mosaic",
+  0, NULL,
+  NULL, NULL, general_mosaic_exec
+};
--- a/src/paranormal/presets/Makefile	Tue Oct 31 23:43:46 2006 -0800
+++ b/src/paranormal/presets/Makefile	Wed Nov 01 00:54:36 2006 -0800
@@ -11,6 +11,7 @@
 	nenolod_-_psuedo_starfield.pnv:$(presetsdir)	\
 	nenolod_-_quakingscope.pnv:$(presetsdir)	\
 	nenolod_-_beatscope.pnv:$(presetsdir)		\
-	nenolod_-_branchscope.pnv:$(presetsdir)
+	nenolod_-_branchscope.pnv:$(presetsdir)		\
+	nenolod_-_retroscope.pnv:$(presetsdir)
 
 include ../../../mk/objective.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/paranormal/presets/nenolod_-_retroscope.pnv	Wed Nov 01 00:54:36 2006 -0800
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+
+<paranormal_preset>
+ <container_simple>
+  <container_once>
+   <cmap_bwgradient>
+    <low_index> 0 </low_index>
+    <high_index> 255 </high_index>
+    <color> 119, 239, 163 </color>
+   </cmap_bwgradient>
+  </container_once>
+  <general_fade>
+   <amount> 255 </amount>
+  </general_fade>
+  <wave_horizontal>
+   <channels> -1 </channels>
+  </wave_horizontal>
+  <general_blur>
+  </general_blur>
+  <general_mosaic>
+  </general_mosaic>
+ </container_simple>
+</paranormal_preset>
\ No newline at end of file