mistelix r10 - in trunk: . src src/core



Author: jmas
Date: Fri Apr  3 18:35:42 2009
New Revision: 10
URL: http://svn.gnome.org/viewvc/mistelix?rev=10&view=rev

Log:
2009-04-03 Jordi Mas <jmas softcatala org>

	* Makefile.am: mistelix.pc support
	* mistelix.pc.in: pkg-config file
	* src/mistelix.cs: fixes debugger output
	* src/core/SlideImage.cs: fixes and conversions

2009-03-31 Jordi Mas <jmas softcatala org>

	* src/core/SlideImage.cs: Define properties
	* src/core/MistelixLib.cs: Use properties to access slide image data
	* extensions/Effects/Brightness/: Use properties to access data
	* src/mistelix.cs: Better debug parameter handling



Added:
   trunk/mistelix.pc.in
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/configure.in
   trunk/src/core/SlideImage.cs
   trunk/src/mistelix.cs

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Fri Apr  3 18:35:42 2009
@@ -13,6 +13,9 @@
 desktop_files=$(desktop_in_files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
 
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = mistelix.pc
+
 Applicationsdir = $(datadir)/applications
 Applications_DATA = $(desktop_files)
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Fri Apr  3 18:35:42 2009
@@ -123,6 +123,7 @@
 
 AC_OUTPUT([
 Makefile
+mistelix.pc
 data/Makefile
 src/Defines.cs
 src/Makefile

Added: trunk/mistelix.pc.in
==============================================================================
--- (empty file)
+++ trunk/mistelix.pc.in	Fri Apr  3 18:35:42 2009
@@ -0,0 +1,8 @@
+prefix= prefix@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+
+Name: Mistelix
+Description: DVDs and slideshows
+Version: @VERSION@
+Libs: -r:${libdir}/mistelix/mistelix.exe

Modified: trunk/src/core/SlideImage.cs
==============================================================================
--- trunk/src/core/SlideImage.cs	(original)
+++ trunk/src/core/SlideImage.cs	Fri Apr  3 18:35:42 2009
@@ -1,5 +1,5 @@
 //
-// Copyright (C) 2008 Jordi Mas i Hernandez, jmas softcatala org
+// Copyright (C) 2008-2009 Jordi Mas i Hernandez, jmas softcatala org
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -87,7 +87,7 @@
 		public SlideImage (string image, string title, int time, string transition) : this ()
 		{
 			if (transition == null)
-				throw new ArgumentNullException ("effect cannot be null");
+				throw new ArgumentNullException ("transition cannot be null");
 
 			if (image == null)
 				throw new ArgumentNullException ("image name cannot be null");
@@ -115,8 +115,11 @@
 		[System.Xml.Serialization.XmlIgnoreAttribute]
 		public byte[] Pixels {
 			get {
-				if (pixels == null)
+				if (pixels == null) {
 					LoadAndScaleImage ();
+					ProcessEffects ();
+					ProcessImage ();
+				}
 
 				return pixels;
 			}
@@ -308,22 +311,40 @@
 
 		void ProcessImage ()
 		{
-			Logger.Debug ("SlideImage.ProcessImage {0}", image);
+			Logger.Debug ("SlideImage.ProcessImage {0} Channels {1}", image, Channels);
 
-			if (Title == null)
+			if (Title == null  || Title == string.Empty) 
 				return;
 
-			if (Title == string.Empty)
-				throw new Exception ("Not expecting an empty.string here");
-
 			Logger.Debug ("SlideImage.ProcessImage {0}", image);
 
-			DataImageSurface pix = new DataImageSurface (DataImageSurface.Allocate (Pixels), Cairo.Format.Argb32, width, height, stride);
-			Cairo.Context gr = new Cairo.Context (pix);
+			byte[] pix;
+
+			if (channels == 3) {
+				int src = 0;
+				byte [] source;
+
+				int stride_trg = 4 * width;
+				int len_trg = stride_trg * height;
+				source = Pixels;
+				pix = new byte [len_trg];
+							
+				for (int trg = 0; trg < len_trg; trg = trg + 4) {
+					pix [trg]      = source [src + 2];
+					pix [trg + 1]  = source [src + 1];
+					pix [trg + 2]  = source [src + 0];
+					pix [trg + 3]  = 0xff;
+					src += 3;
+				}
+			} else
+				pix = Pixels;
+
+			DataImageSurface surface = new DataImageSurface (DataImageSurface.Allocate (pix), Cairo.Format.Argb32, width, height, stride);
+			Cairo.Context gr = new Cairo.Context (surface);
 			DrawImageLegend (gr, Title, offset_x, offset_y,  w, h);
-			FromImage (pix);
+			FromImage (surface);
 			((IDisposable)gr).Dispose ();
-			((IDisposable)pix).Dispose ();
+			((IDisposable)surface).Dispose ();
 		}
 
 		public void ProcessEffects ()

Modified: trunk/src/mistelix.cs
==============================================================================
--- trunk/src/mistelix.cs	(original)
+++ trunk/src/mistelix.cs	Fri Apr  3 18:35:42 2009
@@ -73,6 +73,13 @@
 		{
 			base_dir = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), Defines.APPNAME_LOWER);
 			preferences = new Preferences ();
+
+			if (String.Compare (Environment.GetEnvironmentVariable ("MISTELIX_DEBUG"), "true", false) == 0) { 
+					debugging = true;
+				Logger.LogLevel = Level.DEBUG;
+				Logger.LogDevice = new FileLogger ();
+			}
+
 		}
 
 		public Mistelix (string [] args, params object [] props)
@@ -98,13 +105,7 @@
 			foreach (TypeExtensionNode node in EffectManager.List) {
 				Logger.Info ("Extension:" + node.CreateInstance ());
 			}
-
-			if (String.Compare (Environment.GetEnvironmentVariable ("MISTELIX_DEBUG"), "true", false) == 0) { 
-				debugging = true;
-				Logger.LogLevel = Level.DEBUG;
-				Logger.LogDevice = new FileLogger ();
-			}
-
+			
 			OnProjectView ();
 
 			//project = authoring_view.Project = element_view.Project = new Project ();



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