f-spot r4294 - in trunk: . src src/Widgets
- From: rubenv svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4294 - in trunk: . src src/Widgets
- Date: Mon, 25 Aug 2008 18:07:13 +0000 (UTC)
Author: rubenv
Date: Mon Aug 25 18:07:13 2008
New Revision: 4294
URL: http://svn.gnome.org/viewvc/f-spot?rev=4294&view=rev
Log:
2008-08-25 Ruben Vermeersch <ruben savanne be>
* src/Histogram.cs: Further cleanup the Histogram API. It still does two
tasks (due to the AutoStretch tool), but it's getting better at doing one
task.
* src/Widgets/InfoBox.cs, src/Widgets/PreviewPopup.cs: Use the new API.
Modified:
trunk/ChangeLog
trunk/src/Histogram.cs
trunk/src/Widgets/InfoBox.cs
trunk/src/Widgets/PreviewPopup.cs
Modified: trunk/src/Histogram.cs
==============================================================================
--- trunk/src/Histogram.cs (original)
+++ trunk/src/Histogram.cs Mon Aug 25 18:07:13 2008
@@ -41,7 +41,7 @@
public Histogram () {}
- public void FillValues (Gdk.Pixbuf src)
+ private void FillValues (Gdk.Pixbuf src)
{
values = new int [256, 3];
@@ -163,16 +163,17 @@
}
}
- public Gdk.Pixbuf GeneratePixbuf (int max_width)
+ public Gdk.Pixbuf Generate (Gdk.Pixbuf input, int max_width)
{
Gdk.Pixbuf scaled;
- using (Gdk.Pixbuf pixbuf = GeneratePixbuf ())
+ using (Gdk.Pixbuf pixbuf = Generate (input))
scaled = PixbufUtils.ScaleToMaxSize (pixbuf, max_width, 128);
return scaled;
}
- public Gdk.Pixbuf GeneratePixbuf ()
+ public Gdk.Pixbuf Generate (Gdk.Pixbuf input)
{
+ FillValues (input);
int height = 128;
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, values.GetLength (0), height);
Draw (pixbuf);
@@ -186,12 +187,12 @@
Gtk.Application.Init ();
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (args [0]);
System.Console.WriteLine ("loaded {0}", args [0]);
- Histogram hist = new Histogram (pixbuf);
+ Histogram hist = new Histogram ();
System.Console.WriteLine ("loaded histgram", args [0]);
Gtk.Window win = new Gtk.Window ("display");
Gtk.Image image = new Gtk.Image ();
- Gdk.Pixbuf img = hist.GeneratePixbuf ();
+ Gdk.Pixbuf img = hist.Generate (pixbuf);
image.Pixbuf = img;
win.Add (image);
win.ShowAll ();
Modified: trunk/src/Widgets/InfoBox.cs
==============================================================================
--- trunk/src/Widgets/InfoBox.cs (original)
+++ trunk/src/Widgets/InfoBox.cs Mon Aug 25 18:07:13 2008
@@ -462,9 +462,8 @@
using (ImageFile img = ImageFile.Create (photo.DefaultVersionUri))
histogram_hint = img.Load (256, 256);
- histogram.FillValues (histogram_hint);
int max = histogram_expander.Allocation.Width;
- histogram_image.Pixbuf = histogram.GeneratePixbuf (max);
+ histogram_image.Pixbuf = histogram.Generate (histogram_hint, max);
histogram_hint.Dispose ();
histogram_hint = null;
Modified: trunk/src/Widgets/PreviewPopup.cs
==============================================================================
--- trunk/src/Widgets/PreviewPopup.cs (original)
+++ trunk/src/Widgets/PreviewPopup.cs Mon Aug 25 18:07:13 2008
@@ -53,8 +53,7 @@
private void AddHistogram (Gdk.Pixbuf pixbuf)
{
if (show_histogram) {
- hist.FillValues (pixbuf);
- Gdk.Pixbuf image = hist.GeneratePixbuf ();
+ Gdk.Pixbuf image = hist.Generate (pixbuf);
double scalex = 0.5;
double scaley = 0.5;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]