[mistelix] Star wipe extension
- From: Jordi Mas <jmas src gnome org>
- To: svn-commits-list gnome org
- Subject: [mistelix] Star wipe extension
- Date: Wed, 10 Jun 2009 13:19:15 -0400 (EDT)
commit 4e2b383467d562b3e970b5c410804e6965ffbc0d
Author: Hector Blanco de Frutos <hectorblanco gmail com>
Date: Wed Jun 10 19:19:16 2009 +0200
Star wipe extension
---
configure.in | 3 +-
extensions/SlideTransitions/Makefile.am | 3 +-
extensions/SlideTransitions/StarWipe/Makefile.am | 42 ++++++
.../SlideTransitions/StarWipe/StarWipe.addin.xml | 21 +++
extensions/SlideTransitions/StarWipe/StarWipe.cs | 136 ++++++++++++++++++++
.../SlideTransitions/StarWipe/StarWipeFivePoint.cs | 56 ++++++++
.../SlideTransitions/StarWipe/StarWipeFourPoint.cs | 56 ++++++++
.../SlideTransitions/StarWipe/StarWipeSixPoint.cs | 56 ++++++++
8 files changed, 371 insertions(+), 2 deletions(-)
diff --git a/configure.in b/configure.in
index 74ec42a..d93be09 100644
--- a/configure.in
+++ b/configure.in
@@ -132,9 +132,10 @@ po/Makefile.in
libmistelix/Makefile
extensions/Makefile
extensions/SlideTransitions/Makefile
-extensions/SlideTransitions/Fade/Makefile
extensions/SlideTransitions/BarWipe/Makefile
extensions/SlideTransitions/BarnDoorWipe/Makefile
+extensions/SlideTransitions/Fade/Makefile
+extensions/SlideTransitions/StarWipe/Makefile
extensions/Effects/Makefile
extensions/Effects/Grayscale/Makefile
extensions/Effects/SepiaTone/Makefile
diff --git a/extensions/SlideTransitions/Makefile.am b/extensions/SlideTransitions/Makefile.am
index 21e2c55..f30efe2 100644
--- a/extensions/SlideTransitions/Makefile.am
+++ b/extensions/SlideTransitions/Makefile.am
@@ -1,4 +1,5 @@
SUBDIRS = \
Fade \
BarWipe \
- BarnDoorWipe
+ BarnDoorWipe \
+ StarWipe
diff --git a/extensions/SlideTransitions/StarWipe/Makefile.am b/extensions/SlideTransitions/StarWipe/Makefile.am
new file mode 100644
index 0000000..559a903
--- /dev/null
+++ b/extensions/SlideTransitions/StarWipe/Makefile.am
@@ -0,0 +1,42 @@
+PLUGIN_NAME = StarWipe
+
+PLUGIN_MANIFEST = $(PLUGIN_NAME).addin.xml
+
+PLUGIN_ASSEMBLY = $(PLUGIN_NAME).dll
+
+PLUGIN_SOURCES = \
+ $(srcdir)/StarWipe.cs \
+ $(srcdir)/StarWipeFivePoint.cs \
+ $(srcdir)/StarWipeFourPoint.cs \
+ $(srcdir)/StarWipeSixPoint.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 -r:Mono.Cairo
+
+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/StarWipe/StarWipe.addin.xml b/extensions/SlideTransitions/StarWipe/StarWipe.addin.xml
new file mode 100644
index 0000000..022cef5
--- /dev/null
+++ b/extensions/SlideTransitions/StarWipe/StarWipe.addin.xml
@@ -0,0 +1,21 @@
+<Addin namespace="Mistelix"
+ version="0.20"
+ name="StarWipe"
+ description="StarWipe slideshow transition"
+ author="Hector Blanco de Frutos"
+ url=""
+ defaultEnabled="true"
+ category="SlideTransitions">
+
+ <Dependencies>
+ <Addin id="Mistelix" version="0.20"/>
+ </Dependencies>
+
+ <Extension path="/Mistelix/SlideTransitions">
+ <SlideTransitions type="Mistelix.Transitions.StarWipeFourPoint" />
+ <SlideTransitions type="Mistelix.Transitions.StarWipeFivePoint" />
+ <SlideTransitions type="Mistelix.Transitions.StarWipeSixPoint" />
+ </Extension>
+
+</Addin>
+
diff --git a/extensions/SlideTransitions/StarWipe/StarWipe.cs b/extensions/SlideTransitions/StarWipe/StarWipe.cs
new file mode 100644
index 0000000..845ef2b
--- /dev/null
+++ b/extensions/SlideTransitions/StarWipe/StarWipe.cs
@@ -0,0 +1,136 @@
+//
+// Copyright (C) 2009 Hector Blanco de Frutos, hectorblanco 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;
+using Mistelix;
+using Cairo;
+
+using Mistelix.Widgets;
+using Mistelix.Core;
+
+namespace Mistelix.Transitions
+{
+ public abstract class StarWipe: Transition
+ {
+ protected SlideImage CreateImage (int points, double radius)
+ {
+ double percentage;
+
+ percentage = ((1d / Frames) * CurrentFrame);
+ SlideImage image = new SlideImage ();
+ image.CopyProperties (Source);
+ image.Pixels = new byte [Target.Stride * Target.Height];
+
+ SlideImage tmp = new SlideImage ();
+ tmp.CopyProperties (Target);
+
+ double cx = Convert.ToInt32 ((Source.Width / 2));
+ double cy = Convert.ToInt32 ((Source.Height / 2));
+ double r1 = Target.Width * percentage;
+ double r2 = Target.Width * percentage * 0.5;
+ int pixels = 0;
+
+ DataImageSurface draw = Source.ToDataImageSurface ();
+
+ using (Context gr = new Context (draw))
+ {
+ // First paint in black the image.
+ gr.Save ();
+ gr.MoveTo (0,0);
+ gr.LineTo (Target.Width, 0);
+ gr.LineTo (Target.Width, Target.Height);
+ gr.LineTo (0, Source.Height);
+ gr.ClosePath ();
+ gr.Color = new Color (0,0,0);
+ gr.Fill ();
+ gr.Save ();
+
+ double x, y;
+ double x1, y1;
+ // Draw the points of the star, creating a path with a line
+ for (int i = 0; i < points; i = i + 2)
+ {
+ x = cx + (r1 * System.Math.Cos (i * radius - System.Math.PI / 2));
+ y = cy + (r1 * System.Math.Sin (i * radius - System.Math.PI / 2));
+ gr.LineTo (new PointD (x, y));
+
+ x1 = cx + (r2 * System.Math.Cos ((i + 1) * radius - System.Math.PI / 2));
+ y1 = cy + (r2 * System.Math.Sin ((i + 1) * radius - System.Math.PI / 2));
+ gr.LineTo (new PointD (x1, y1));
+ }
+
+ gr.ClosePath ();
+ // Fill the resulting polygon with a color
+ gr.Color = new Color (1, 115, 0);
+ gr.Fill ();
+ gr.Restore ();
+ tmp.Pixels = draw.Get24bitsPixBuf ();
+
+ bool sourced = percentage < 0.5;
+
+ if (sourced)
+ Array.Copy (Source.Pixels, image.Pixels, Source.Stride * Source.Height);
+ else
+ Array.Copy (Target.Pixels, image.Pixels, Target.Stride * Target.Height);
+
+ // Draw target image to the star
+ // Compare Target picture with the temporary
+ // If in the temporary we have found a black pixel, draw a pixel from the Source slide
+ // If in the temporary we have found a non-black pixel, draw a pixel from the Target slide
+ for (int h = 0; h < Target.Height; h++)
+ {
+ int pos = h * Target.Stride;
+ int posTMP = h * Target.Width * Target.Channels;
+ for (int w = 0; w < Target.Width; w++)
+ {
+ if (tmp.Pixels[posTMP] != 0) {
+ if (sourced) {
+ for (int c = 0; c < Target.Channels; c++)
+ {
+ image.Pixels[pos + c] = Target.Pixels[pos + c];
+ pixels++;
+ }
+ }
+ }else{
+ if (sourced == false) {
+ for (int c = 0; c < Target.Channels; c++)
+ {
+ image.Pixels[pos + c] = Source.Pixels[pos + c];
+ pixels++;
+ }
+ }
+ }
+
+ pos += Target.Channels;
+ posTMP += Target.Channels;
+ }
+ }
+ }
+
+ ((IDisposable) draw).Dispose ();
+ return image;
+ }
+ }
+}
diff --git a/extensions/SlideTransitions/StarWipe/StarWipeFivePoint.cs b/extensions/SlideTransitions/StarWipe/StarWipeFivePoint.cs
new file mode 100644
index 0000000..f031725
--- /dev/null
+++ b/extensions/SlideTransitions/StarWipe/StarWipeFivePoint.cs
@@ -0,0 +1,56 @@
+//
+// Copyright (C) 2009 Hector Blanco de Frutos, hectorblanco 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;
+using Mistelix;
+using Cairo;
+
+using Mistelix.Widgets;
+using Mistelix.Core;
+
+namespace Mistelix.Transitions
+{
+ public class StarWipeFivePoint: StarWipe
+ {
+ public override string DisplayName {
+ get { return ( Catalog.GetString ("Star Wipe (five points)")); }
+ }
+
+ public override string Name {
+ get { return ("StarWipeFivePoint"); }
+ }
+
+ public override object Current {
+ get {
+ return CreateImage ();
+ }
+ }
+
+ public SlideImage CreateImage ()
+ {
+ return CreateImage (9, System.Math.PI / 5);
+ }
+ }
+}
diff --git a/extensions/SlideTransitions/StarWipe/StarWipeFourPoint.cs b/extensions/SlideTransitions/StarWipe/StarWipeFourPoint.cs
new file mode 100644
index 0000000..ca917d1
--- /dev/null
+++ b/extensions/SlideTransitions/StarWipe/StarWipeFourPoint.cs
@@ -0,0 +1,56 @@
+//
+// Copyright (C) 2009 Hector Blanco de Frutos, hectorblanco 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;
+using Mistelix;
+using Cairo;
+
+using Mistelix.Widgets;
+using Mistelix.Core;
+
+namespace Mistelix.Transitions
+{
+ public class StarWipeFourPoint: StarWipe
+ {
+ public override string DisplayName {
+ get { return ( Catalog.GetString ("Star Wipe (four points)")); }
+ }
+
+ public override string Name {
+ get { return ("StarWipeFourPoint"); }
+ }
+
+ public override object Current {
+ get {
+ return CreateImage ();
+ }
+ }
+
+ public SlideImage CreateImage ()
+ {
+ return CreateImage (7, System.Math.PI / 4);
+ }
+ }
+}
diff --git a/extensions/SlideTransitions/StarWipe/StarWipeSixPoint.cs b/extensions/SlideTransitions/StarWipe/StarWipeSixPoint.cs
new file mode 100644
index 0000000..34ff2bb
--- /dev/null
+++ b/extensions/SlideTransitions/StarWipe/StarWipeSixPoint.cs
@@ -0,0 +1,56 @@
+//
+// Copyright (C) 2009 Hector Blanco de Frutos, hectorblanco 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;
+using Mistelix;
+using Cairo;
+
+using Mistelix.Widgets;
+using Mistelix.Core;
+
+namespace Mistelix.Transitions
+{
+ public class StarWipeSixPoint: StarWipe
+ {
+ public override string DisplayName {
+ get { return ( Catalog.GetString ("Star Wipe (six points)")); }
+ }
+
+ public override string Name {
+ get { return ("StarWipeSixPoint"); }
+ }
+
+ public override object Current {
+ get {
+ return CreateImage ();
+ }
+ }
+
+ public SlideImage CreateImage ()
+ {
+ return CreateImage (11, System.Math.PI / 6);
+ }
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]