[f-spot/taglib-metadata] GDK can load PNM itself.



commit 3af8e7324a4a4f40e5fed5561494e45661525cc4
Author: Ruben Vermeersch <ruben savanne be>
Date:   Fri Jul 2 23:52:28 2010 +0200

    GDK can load PNM itself.

 lib/TagLib/TagLib        |    2 +-
 src/Imaging/ImageFile.cs |   19 +++--
 src/Imaging/PnmFile.cs   |  225 ----------------------------------------------
 src/Imaging/Tiff.cs      |   66 --------------
 src/Makefile.am          |    1 -
 5 files changed, 13 insertions(+), 300 deletions(-)
---
diff --git a/lib/TagLib/TagLib b/lib/TagLib/TagLib
index e154d3a..ea8e45d 160000
--- a/lib/TagLib/TagLib
+++ b/lib/TagLib/TagLib
@@ -1 +1 @@
-Subproject commit e154d3af8a44e7ce64a6d1920dfc1dc50c3b6770
+Subproject commit ea8e45df929a5c18090ef7113806d04cb4f49b0d
diff --git a/src/Imaging/ImageFile.cs b/src/Imaging/ImageFile.cs
index 2be05bd..f374092 100644
--- a/src/Imaging/ImageFile.cs
+++ b/src/Imaging/ImageFile.cs
@@ -44,13 +44,13 @@ namespace FSpot.Imaging {
 			name_table [".kdc"] = typeof (FSpot.Imaging.Tiff.NefFile);
 			name_table [".arw"] = typeof (FSpot.Imaging.Tiff.NefFile);
 			name_table [".rw2"] = typeof (FSpot.Imaging.DCRawFile);
-			name_table [".tiff"] = typeof (FSpot.Imaging.Tiff.TiffFile);
+			name_table [".tiff"] = typeof (BaseImageFile);
 			name_table [".tif"] = typeof (FSpot.Imaging.Tiff.TiffFile);
 			name_table [".orf"] =  typeof (FSpot.Imaging.Tiff.NefFile);
 			name_table [".srf"] = typeof (FSpot.Imaging.Tiff.NefFile);
 			name_table [".dng"] = typeof (FSpot.Imaging.Tiff.DngFile);
 			name_table [".crw"] = typeof (FSpot.Imaging.Ciff.CiffFile);
-			name_table [".ppm"] = typeof (FSpot.Imaging.Pnm.PnmFile);
+			name_table [".ppm"] = typeof (BaseImageFile);
 			name_table [".mrw"] = typeof (FSpot.Imaging.Mrw.MrwFile);
 			name_table [".raf"] = typeof (FSpot.Imaging.Raf.RafFile);
 			name_table [".x3f"] = typeof (FSpot.Imaging.X3f.X3fFile);
@@ -109,14 +109,19 @@ namespace FSpot.Imaging {
 			return t;
 		}
 		
-		public static IImageFile Create (SafeUri uri)
-		{
-			var t = GetLoaderType (uri);
+        public static IImageFile Create (SafeUri uri)
+        {
+            var t = GetLoaderType (uri);
             if (t == null)
                 throw new Exception (String.Format ("Unsupported image: {0}", uri));
 
-			return (IImageFile) System.Activator.CreateInstance (t, new object[] { uri });
-		}
+            try {
+                return (IImageFile) System.Activator.CreateInstance (t, new object[] { uri });
+            } catch (Exception e) {
+                Hyena.Log.DebugException (e);
+                throw e;
+            }
+        }
 
 		public static bool IsRaw (SafeUri uri)
 		{
diff --git a/src/Imaging/Tiff.cs b/src/Imaging/Tiff.cs
index bd6ab18..fae7d8e 100644
--- a/src/Imaging/Tiff.cs
+++ b/src/Imaging/Tiff.cs
@@ -1624,16 +1624,6 @@ namespace FSpot.Imaging.Tiff {
 				System.Array.Copy (data, i, raw_data, 0, size);
 			}
 		}
-
-		public void SetData (string value)
-		{
-			int len = System.Text.Encoding.UTF8.GetByteCount (value);
-			byte [] tmp = new byte [len + 1];
-			System.Text.Encoding.UTF8.GetBytes (value, 0, value.Length, tmp, 0);
-			tmp[len] = 0;
-			Log.DebugFormat ("SetData: value = {0} len = {1}", value, len);
-			SetData (tmp);
-		}
 	
 		public static System.DateTime DateTimeFromString (string dt)
 		{
@@ -1652,35 +1642,6 @@ namespace FSpot.Imaging.Tiff {
 			
 			return result;
 		}
-		
-		public void SetData (byte [] data)
-		{
-			raw_data = data;
-			count = (uint)raw_data.Length / (uint)GetTypeSize ();
-		}
-
-#if false		
-		public object  GetValue () {
-			switch (Type) {
-			case EntryType.Short:
-				return ShortValue;
-			case EntryType.Long:
-				return LongValue;
-			case  EntryType.Rational:
-				return RationalValue;
-			case EntryType.SRational:
-				return SRationalValue;
-			case EntryType.Ascii:
-				return StringValue.Split ('\0');
-				break;
-			default:
-				System.Console.WriteLine ("{1}({2}) [{0}]", this.Count, this.Id, this.Type);
-				break;
-
-				}
-			}
-		}
-#endif
 
 		public byte [] Value {
 			get {
@@ -1863,33 +1824,6 @@ namespace FSpot.Imaging.Tiff {
 			file.Position = offset;
 			return file;
 		}
-
-		public Gdk.Pixbuf LoadJpegInterchangeFormat (ImageDirectory directory)
-		{
-			uint offset = directory.Lookup (TagId.JPEGInterchangeFormat).ValueAsLong [0];
-			uint length = directory.Lookup (TagId.JPEGInterchangeFormatLength).ValueAsLong [0];
-			   
-			using (System.IO.Stream file = Open ()) {
-				file.Position = offset;
-				
-				byte [] data = new byte [32768];
-				int read;
-
-				Gdk.PixbufLoader loader = new Gdk.PixbufLoader ();
-				
-				while (length > 0) {
-					read = file.Read (data, 0, (int)System.Math.Min ((int)data.Length, length));
-					if (read <= 0)
-						break;
-
-					loader.Write (data, (ulong)read);
-					length -= (uint) read;
-				}
-				Gdk.Pixbuf result = loader.Pixbuf;
-				loader.Close ();
-				return result; 
-			}
-		}
 	}
 
 	public class DngFile : TiffFile {
diff --git a/src/Makefile.am b/src/Makefile.am
index b3b7b3f..e7408b6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -93,7 +93,6 @@ SOURCES = \
 	Imaging/MrwFile.cs \
 	Imaging/OrderedWriter.cs \
 	Imaging/PixelBuffer.cs \
-	Imaging/PnmFile.cs \
 	Imaging/RafFile.cs \
 	Imaging/X3fFile.cs \
 	Imaging/XmpFile.cs \



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