[f-spot] Pull MemorySurface out into FSpot.Utils.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot] Pull MemorySurface out into FSpot.Utils.
- Date: Fri, 13 Aug 2010 11:21:30 +0000 (UTC)
commit 2095523fe4cabf6f7d6fd10837fa131064dc672c
Author: Ruben Vermeersch <ruben savanne be>
Date: Fri Aug 13 13:17:16 2010 +0200
Pull MemorySurface out into FSpot.Utils.
.gitignore | 1 +
configure.ac | 1 +
src/Clients/MainApp/FSpot/MemorySurface.cs | 82 -------------------
src/Clients/MainApp/MainApp.csproj | 1 -
src/Clients/MainApp/Makefile.am | 1 -
src/Core/FSpot.Utils/FSpot.Utils.csproj | 1 +
....Utils.dll.config => FSpot.Utils.dll.config.in} | 1 +
src/Core/FSpot.Utils/FSpot.Utils/MemorySurface.cs | 84 ++++++++++++++++++++
src/Core/FSpot.Utils/Makefile.am | 1 +
9 files changed, 89 insertions(+), 84 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 080b464..8aa763f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,6 +52,7 @@ help/*/*.page
help/*/*.xml
!help/C/*.xml
/src/Core/FSpot.Core/FSpot.Core/Defines.cs
+/src/Core/FSpot.Utils/FSpot.Utils.dll.config
/src/Core/FSpot.Gui/FSpot.Gui.dll.config
/src/Clients/MainApp/f-spot
/src/Clients/MainApp/f-spot.exe.config
diff --git a/configure.ac b/configure.ac
index 39cd69e..4562ff9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -350,6 +350,7 @@ src/Core/FSpot.Core/FSpot.Core.dll.config
src/Core/FSpot.Core/FSpot.Core/Defines.cs
src/Core/FSpot.JobScheduler/Makefile
src/Core/FSpot.Utils/Makefile
+src/Core/FSpot.Utils/FSpot.Utils.dll.config
src/Core/FSpot.Query/Makefile
src/Core/FSpot.Gui/Makefile
src/Core/FSpot.Gui/FSpot.Gui.dll.config
diff --git a/src/Clients/MainApp/MainApp.csproj b/src/Clients/MainApp/MainApp.csproj
index 97cbf70..217de78 100644
--- a/src/Clients/MainApp/MainApp.csproj
+++ b/src/Clients/MainApp/MainApp.csproj
@@ -111,7 +111,6 @@
<Compile Include="FSpot.Loaders\ImageLoader.cs" />
<Compile Include="FSpot\main.cs" />
<Compile Include="FSpot\MainWindow.cs" />
- <Compile Include="FSpot\MemorySurface.cs" />
<Compile Include="FSpot\Photo.cs" />
<Compile Include="FSpot\PhotoEventArgs.cs" />
<Compile Include="FSpot\PhotoList.cs" />
diff --git a/src/Clients/MainApp/Makefile.am b/src/Clients/MainApp/Makefile.am
index 05c9c3f..8796ddd 100644
--- a/src/Clients/MainApp/Makefile.am
+++ b/src/Clients/MainApp/Makefile.am
@@ -131,7 +131,6 @@ SOURCES = \
FSpot/JobStore.cs \
FSpot/main.cs \
FSpot/MainWindow.cs \
- FSpot/MemorySurface.cs \
FSpot/MetaStore.cs \
FSpot/Photo.cs \
FSpot/PhotoEventArgs.cs \
diff --git a/src/Core/FSpot.Utils/FSpot.Utils.csproj b/src/Core/FSpot.Utils/FSpot.Utils.csproj
index 4629eb3..4f804f0 100644
--- a/src/Core/FSpot.Utils/FSpot.Utils.csproj
+++ b/src/Core/FSpot.Utils/FSpot.Utils.csproj
@@ -56,6 +56,7 @@
<Compile Include="FSpot.Utils\Tests\XdgThumbnailSpecTests.cs" />
<Compile Include="FSpot.Utils\UriList.cs" />
<Compile Include="FSpot.Utils\Vector.cs" />
+ <Compile Include="FSpot.Utils\MemorySurface.cs" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
diff --git a/src/Core/FSpot.Utils/FSpot.Utils.dll.config b/src/Core/FSpot.Utils/FSpot.Utils.dll.config.in
similarity index 82%
rename from src/Core/FSpot.Utils/FSpot.Utils.dll.config
rename to src/Core/FSpot.Utils/FSpot.Utils.dll.config.in
index 8b57d83..c1ee323 100644
--- a/src/Core/FSpot.Utils/FSpot.Utils.dll.config
+++ b/src/Core/FSpot.Utils/FSpot.Utils.dll.config.in
@@ -4,4 +4,5 @@
<dllmap dll="libgdk-2.0-0.dll" target="libgdk-x11-2.0.so.0"/>
<dllmap dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0.so.0"/>
<dllmap dll="X11" target="libX11.so.6"/>
+ <dllmap dll="libfspot" target="@expanded_libdir@/f-spot/libfspot.so.0"/>
</configuration>
diff --git a/src/Core/FSpot.Utils/FSpot.Utils/MemorySurface.cs b/src/Core/FSpot.Utils/FSpot.Utils/MemorySurface.cs
new file mode 100644
index 0000000..8108ac2
--- /dev/null
+++ b/src/Core/FSpot.Utils/FSpot.Utils/MemorySurface.cs
@@ -0,0 +1,84 @@
+/*
+ * MemorySurface.cs
+ *
+ * Copyright 2007 Novell Inc.
+ *
+ * Author
+ * Larry Ewing <lewing novell com>
+ * Stephane Delcroix <stephane delcroix org>
+ *
+ * See COPYING for license information.
+ *
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace FSpot
+{
+ public sealed class MemorySurface : Cairo.Surface
+ {
+ static class NativeMethods
+ {
+ [DllImport("libfspot")]
+ public static extern IntPtr f_image_surface_create (Cairo.Format format, int width, int height);
+
+ [DllImport("libfspot")]
+ public static extern IntPtr f_image_surface_get_data (IntPtr surface);
+
+ [DllImport("libfspot")]
+ public static extern Cairo.Format f_image_surface_get_format (IntPtr surface);
+
+ [DllImport("libfspot")]
+ public static extern int f_image_surface_get_width (IntPtr surface);
+
+ [DllImport("libfspot")]
+ public static extern int f_image_surface_get_height (IntPtr surface);
+
+ [DllImport("libfspot")]
+ public static extern IntPtr f_pixbuf_to_cairo_surface (IntPtr handle);
+
+ [DllImport("libfspot")]
+ public static extern IntPtr f_pixbuf_from_cairo_surface (IntPtr handle);
+ }
+
+ public MemorySurface (Cairo.Format format, int width, int height)
+ : this (NativeMethods.f_image_surface_create (format, width, height))
+ {
+ }
+
+ public MemorySurface (IntPtr handle) : base(handle, true)
+ {
+ if (DataPtr == IntPtr.Zero)
+ throw new ApplicationException ("Missing image data");
+ }
+
+ public IntPtr DataPtr {
+ get { return NativeMethods.f_image_surface_get_data (Handle); }
+ }
+
+ public Cairo.Format Format {
+ get { return NativeMethods.f_image_surface_get_format (Handle); }
+ }
+
+ public int Width {
+ get { return NativeMethods.f_image_surface_get_width (Handle); }
+ }
+
+ public int Height {
+ get { return NativeMethods.f_image_surface_get_height (Handle); }
+ }
+
+ public static MemorySurface CreateSurface (Gdk.Pixbuf pixbuf)
+ {
+ IntPtr surface = NativeMethods.f_pixbuf_to_cairo_surface (pixbuf.Handle);
+ return new MemorySurface (surface);
+ }
+
+ public static Gdk.Pixbuf CreatePixbuf (MemorySurface mem)
+ {
+ IntPtr result = NativeMethods.f_pixbuf_from_cairo_surface (mem.Handle);
+ return (Gdk.Pixbuf)GLib.Object.GetObject (result, true);
+ }
+ }
+}
diff --git a/src/Core/FSpot.Utils/Makefile.am b/src/Core/FSpot.Utils/Makefile.am
index 9f99a73..94c50e4 100644
--- a/src/Core/FSpot.Utils/Makefile.am
+++ b/src/Core/FSpot.Utils/Makefile.am
@@ -11,6 +11,7 @@ SOURCES = \
FSpot.Utils/GIOTagLibFileAbstraction.cs \
FSpot.Utils/GtkUtil.cs \
FSpot.Utils/HashUtils.cs \
+ FSpot.Utils/MemorySurface.cs \
FSpot.Utils/Metadata.cs \
FSpot.Utils/PixbufUtils.cs \
FSpot.Utils/RecursiveFileEnumerator.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]