f-spot r4205 - in trunk: . src src/ColorAdjustment



Author: rubenv
Date: Fri Jul 25 23:28:19 2008
New Revision: 4205
URL: http://svn.gnome.org/viewvc/f-spot?rev=4205&view=rev

Log:
2008-07-26  Ruben Vermeersch  <ruben savanne be>

	Move the ColorAdjustment classes into a separate FSpot.ColorAdjustment
	namespace and folder, split out the editors. More color filters will be
	ported into this common framework, together with test fixtures.

	* src/ColorAdjustment.cs: Replaced with src/ColorAdjustment/ColorAdjustment.cs.
	* src/ColorAdjustment/Desaturate.cs: Added.
	* src/ColorAdjustment/SepiaTone.cs: Added.
	* src/Makefile.am: Update build.
	* src/PhotoView.cs: Update namespaces.


Added:
   trunk/src/ColorAdjustment/
   trunk/src/ColorAdjustment/ColorAdjustment.cs
      - copied, changed from r4204, /trunk/src/ColorAdjustment.cs
   trunk/src/ColorAdjustment/Desaturate.cs
   trunk/src/ColorAdjustment/SepiaTone.cs
Removed:
   trunk/src/ColorAdjustment.cs
Modified:
   trunk/ChangeLog
   trunk/src/Makefile.am
   trunk/src/PhotoView.cs

Copied: trunk/src/ColorAdjustment/ColorAdjustment.cs (from r4204, /trunk/src/ColorAdjustment.cs)
==============================================================================
--- /trunk/src/ColorAdjustment.cs	(original)
+++ trunk/src/ColorAdjustment/ColorAdjustment.cs	Fri Jul 25 23:28:19 2008
@@ -5,6 +5,7 @@
  *
  * Author
  *   Larry Ewing <lewing novell com>
+ *   Ruben Vermeersch <ruben savanne be>
  *
  * See COPYING for license information
  *
@@ -13,12 +14,11 @@
 using Gdk;
 using System.Collections.Generic;
 
-namespace FSpot {
+namespace FSpot.ColorAdjustment {
 	public abstract class ColorAdjustment {
-		protected List <Cms.Profile> profiles;
-		protected Cms.Profile adjustment_profile;
+		private List <Cms.Profile> profiles;
 		protected int nsteps = 20;
-		protected Cms.Intent intent = Cms.Intent.Perceptual;
+		private Cms.Intent intent = Cms.Intent.Perceptual;
 
 		// This is the input pixbuf, on which the adjustment will be performed.
 		private readonly Gdk.Pixbuf Input;
@@ -51,7 +51,7 @@
 			this.input_profile = input_profile;
 		}
 
-		protected abstract void GenerateAdjustments ();
+		protected abstract List <Cms.Profile> GenerateAdjustments ();
 
 		public Pixbuf Adjust ()
 		{
@@ -61,7 +61,7 @@
 							   Input.Height);
 			profiles = new List <Cms.Profile> (4);
 			profiles.Add (InputProfile);
-			GenerateAdjustments ();
+			profiles.AddRange (GenerateAdjustments ());
 			profiles.Add (DestinationProfile);
 			Cms.Profile [] list = profiles.ToArray ();
 			
@@ -89,52 +89,4 @@
 			return final;
 		}
 	}
-
-	public class SepiaTone : ColorAdjustment {
-		public SepiaTone (Pixbuf input, Cms.Profile input_profile) : base (input, input_profile)
-		{
-		}
-
-		protected override void GenerateAdjustments ()
-		{
-			profiles.Add (Cms.Profile.CreateAbstract (nsteps,
-								  1.0,
-								  0.0,
-								  0.0,
-								  0.0,
-								  -100.0,
-								  null,
-								  ColorCIExyY.D50,
-								  ColorCIExyY.D50));
-
-			profiles.Add (Cms.Profile.CreateAbstract (nsteps,
-								  1.0,
-								  32.0,
-								  0.0,
-								  0.0,
-								  0.0,
-								  null,
-								  ColorCIExyY.D50,
-								  ColorCIExyY.WhitePointFromTemperature (9934)));
-		}
-	}
-
-	public class Desaturate : ColorAdjustment {
-		public Desaturate (Pixbuf input, Cms.Profile input_profile) : base (input, input_profile)
-		{
-		}
-
-		protected override void GenerateAdjustments ()
-		{
-			profiles.Add (Cms.Profile.CreateAbstract (nsteps,
-								  1.0,
-								  0.0,
-								  0.0,
-								  0.0,
-								  -100.0,
-								  null,
-								  ColorCIExyY.D50,
-								  ColorCIExyY.D50));
-		}
-	}
 }

Added: trunk/src/ColorAdjustment/Desaturate.cs
==============================================================================
--- (empty file)
+++ trunk/src/ColorAdjustment/Desaturate.cs	Fri Jul 25 23:28:19 2008
@@ -0,0 +1,38 @@
+/*
+ * Desaturate.cs
+ * 
+ * Copyright 2006, 2007 Novell Inc.
+ *
+ * Author
+ *   Larry Ewing <lewing novell com>
+ *   Ruben Vermeersch <ruben savanne be>
+ *
+ * See COPYING for license information
+ *
+ */
+using Cms;
+using Gdk;
+using System.Collections.Generic;
+
+namespace FSpot.ColorAdjustment {
+	public class Desaturate : ColorAdjustment {
+		public Desaturate (Pixbuf input, Cms.Profile input_profile) : base (input, input_profile)
+		{
+		}
+
+		protected override List <Cms.Profile> GenerateAdjustments ()
+		{
+			List <Cms.Profile> profiles = new List <Cms.Profile> ();
+			profiles.Add (Cms.Profile.CreateAbstract (nsteps,
+								  1.0,
+								  0.0,
+								  0.0,
+								  0.0,
+								  -100.0,
+								  null,
+								  ColorCIExyY.D50,
+								  ColorCIExyY.D50));
+			return profiles;
+		}
+	}
+}

Added: trunk/src/ColorAdjustment/SepiaTone.cs
==============================================================================
--- (empty file)
+++ trunk/src/ColorAdjustment/SepiaTone.cs	Fri Jul 25 23:28:19 2008
@@ -0,0 +1,48 @@
+/*
+ * SepiaTone.cs
+ * 
+ * Copyright 2006, 2007 Novell Inc.
+ *
+ * Author
+ *   Larry Ewing <lewing novell com>
+ *   Ruben Vermeersch <ruben savanne be>
+ *
+ * See COPYING for license information
+ *
+ */
+using Cms;
+using Gdk;
+using System.Collections.Generic;
+
+namespace FSpot.ColorAdjustment {
+	public class SepiaTone : ColorAdjustment {
+		public SepiaTone (Pixbuf input, Cms.Profile input_profile) : base (input, input_profile)
+		{
+		}
+
+		protected override List <Cms.Profile> GenerateAdjustments ()
+		{
+			List <Cms.Profile> profiles = new List <Cms.Profile> ();
+			profiles.Add (Cms.Profile.CreateAbstract (nsteps,
+								  1.0,
+								  0.0,
+								  0.0,
+								  0.0,
+								  -100.0,
+								  null,
+								  ColorCIExyY.D50,
+								  ColorCIExyY.D50));
+
+			profiles.Add (Cms.Profile.CreateAbstract (nsteps,
+								  1.0,
+								  32.0,
+								  0.0,
+								  0.0,
+								  0.0,
+								  null,
+								  ColorCIExyY.D50,
+								  ColorCIExyY.WhitePointFromTemperature (9934)));
+			return profiles;
+		}
+	}
+}

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Fri Jul 25 23:28:19 2008
@@ -82,7 +82,9 @@
 	$(srcdir)/BitConverter.cs		\
 	$(srcdir)/PhotoArray.cs 		\
 	$(srcdir)/PhotoList.cs 		\
-	$(srcdir)/ColorAdjustment.cs		\
+	$(srcdir)/ColorAdjustment/ColorAdjustment.cs		\
+	$(srcdir)/ColorAdjustment/Desaturate.cs		\
+	$(srcdir)/ColorAdjustment/SepiaTone.cs		\
 	$(srcdir)/CompatFileChooser.cs		\
 	$(srcdir)/ControlOverlay.cs		\
 	$(srcdir)/Core.cs			\

Modified: trunk/src/PhotoView.cs
==============================================================================
--- trunk/src/PhotoView.cs	(original)
+++ trunk/src/PhotoView.cs	Fri Jul 25 23:28:19 2008
@@ -277,7 +277,7 @@
 			bool create_version = photo.DefaultVersion.IsProtected;
 	
 			try {
-				FSpot.SepiaTone sepia = new FSpot.SepiaTone (View.CompletePixbuf (), null);
+				FSpot.ColorAdjustment.SepiaTone sepia = new FSpot.ColorAdjustment.SepiaTone (View.CompletePixbuf (), null);
 				using (Pixbuf result = sepia.Adjust ()) {
 					photo.SaveVersion (result, create_version);
 					photo.Changes.DataChanged = true;
@@ -294,7 +294,7 @@
 			bool create_version = photo.DefaultVersion.IsProtected;
 	
 			try {
-				FSpot.Desaturate desaturate = new FSpot.Desaturate (View.CompletePixbuf (), null);
+				FSpot.ColorAdjustment.Desaturate desaturate = new FSpot.ColorAdjustment.Desaturate (View.CompletePixbuf (), null);
 				using (Pixbuf result = desaturate.Adjust ()) {
 					photo.SaveVersion (result, create_version);
 					photo.Changes.DataChanged = true;



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