f-spot r4363 - in trunk/extensions: . ResizeEditor



Author: sdelcroix
Date: Tue Sep 16 11:55:57 2008
New Revision: 4363
URL: http://svn.gnome.org/viewvc/f-spot?rev=4363&view=rev

Log:
2008-09-16  Stephane Delcroix  <sdelcroix*novell.com>

	* ResizeEditor.cs: new resize editor, work in progress.


Added:
   trunk/extensions/ResizeEditor/
   trunk/extensions/ResizeEditor/.gitignore
   trunk/extensions/ResizeEditor/Makefile
   trunk/extensions/ResizeEditor/ResizeEditor.addin.xml
   trunk/extensions/ResizeEditor/ResizeEditor.cs
Modified:
   trunk/extensions/ChangeLog

Added: trunk/extensions/ResizeEditor/.gitignore
==============================================================================
--- (empty file)
+++ trunk/extensions/ResizeEditor/.gitignore	Tue Sep 16 11:55:57 2008
@@ -0,0 +1 @@
+/ResizeEditor.dll

Added: trunk/extensions/ResizeEditor/Makefile
==============================================================================
--- (empty file)
+++ trunk/extensions/ResizeEditor/Makefile	Tue Sep 16 11:55:57 2008
@@ -0,0 +1,29 @@
+all: ResizeEditor.dll
+
+PACKAGES = \
+	-pkg:f-spot \
+	-pkg:gtk-sharp-2.0
+
+ASSEMBLIES = \
+	-r:Mono.Posix
+
+RESOURCES = \
+	-resource:ResizeEditor.addin.xml
+
+SOURCES = \
+	ResizeEditor.cs
+
+install: all
+	cp *.dll ~/.gnome2/f-spot/addins/
+
+mpack: ResizeEditor.dll
+	mautil p ResizeEditor.dll
+
+ResizeEditor.dll: $(SOURCES) ResizeEditor.addin.xml
+	gmcs -target:library $(SOURCES) $(PACKAGES) $(ASSEMBLIES) $(RESOURCES)
+
+clean:
+	rm -f *.dll *~ *.bak .mpack
+
+PHONY:
+	install clean all mpack

Added: trunk/extensions/ResizeEditor/ResizeEditor.addin.xml
==============================================================================
--- (empty file)
+++ trunk/extensions/ResizeEditor/ResizeEditor.addin.xml	Tue Sep 16 11:55:57 2008
@@ -0,0 +1,15 @@
+<Addin namespace="FSpot"
+	id="ResizeEditor"
+	version="0.5.0.0"
+	name="ResizeEditor"
+	description="Resize the image"
+	author="Stephane Delcroix"
+	url="http://f-spot.org/Extensions";
+	category="Editors">
+	<Dependencies>
+		<Addin id="Core" version="0.4.4.102"/>
+	</Dependencies>
+	<Extension path = "/FSpot/Editors">
+		<Editor editor_type = "FSpot.Addins.Editors.ResizeEditor"/>
+	</Extension>
+</Addin>

Added: trunk/extensions/ResizeEditor/ResizeEditor.cs
==============================================================================
--- (empty file)
+++ trunk/extensions/ResizeEditor/ResizeEditor.cs	Tue Sep 16 11:55:57 2008
@@ -0,0 +1,43 @@
+/*
+ * ResizeEditor.cs
+ *
+ * Author(s)
+ * 	Stephane Delcroix  (stephane delcroix org)
+ *
+ * This is free software. See COPYING for details.
+ */
+
+using System;
+using FSpot;
+using FSpot.Editors;
+using Gtk;
+using Gdk;
+using Mono.Unix;
+
+namespace FSpot.Addins.Editors {
+	class ResizeEditor : Editor {
+		double ratio;
+		SpinButton size;
+
+		public ResizeEditor () : base (Catalog.GetString ("Resize"), null) {
+			CanHandleMultiple = false;
+			HasSettings = true;
+		}
+
+		protected override Pixbuf Process (Pixbuf input, Cms.Profile input_profile)
+		{
+			Pixbuf output = (Pixbuf) input.Clone ();
+			double ratio = (double)size.Value / Math.Max (output.Width, output.Height);
+			return output.ScaleSimple ((int)(output.Width * ratio), (int)(output.Height * ratio), InterpType.Bilinear);
+		}
+
+		public override Widget ConfigurationWidget ()
+		{
+//			int max = Math.Max (input.Width, input.Height);
+			int max = 2000;
+			size = new SpinButton (128, max, 10);
+			size.Value = max;
+			return size;
+		}
+	}
+}



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