f-spot r4028 - in trunk: . src src/Editors src/Filters src/Utils src/Widgets
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4028 - in trunk: . src src/Editors src/Filters src/Utils src/Widgets
- Date: Tue, 3 Jun 2008 11:15:32 +0000 (UTC)
Author: sdelcroix
Date: Tue Jun 3 11:15:31 2008
New Revision: 4028
URL: http://svn.gnome.org/viewvc/f-spot?rev=4028&view=rev
Log:
2008-06-03 Stephane Delcroix <sdelcroix novell com>
* src/MemorySurface.cs:
* src/Widgets/ImageInfo.cs:
* src/Widgets/SoftFocus.cs:
* src/Widgets/CairoUtils.cs:
* src/Editors/SoftFocus.cs:
* src/Utils/Unix.cs:
* src/Texture.cs:
* src/Filters/TiltFilter.cs:
* src/Makefile.am: move CairoUtils and GdkUtils in the Utils.dll assembly,
move the MemorySurface related methods from CairoUtils to MemorySurface.
Modified:
trunk/ChangeLog
trunk/src/Editors/Editor.cs
trunk/src/Editors/SoftFocus.cs
trunk/src/Filters/TiltFilter.cs
trunk/src/GdkGlx.cs
trunk/src/Makefile.am
trunk/src/MemorySurface.cs
trunk/src/Texture.cs
trunk/src/Utils/Unix.cs
trunk/src/Widgets/CairoUtils.cs
trunk/src/Widgets/CompositeUtils.cs
trunk/src/Widgets/GdkUtils.cs
trunk/src/Widgets/ImageDisplay.cs
trunk/src/Widgets/ImageInfo.cs
trunk/src/Widgets/SoftFocus.cs
Modified: trunk/src/Editors/Editor.cs
==============================================================================
--- trunk/src/Editors/Editor.cs (original)
+++ trunk/src/Editors/Editor.cs Tue Jun 3 11:15:31 2008
@@ -3,6 +3,7 @@
using Gtk;
using Cairo;
using Tao.OpenGl;
+using FSpot.Utils;
namespace FSpot.Editors {
public abstract class Editor {
@@ -222,7 +223,7 @@
[GLib.ConnectBefore]
public virtual void ExposeEvent (object sender, ExposeEventArgs args)
{
- Context ctx = Widgets.CairoUtils.CreateContext (view.GdkWindow);
+ Context ctx = CairoUtils.CreateContext (view.GdkWindow);
Gdk.Color c = view.Style.Background (view.State);
ctx.Source = new SolidPattern (c.Red / (float) ushort.MaxValue,
c.Blue / (float) ushort.MaxValue,
Modified: trunk/src/Editors/SoftFocus.cs
==============================================================================
--- trunk/src/Editors/SoftFocus.cs (original)
+++ trunk/src/Editors/SoftFocus.cs Tue Jun 3 11:15:31 2008
@@ -88,7 +88,7 @@
((IDisposable)ctx).Dispose ();
string tmp = ImageFile.TempPath (item.Current.DefaultVersionUri.LocalPath);
- using (Gdk.Pixbuf output = Widgets.CairoUtils.CreatePixbuf (dest)) {
+ using (Gdk.Pixbuf output = MemorySurface.CreatePixbuf (dest)) {
using (System.IO.Stream stream = System.IO.File.OpenWrite (tmp)) {
img.Save (output, stream);
Modified: trunk/src/Filters/TiltFilter.cs
==============================================================================
--- trunk/src/Filters/TiltFilter.cs (original)
+++ trunk/src/Filters/TiltFilter.cs Tue Jun 3 11:15:31 2008
@@ -48,7 +48,7 @@
ctx.Paint ();
((IDisposable)ctx).Dispose ();
p.Destroy ();
- using (Pixbuf result = CairoUtils.CreatePixbuf (surface)) {
+ using (Pixbuf result = MemorySurface.CreatePixbuf (surface)) {
using (Stream output = File.OpenWrite (dest.LocalPath)) {
img.Save (result, output);
}
Modified: trunk/src/GdkGlx.cs
==============================================================================
--- trunk/src/GdkGlx.cs (original)
+++ trunk/src/GdkGlx.cs Tue Jun 3 11:15:31 2008
@@ -1,6 +1,7 @@
using System;
using System.Runtime.InteropServices;
using FSpot.Widgets;
+using FSpot.Utils;
using Tao.OpenGl;
namespace GdkGlx {
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue Jun 3 11:15:31 2008
@@ -40,9 +40,11 @@
UTILS_CSDISTFILES = \
$(srcdir)/Utils/Cache.cs \
+ $(srcdir)/Widgets/CairoUtils.cs \
$(srcdir)/Utils/ConsoleCrayon.cs \
$(srcdir)/Utils/DbUtils.cs \
$(srcdir)/Utils/GnomeUtil.cs \
+ $(srcdir)/Widgets/GdkUtils.cs \
$(srcdir)/Utils/GtkUtil.cs \
$(srcdir)/Utils/Log.cs \
$(srcdir)/Utils/Unix.cs \
@@ -225,12 +227,10 @@
$(srcdir)/CameraSelectionDialog.cs \
$(srcdir)/CameraFileSelectionDialog.cs \
$(srcdir)/TagSelectionDialog.cs \
- $(srcdir)/Widgets/CairoUtils.cs \
$(srcdir)/Widgets/CompositeUtils.cs \
$(srcdir)/Widgets/Dissolve.cs \
$(srcdir)/Widgets/Filmstrip.cs \
$(srcdir)/Widgets/FindBar.cs \
- $(srcdir)/Widgets/GdkUtils.cs \
$(srcdir)/Widgets/IEffect.cs \
$(srcdir)/Widgets/ITransition.cs \
$(srcdir)/Widgets/IconView.cs \
@@ -277,6 +277,7 @@
-pkg:gnome-sharp-2.0 \
-r:Mono.Posix \
-r:Mono.Cairo \
+ $(LINK_GLITZ) \
$(GCONF_PKG) \
$(LINK_DBUS)
@@ -295,7 +296,6 @@
$(LINK_GPHOTO2) \
$(LINK_MONO_ADDINS) \
$(LINK_FLICKR) \
- $(LINK_GLITZ) \
$(LINK_KEYRING) \
$(LINK_SMUGMUG) \
$(LINK_TAO) \
Modified: trunk/src/MemorySurface.cs
==============================================================================
--- trunk/src/MemorySurface.cs (original)
+++ trunk/src/MemorySurface.cs Tue Jun 3 11:15:31 2008
@@ -4,7 +4,8 @@
* Copyright 2007 Novell Inc.
*
* Author
- * Larry Ewing <lewing novell com>
+ * Larry Ewing <lewing novell com>
+ * Stephane Delcroix <stephane delcroix org>
*
* See COPYING for license information.
*
@@ -14,26 +15,33 @@
using System.Runtime.InteropServices;
namespace FSpot {
- // FIXME this class is a hack to have get_data functionality
- // on cairo 1.0.x
public sealed class MemorySurface : Cairo.Surface {
- [DllImport ("libfspot")]
- static extern IntPtr f_image_surface_create (Cairo.Format format, int width, int height);
-
- [DllImport ("libfspot")]
- static extern IntPtr f_image_surface_get_data (IntPtr surface);
-
- [DllImport ("libfspot")]
- static extern Cairo.Format f_image_surface_get_format (IntPtr surface);
-
- [DllImport ("libfspot")]
- static extern int f_image_surface_get_width (IntPtr 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")]
- static extern int f_image_surface_get_height (IntPtr surface);
+ [DllImport("libfspot")]
+ public static extern IntPtr f_pixbuf_from_cairo_surface (IntPtr handle);
+ }
public MemorySurface (Cairo.Format format, int width, int height)
- : this (f_image_surface_create (format, width, height))
+ : this (NativeMethods.f_image_surface_create (format, width, height))
{
}
@@ -44,23 +52,31 @@
}
public IntPtr DataPtr {
- get {
- return f_image_surface_get_data (Handle);
- }
+ get { return NativeMethods.f_image_surface_get_data (Handle); }
}
public Cairo.Format Format {
- get {
- return f_image_surface_get_format (Handle);
- }
+ get { return NativeMethods.f_image_surface_get_format (Handle); }
}
public int Width {
- get { return f_image_surface_get_width (Handle); }
+ get { return NativeMethods.f_image_surface_get_width (Handle); }
}
public int Height {
- get { return f_image_surface_get_height (Handle); }
+ 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);
}
}
}
Modified: trunk/src/Texture.cs
==============================================================================
--- trunk/src/Texture.cs (original)
+++ trunk/src/Texture.cs Tue Jun 3 11:15:31 2008
@@ -56,7 +56,7 @@
public Texture (Gdk.Pixbuf pixbuf)
: this (pixbuf.Width, pixbuf.Height)
{
- MemorySurface surface = CairoUtils.CreateSurface (pixbuf);
+ MemorySurface surface = MemorySurface.CreateSurface (pixbuf);
CopyFromSurface (surface);
surface.Destroy ();
}
Modified: trunk/src/Utils/Unix.cs
==============================================================================
--- trunk/src/Utils/Unix.cs (original)
+++ trunk/src/Utils/Unix.cs Tue Jun 3 11:15:31 2008
@@ -3,7 +3,7 @@
namespace FSpot.Utils {
public static class Unix {
- internal static class NativeMethods
+ static class NativeMethods
{
[DllImport ("libc", EntryPoint="rename", CharSet = CharSet.Auto)]
public static extern int Rename (string oldpath, string newpath);
Modified: trunk/src/Widgets/CairoUtils.cs
==============================================================================
--- trunk/src/Widgets/CairoUtils.cs (original)
+++ trunk/src/Widgets/CairoUtils.cs Tue Jun 3 11:15:31 2008
@@ -12,39 +12,33 @@
using Cairo;
using System.Runtime.InteropServices;
-namespace FSpot.Widgets {
+namespace FSpot.Utils {
public class CairoUtils {
- [DllImport ("libcairo-2.dll")]
- static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
+ static class NativeMethods
+ {
+ [DllImport ("libcairo-2.dll")]
+ public static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
+
+ [DllImport("libgdk-2.0-0.dll")]
+ public static extern IntPtr gdk_cairo_create (IntPtr raw);
+ }
[Obsolete ("use Cairo.Context.UserToDevice instead")]
static void UserToDevice (Context ctx, ref double x, ref double y)
{
- cairo_user_to_device (ctx.Handle, ref x, ref y);
+ NativeMethods.cairo_user_to_device (ctx.Handle, ref x, ref y);
}
- [DllImport("libgdk-2.0-0.dll")]
- static extern IntPtr gdk_cairo_create (IntPtr raw);
-
[Obsolete ("use Gdk.CairoHelper.Create instead")]
public static Cairo.Context CreateContext (Gdk.Drawable drawable)
{
- Cairo.Context ctx = new Cairo.Context (gdk_cairo_create (drawable.Handle));
+ Cairo.Context ctx = new Cairo.Context (NativeMethods.gdk_cairo_create (drawable.Handle));
if (ctx == null)
throw new Exception ("Couldn't create Cairo Graphics!");
return ctx;
}
- [DllImport("libfspot")]
- static extern IntPtr f_pixbuf_to_cairo_surface (IntPtr handle);
-
- public static MemorySurface CreateSurface (Gdk.Pixbuf pixbuf)
- {
- IntPtr surface = f_pixbuf_to_cairo_surface (pixbuf.Handle);
- return new MemorySurface (surface);
- }
-
public static Surface CreateSurface (Gdk.Drawable d)
{
int width, height;
@@ -85,22 +79,5 @@
return gs;
}
-
- [DllImport("libfspot")]
- static extern IntPtr f_pixbuf_from_cairo_surface (IntPtr handle);
- /*
- public static Gdk.Pixbuf CreatePixbuf (Surface s)
- {
-
- IntPtr result = f_pixbuf_from_cairo_surface (s.Handle);
- return (Gdk.Pixbuf) GLib.Object.GetObject (result, true);
- }
- */
-
- public static Gdk.Pixbuf CreatePixbuf (MemorySurface mem)
- {
- IntPtr result = f_pixbuf_from_cairo_surface (mem.Handle);
- return (Gdk.Pixbuf) GLib.Object.GetObject (result, true);
- }
}
}
Modified: trunk/src/Widgets/CompositeUtils.cs
==============================================================================
--- trunk/src/Widgets/CompositeUtils.cs (original)
+++ trunk/src/Widgets/CompositeUtils.cs Tue Jun 3 11:15:31 2008
@@ -2,6 +2,7 @@
using System.Runtime.InteropServices;
using Gdk;
using Gtk;
+using FSpot.Utils;
namespace FSpot.Widgets {
public class CompositeUtils {
Modified: trunk/src/Widgets/GdkUtils.cs
==============================================================================
--- trunk/src/Widgets/GdkUtils.cs (original)
+++ trunk/src/Widgets/GdkUtils.cs Tue Jun 3 11:15:31 2008
@@ -2,7 +2,7 @@
using Gdk;
using System.Runtime.InteropServices;
-namespace FSpot.Widgets {
+namespace FSpot.Utils {
public class GdkUtils {
[DllImport("libgdk-2.0-0.dll")]
Modified: trunk/src/Widgets/ImageDisplay.cs
==============================================================================
--- trunk/src/Widgets/ImageDisplay.cs (original)
+++ trunk/src/Widgets/ImageDisplay.cs Tue Jun 3 11:15:31 2008
@@ -15,6 +15,7 @@
using System;
using Cairo;
using FSpot;
+using FSpot.Utils;
namespace FSpot.Widgets {
[Binding(Gdk.Key.Up, "Up")]
Modified: trunk/src/Widgets/ImageInfo.cs
==============================================================================
--- trunk/src/Widgets/ImageInfo.cs (original)
+++ trunk/src/Widgets/ImageInfo.cs Tue Jun 3 11:15:31 2008
@@ -10,6 +10,7 @@
using Cairo;
using Gdk;
using Gtk;
+using FSpot.Utils;
namespace FSpot.Widgets {
public class ImageInfo : IDisposable {
@@ -77,7 +78,7 @@
private void SetPixbuf (Pixbuf pixbuf)
{
- Surface = CairoUtils.CreateSurface (pixbuf);
+ Surface = MemorySurface.CreateSurface (pixbuf);
Bounds.Width = pixbuf.Width;
Bounds.Height = pixbuf.Height;
}
Modified: trunk/src/Widgets/SoftFocus.cs
==============================================================================
--- trunk/src/Widgets/SoftFocus.cs (original)
+++ trunk/src/Widgets/SoftFocus.cs Tue Jun 3 11:15:31 2008
@@ -91,7 +91,7 @@
ctx.Paint ();
p.Destroy ();
((IDisposable)ctx).Dispose ();
- Gdk.Pixbuf normal = CairoUtils.CreatePixbuf (image);
+ Gdk.Pixbuf normal = MemorySurface.CreatePixbuf (image);
Gdk.Pixbuf blur = PixbufUtils.Blur (normal, 3);
ImageInfo overlay = new ImageInfo (blur);
blur.Dispose ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]