[mistelix] BarnDoorWipe transitions



commit 169478f5e12a02585d1335d42ebff7daaab89813
Author: Dani Hernandez Juarez <dhernandez0 gmail com>
Date:   Thu May 21 23:10:03 2009 +0200

    BarnDoorWipe transitions
---
 configure.in                                       |    1 +
 .../BarnDoorWipe/BarnDoorWipe.addin.xml            |   18 ++++
 .../BarnDoorWipe/BarnDoorWipeHorizontal.cs         |   81 +++++++++++++++++++
 .../BarnDoorWipe/BarnDoorWipeVertical.cs           |   82 ++++++++++++++++++++
 .../SlideTransitions/BarnDoorWipe/Makefile.am      |   40 ++++++++++
 extensions/SlideTransitions/Makefile.am            |    3 +-
 6 files changed, 224 insertions(+), 1 deletions(-)

diff --git a/configure.in b/configure.in
index 3e96f2a..74ec42a 100644
--- a/configure.in
+++ b/configure.in
@@ -134,6 +134,7 @@ extensions/Makefile
 extensions/SlideTransitions/Makefile
 extensions/SlideTransitions/Fade/Makefile
 extensions/SlideTransitions/BarWipe/Makefile
+extensions/SlideTransitions/BarnDoorWipe/Makefile
 extensions/Effects/Makefile
 extensions/Effects/Grayscale/Makefile
 extensions/Effects/SepiaTone/Makefile
diff --git a/extensions/SlideTransitions/BarnDoorWipe/BarnDoorWipe.addin.xml b/extensions/SlideTransitions/BarnDoorWipe/BarnDoorWipe.addin.xml
new file mode 100755
index 0000000..a76b2d1
--- /dev/null
+++ b/extensions/SlideTransitions/BarnDoorWipe/BarnDoorWipe.addin.xml
@@ -0,0 +1,18 @@
+<Addin namespace="Mistelix"
+	version="0.20"
+	name="BarnDoorWipe"
+	description="BarnDoorWipe slideshow transitions"
+	author="Dani Hernandez"
+	url=""
+	defaultEnabled="true"
+	category="SlideTransitions">
+
+	<Dependencies>
+		<Addin id="Mistelix" version="0.20"/>
+	</Dependencies>
+
+	<Extension path="/Mistelix/SlideTransitions">
+		<SlideTransitions type="Mistelix.Transitions.BarnDoorWipeHorizontal" />
+		<SlideTransitions type="Mistelix.Transitions.BarnDoorWipeVertical" />
+	</Extension>
+</Addin>
diff --git a/extensions/SlideTransitions/BarnDoorWipe/BarnDoorWipeHorizontal.cs b/extensions/SlideTransitions/BarnDoorWipe/BarnDoorWipeHorizontal.cs
new file mode 100644
index 0000000..2bbcd50
--- /dev/null
+++ b/extensions/SlideTransitions/BarnDoorWipe/BarnDoorWipeHorizontal.cs
@@ -0,0 +1,81 @@
+//
+// Copyright (C) 2009 Dani Hernandez Juarez, dhernandez0 gmail com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Mistelix.DataModel;
+using Mono.Unix;
+
+namespace Mistelix.Transitions
+{
+	public class BarnDoorWipeHorizontal : Transition
+	{
+		public override string DisplayName {
+			get { return ( Catalog.GetString ("BarnDoorWipe horizontal")); }
+		}
+
+		public override string Name {
+			get { return ("barndoorwipehorizontal"); }
+		}
+
+		public override object Current { 
+			get {
+				return CreateImage ();
+			}
+		}
+		
+		private int num_lines_per_frame = -1;
+		private int half = -1;
+		
+		public SlideImage CreateImage ()
+		{
+			Console.WriteLine ("Create image {0}", CurrentFrame);
+			// can't calculate this in constructor because Source is null
+			if(num_lines_per_frame == -1) {
+				this.num_lines_per_frame = (int)Math.Ceiling((double) Source.Height / (double) Frames);
+				this.half = Source.Height / 2;
+				Console.WriteLine ("{0} {1}", num_lines_per_frame, half);
+			}
+			int current_num_line = CurrentFrame * num_lines_per_frame / 2;
+			int min_line = this.half - current_num_line;
+			int max_line = this.half + current_num_line;
+			SlideImage image = new SlideImage ();
+			image.CopyProperties (Source);
+			image.Pixels = new byte [Source.Stride * Source.Height];
+			
+			for (int h = 0; h < Source.Height; h++) {
+				int pos = h * Source.Stride;
+				if(h >= min_line && h <= max_line) {
+					for(int s = 0; s < Source.Stride; s++) {
+						image.Pixels[pos + s] = Target.Pixels[pos + s];
+					}
+				} else {
+					for(int s = 0; s < Source.Stride; s++) {
+						image.Pixels[pos + s] = Source.Pixels[pos + s];
+					}
+				}
+			}
+	
+			return image;
+		}
+	}
+}
diff --git a/extensions/SlideTransitions/BarnDoorWipe/BarnDoorWipeVertical.cs b/extensions/SlideTransitions/BarnDoorWipe/BarnDoorWipeVertical.cs
new file mode 100644
index 0000000..812ba59
--- /dev/null
+++ b/extensions/SlideTransitions/BarnDoorWipe/BarnDoorWipeVertical.cs
@@ -0,0 +1,82 @@
+//
+// Copyright (C) 2009 Dani Hernandez Juarez, dhernandez0 gmail com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Mistelix.DataModel;
+using Mono.Unix;
+
+namespace Mistelix.Transitions
+{
+	public class BarnDoorWipeVertical : Transition
+	{
+		public override string DisplayName {
+			get { return ( Catalog.GetString ("BarnDoorWipe vertical")); }
+		}
+
+		public override string Name {
+			get { return ("barndoorwipevertical"); }
+		}
+
+		public override object Current { 
+			get {
+				return CreateImage ();
+			}
+		}
+		
+		private int num_lines_per_frame = -1;
+		private int half = -1;
+		
+		public SlideImage CreateImage ()
+		{
+			// can't calculate this in constructor because Source is null
+			if(num_lines_per_frame == -1) {
+				this.num_lines_per_frame = (int)Math.Ceiling((double) Source.Width / (double) Frames);
+				this.half = Source.Width / 2;
+			}
+			int current_num_line = CurrentFrame * num_lines_per_frame / 2;
+			int min_line = this.half - current_num_line;
+			int max_line = this.half + current_num_line;
+			SlideImage image = new SlideImage ();
+			image.CopyProperties (Source);
+			image.Pixels = new byte [Source.Stride * Source.Height];
+
+			for (int h = 0; h < Source.Height; h++) {
+				int pos = h * Source.Stride;
+				for(int w = 0; w < Source.Width; w++) {
+					if(w >= min_line && w <= max_line) {
+						for(int c = 0; c < Source.Channels; c++) {
+							image.Pixels[pos + c] = Target.Pixels[pos + c];
+						}
+					} else {
+						for(int c = 0; c < Source.Channels; c++) {
+							image.Pixels[pos + c] = Source.Pixels[pos + c];
+						}
+					}
+					pos += Source.Channels;
+				}
+			}
+	
+			return image;
+		}
+	}
+}
diff --git a/extensions/SlideTransitions/BarnDoorWipe/Makefile.am b/extensions/SlideTransitions/BarnDoorWipe/Makefile.am
new file mode 100755
index 0000000..187a613
--- /dev/null
+++ b/extensions/SlideTransitions/BarnDoorWipe/Makefile.am
@@ -0,0 +1,40 @@
+PLUGIN_NAME = BarnDoorWipe
+
+PLUGIN_MANIFEST = $(PLUGIN_NAME).addin.xml
+
+PLUGIN_ASSEMBLY = $(PLUGIN_NAME).dll
+
+PLUGIN_SOURCES =			\
+	$(srcdir)/BarnDoorWipeHorizontal.cs \
+	$(srcdir)/BarnDoorWipeVertical.cs
+
+REFS =					\
+	-r:$(top_builddir)/src/mistelix.exe
+
+PKGS =					\
+	-pkg:gtk-sharp-2.0
+
+RESOURCES =				\
+	-resource:$(srcdir)/$(PLUGIN_MANIFEST)
+
+all: $(PLUGIN_ASSEMBLY)
+
+mpack: $(PLUGIN_ASSEMBLY)
+	mautil p $(PLUGIN_ASSEMBLY)
+
+$(PLUGIN_ASSEMBLY): $(PLUGIN_SOURCES) $(PLUGIN_MANIFEST)
+	$(CSC) -target:library -out:$@ $(CSC_DEFINES) $(PLUGIN_SOURCES) $(REFS) $(PKGS) $(ASSEMBLIES) $(RESOURCES) -r:Mono.Posix
+
+plugindir = $(pkglibdir)/extensions
+
+plugin_DATA =			\
+	$(PLUGIN_ASSEMBLY)
+
+EXTRA_DIST = 			\
+	$(PLUGIN_SOURCES)	\
+	$(PLUGIN_MANIFEST)
+
+CLEANFILES =			\
+	$(PLUGIN_ASSEMBLY)	\
+	$(PLUGIN_ASSEMBLY).mdb	\
+	*.mpack
diff --git a/extensions/SlideTransitions/Makefile.am b/extensions/SlideTransitions/Makefile.am
index 2843134..21e2c55 100644
--- a/extensions/SlideTransitions/Makefile.am
+++ b/extensions/SlideTransitions/Makefile.am
@@ -1,3 +1,4 @@
 SUBDIRS = 			\
 	Fade	\
-	BarWipe
+	BarWipe \
+	BarnDoorWipe



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]