[f-spot] moving PixbufOrientation to FSpot.Utils



commit 88932a1aa2c3e412dae679a999b60f1e46dfee8a
Author: Stephane Delcroix <stephane delcroix org>
Date:   Wed Jun 17 16:01:05 2009 +0200

    moving PixbufOrientation to FSpot.Utils
    
    moving PixbufOrientation enum and related static methods to Utils/PixbufOrientation.cs, so I can use it in Widgets

 src/Accelerometer.cs             |    6 ++-
 src/Filters/OrientationFilter.cs |    2 +
 src/Imaging/Ciff.cs              |    1 +
 src/Imaging/JpegFile.cs          |    1 +
 src/Imaging/JpegHeader.cs        |    1 +
 src/Imaging/RafFile.cs           |    2 +
 src/Imaging/Tiff.cs              |    1 +
 src/Imaging/X3fFile.cs           |    1 +
 src/Makefile.am                  |    1 +
 src/MetadataStore.cs             |    1 +
 src/PixbufUtils.cs               |   61 +++++++-------------------------------
 src/RotateCommand.cs             |    6 ++-
 12 files changed, 30 insertions(+), 54 deletions(-)
---
diff --git a/src/Accelerometer.cs b/src/Accelerometer.cs
index 7c7ce1d..26080cc 100644
--- a/src/Accelerometer.cs
+++ b/src/Accelerometer.cs
@@ -5,6 +5,8 @@
 using System;
 using System.IO;
 
+using FSpot.Utils;
+
 namespace FSpot {
 
 	public class Accelerometer {
@@ -36,10 +38,10 @@ namespace FSpot {
 				SetupAccelerometer ();
 				
 			if (current_orientation == Orient.TiltCounterclockwise)
-				return PixbufUtils.Rotate90 (po);
+				return FSpot.Utils.PixbufUtils.Rotate90 (po);
 
 			if (current_orientation == Orient.TiltClockwise)
-				return PixbufUtils.Rotate270 (po);
+				return FSpot.Utils.PixbufUtils.Rotate270 (po);
 
 			return po;
 		}
diff --git a/src/Filters/OrientationFilter.cs b/src/Filters/OrientationFilter.cs
index d0a448d..0b5154d 100644
--- a/src/Filters/OrientationFilter.cs
+++ b/src/Filters/OrientationFilter.cs
@@ -9,6 +9,8 @@
  *
  */
 
+using FSpot.Utils;
+
 namespace FSpot.Filters {
 	public class OrientationFilter : IFilter {
 		public bool Convert (FilterRequest req)
diff --git a/src/Imaging/Ciff.cs b/src/Imaging/Ciff.cs
index 0e213db..b59605f 100644
--- a/src/Imaging/Ciff.cs
+++ b/src/Imaging/Ciff.cs
@@ -1,4 +1,5 @@
 using System;
+using FSpot.Utils;
 
 namespace FSpot.Ciff {
 	public enum Tag {
diff --git a/src/Imaging/JpegFile.cs b/src/Imaging/JpegFile.cs
index b9b418c..f54fadf 100644
--- a/src/Imaging/JpegFile.cs
+++ b/src/Imaging/JpegFile.cs
@@ -3,6 +3,7 @@ using System;
 using System.IO;
 using FSpot.Xmp;
 using FSpot.Tiff;
+using FSpot.Utils;
 
 namespace FSpot {
 	public interface IThumbnailContainer {
diff --git a/src/Imaging/JpegHeader.cs b/src/Imaging/JpegHeader.cs
index 2543ca6..1fd2e5a 100644
--- a/src/Imaging/JpegHeader.cs
+++ b/src/Imaging/JpegHeader.cs
@@ -22,6 +22,7 @@ using System.IO;
 using System.Collections;
 using FSpot.Xmp;
 using FSpot;
+using FSpot.Utils;
 
 #if ENABLE_NUNIT
 using NUnit.Framework;
diff --git a/src/Imaging/RafFile.cs b/src/Imaging/RafFile.cs
index 43f6c7b..f873d27 100644
--- a/src/Imaging/RafFile.cs
+++ b/src/Imaging/RafFile.cs
@@ -1,3 +1,5 @@
+using FSpot.Utils;
+
 namespace FSpot.Raf {
 	// This is reverse engineered from looking at the sample files I have
 	// from what I can tell the file is always BigEndian, although the embedded jpeg may not be
diff --git a/src/Imaging/Tiff.cs b/src/Imaging/Tiff.cs
index d56c16c..4dc86c2 100644
--- a/src/Imaging/Tiff.cs
+++ b/src/Imaging/Tiff.cs
@@ -1,5 +1,6 @@
 //#define DEBUG_LOADER
 using FSpot;
+using FSpot.Utils;
 using SemWeb;
 using System;
 using System.IO;
diff --git a/src/Imaging/X3fFile.cs b/src/Imaging/X3fFile.cs
index aff75d4..e152543 100644
--- a/src/Imaging/X3fFile.cs
+++ b/src/Imaging/X3fFile.cs
@@ -1,6 +1,7 @@
 using System;
 using System.IO;
 using FSpot;
+using FSpot.Utils;
 using SemWeb;
 
 namespace FSpot.X3f {
diff --git a/src/Makefile.am b/src/Makefile.am
index 9459cd3..5b41601 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,6 +55,7 @@ UTILS_CSDISTFILES =				\
 	$(srcdir)/Utils/GdkUtils.cs		\
 	$(srcdir)/Utils/GtkUtil.cs		\
 	$(srcdir)/Utils/Log.cs			\
+	$(srcdir)/Utils/PixbufOrientation.cs	\
 	$(srcdir)/Utils/Unix.cs			\
 	$(srcdir)/Utils/UriUtils.cs
 
diff --git a/src/MetadataStore.cs b/src/MetadataStore.cs
index ab43cdd..8e407bf 100644
--- a/src/MetadataStore.cs
+++ b/src/MetadataStore.cs
@@ -2,6 +2,7 @@ using SemWeb;
 using SemWeb.Util;
 using Mono.Unix;
 using FSpot.Xmp;
+using FSpot.Utils;
 
 namespace FSpot {
         internal class Description {
diff --git a/src/PixbufUtils.cs b/src/PixbufUtils.cs
index 5de2ba8..7af1861 100644
--- a/src/PixbufUtils.cs
+++ b/src/PixbufUtils.cs
@@ -1,3 +1,14 @@
+//
+// FSpot.PixbufUtils.cs
+//
+// Author(s):
+//	Ettore Perazzoli
+//	Larry Ewing  <lewing novell com>
+//	Stephane Delcroix  <stephane declroix org>
+//
+// This is free softwae. See cOPYING for details
+//
+
 using Gdk;
 using System.Collections;
 using System.Runtime.InteropServices;
@@ -6,57 +17,7 @@ using System.IO;
 using FSpot;
 using FSpot.Utils;
 
-/**
-  1        2       3      4         5            6           7          8
-
-888888  888888      88  88      8888888888  88                  88  8888888888
-88          88      88  88      88  88      88  88          88  88      88  88
-8888      8888    8888  8888    88          8888888888  8888888888          88
-88          88      88  88
-88          88  888888  888888
-
-t-l     t-r     b-r     b-l     l-t         r-t         r-b             l-b
-
-**/
-
-public enum PixbufOrientation {
-	TopLeft = 1,
-	TopRight = 2,
-	BottomRight = 3,
-	BottomLeft = 4,
-	LeftTop = 5,
-	RightTop = 6,
-	RightBottom = 7,
-	LeftBottom = 8
-}
-
 public class PixbufUtils {
-		
-	static public PixbufOrientation Rotate270 (PixbufOrientation orientation)
-	{
-		PixbufOrientation [] rot = new PixbufOrientation [] {
-			PixbufOrientation.LeftBottom, 
-			PixbufOrientation.LeftTop,
-			PixbufOrientation.RightTop,
-			PixbufOrientation.RightBottom, 
-			PixbufOrientation.BottomLeft,
-			PixbufOrientation.TopLeft,
-			PixbufOrientation.TopRight,
-			PixbufOrientation.BottomRight
-		};
-
-		orientation = rot [((int)orientation) -1];
-		return orientation;
-	}
-
-	static public PixbufOrientation Rotate90 (PixbufOrientation orientation)
-	{
-		orientation = Rotate270 (orientation);
-		orientation = Rotate270 (orientation);
-		orientation = Rotate270 (orientation);
-		return orientation;
-	}
-
 	static Pixbuf error_pixbuf = null;
 	public static Pixbuf ErrorPixbuf {
 		get {
diff --git a/src/RotateCommand.cs b/src/RotateCommand.cs
index aa4dc85..b3b46b3 100644
--- a/src/RotateCommand.cs
+++ b/src/RotateCommand.cs
@@ -18,6 +18,8 @@ using FSpot;
 using FSpot.Png;
 using FSpot.UI.Dialog;
 
+using FSpot.Utils;
+
 using Mono.Unix;
 
 namespace FSpot {
@@ -70,8 +72,8 @@ namespace FSpot {
 				if (img is JpegFile) {
 					FSpot.JpegFile jimg = img as FSpot.JpegFile;
 					PixbufOrientation orientation = direction == RotateDirection.Clockwise
-						? PixbufUtils.Rotate90 (img.Orientation)
-						: PixbufUtils.Rotate270 (img.Orientation);
+						? FSpot.Utils.PixbufUtils.Rotate90 (img.Orientation)
+						: FSpot.Utils.PixbufUtils.Rotate270 (img.Orientation);
 				
 					jimg.SetOrientation (orientation);
 					jimg.SaveMetaData (original_path);



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