F-Spot color profile support: alpha 1
- From: "Vasiliy Kirilichev" <vasyok gmail com>
- To: "f-spot list" <f-spot-list gnome org>, gnome-soc-list <gnome-soc-list gnome org>
- Subject: F-Spot color profile support: alpha 1
- Date: Wed, 16 Jul 2008 16:16:36 +0400
Hello! This is my first alpha and I'll very glad if some of us can test it :)
There are some bad things in this version: not good working with
rotated jpg (and very slow), I'm not sure about printer profile (is it
correct or not?) and some more things. but the the most of general
functionality is done.
small howto:
$ svn co -r4185
$ patch -p0 < ../patch
--
Vasiliy Kirlichev
Index: src/f-spot.glade
===================================================================
--- src/f-spot.glade (revision 4185)
+++ src/f-spot.glade (working copy)
@@ -6324,6 +6324,7 @@
</child>
<child>
<widget class="GtkFrame" id="frame41">
+ <property name="visible">true</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
@@ -6392,8 +6393,8 @@
<child>
<widget class="GtkComboBox" id="display_combo">
<property name="visible">True</property>
- <property name="items" translatable="yes">From Screen
-Standard RGB</property>
+ <property name="items" translatable="yes"> <!--From Screen
+Standard RGB --></property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -6406,9 +6407,9 @@
<child>
<widget class="GtkComboBox" id="destination_combo">
<property name="visible">True</property>
- <property name="items" translatable="yes">Standard RGB
+ <property name="items" translatable="yes"> <!--Standard RGB
Image Profile
-Custom
+Custom -->
</property>
</widget>
<packing>
Index: src/AsyncPixbufLoader.cs
===================================================================
--- src/AsyncPixbufLoader.cs (revision 4185)
+++ src/AsyncPixbufLoader.cs (working copy)
@@ -120,6 +120,8 @@
PixbufOrientation thumb_orientation = Accelerometer.GetViewOrientation (PixbufOrientation.TopLeft);
thumb = new Gdk.Pixbuf (ThumbnailGenerator.ThumbnailPath (uri));
thumb = PixbufUtils.TransformOrientation (thumb, thumb_orientation);
+ if (!thumb.HasAlpha)
+ FSpot.ColorManagement.ApplyScreenProfile(thumb);
} catch (System.Exception e) {
//FSpot.ThumbnailGenerator.Default.Request (uri.ToString (), 0, 256, 256);
if (!(e is GLib.GException))
@@ -208,8 +210,19 @@
if (pixbuf != null && loader.Pixbuf != null && loader.Pixbuf != pixbuf && damage != Gdk.Rectangle.Zero)
area = PixbufUtils.TransformAndCopy (loader.Pixbuf, pixbuf, orientation, damage);
- if (area.Width != 0 && area.Height != 0 && AreaUpdated != null)
+ if (area.Width != 0 && area.Height != 0 && AreaUpdated != null) {
AreaUpdated (this, new AreaUpdatedArgs (area));
+ if(!pixbuf.HasAlpha && area.Width != 0)
+ FSpot.ColorManagement.ApplyScreenProfile(pixbuf, area);
+
+// Gtk.MessageDialog md = new Gtk.MessageDialog (null,
+// Gtk.DialogFlags.DestroyWithParent,
+// Gtk.MessageType.Error,
+// Gtk.ButtonsType.Close,
+// area.ToString());
+// int result = md.Run ();
+// md.Destroy();
+ }
//System.Console.WriteLine ("orig {0} tform {1}", damage.ToString (), area.ToString ());
damage = Gdk.Rectangle.Zero;
@@ -402,10 +415,16 @@
{
Gdk.Rectangle area = new Gdk.Rectangle (args.X, args.Y, args.Width, args.Height);
- if (damage.Width == 0 || damage.Height == 0)
- damage = area;
- else
+ //debug
+ if (orientation != PixbufOrientation.TopLeft) {
damage = area.Union (damage);
+ }
+ else {
+ if (damage.Width == 0 || damage.Height == 0)
+ damage = area;
+ else
+ damage = area.Union (damage);
+ }
}
private void HandleClosed (object sender, System.EventArgs args)
Index: src/TextureDisplay.cs
===================================================================
--- src/TextureDisplay.cs (revision 4185)
+++ src/TextureDisplay.cs (working copy)
@@ -164,7 +164,10 @@
try {
using (ImageFile img = ImageFile.Create (item.Current.DefaultVersionUri)) {
using (Gdk.Pixbuf pixbuf = img.Load ()) {
- tex = new Texture (pixbuf);
+ //debug
+ if (!pixbuf.HasAlpha)
+ FSpot.ColorManagement.ApplyScreenProfile(pixbuf);
+ tex = new Texture (pixbuf);
}
}
} catch (Exception) {
Index: src/Widgets/SoftFocus.cs
===================================================================
--- src/Widgets/SoftFocus.cs (revision 4185)
+++ src/Widgets/SoftFocus.cs (working copy)
@@ -150,6 +150,12 @@
p.Destroy ();
return true;
}
+ //debug
+ public void SetNewInfo (ImageInfo info)
+ {
+ this.info = info;
+ blur = CreateBlur (info);
+ }
public void Dispose ()
{
Index: src/Widgets/IconView.cs
===================================================================
--- src/Widgets/IconView.cs (revision 4185)
+++ src/Widgets/IconView.cs (working copy)
@@ -869,6 +869,11 @@
draw.Width, draw.Height);
if (region.Intersect (area, out draw)) {
+ //debug
+ if (!temp_thumbnail.HasAlpha) {
+ temp_thumbnail = temp_thumbnail.Copy();
+ FSpot.ColorManagement.ApplyScreenProfile(temp_thumbnail);
+ }
temp_thumbnail.RenderToDrawable (BinWindow, Style.WhiteGC,
draw.X - region.X,
draw.Y - region.Y,
@@ -988,6 +993,9 @@
tag_bounds.Height,
InterpType.Bilinear);
}
+ //debug
+ if (!scaled_icon.HasAlpha)
+ FSpot.ColorManagement.ApplyScreenProfile(scaled_icon);
scaled_icon.RenderToDrawable (BinWindow, Style.WhiteGC,
region.X - tag_bounds.X,
Index: src/Widgets/TagView.cs
===================================================================
--- src/Widgets/TagView.cs (revision 4185)
+++ src/Widgets/TagView.cs (working copy)
@@ -90,6 +90,8 @@
} else {
scaled_icon = icon.ScaleSimple (thumbnail_size, thumbnail_size, InterpType.Bilinear);
}
+ //debug
+ FSpot.ColorManagement.ApplyScreenProfile(scaled_icon);
scaled_icon.RenderToDrawable (GdkWindow, Style.WhiteGC,
0, 0, tag_x, tag_y, thumbnail_size, thumbnail_size,
Index: src/Widgets/Filmstrip.cs
===================================================================
--- src/Widgets/Filmstrip.cs (revision 4185)
+++ src/Widgets/Filmstrip.cs (working copy)
@@ -561,6 +561,11 @@
}
}
+ //debug (apply only to "current"!)
+ if (!current.HasAlpha) {
+ current = current.Copy();
+ FSpot.ColorManagement.ApplyScreenProfile(current);
+ }
if (!highlighted)
return current;
Index: src/Editors/Old/SoftFocus.cs
===================================================================
--- src/Editors/Old/SoftFocus.cs (revision 4185)
+++ src/Editors/Old/SoftFocus.cs (working copy)
@@ -84,6 +84,11 @@
info.Bounds.Height);
Context ctx = new Context (dest);
+ //debug
+ Gdk.Pixbuf test = FSpot.PhotoLoader.Load (item.Collection, item.Index);
+ info = new Widgets.ImageInfo (test);
+ soft.SetNewInfo(info);
+ //
effect.OnExpose (ctx, info.Bounds);
((IDisposable)ctx).Dispose ();
Index: src/PixbufUtils.cs
===================================================================
--- src/PixbufUtils.cs (revision 4185)
+++ src/PixbufUtils.cs (working copy)
@@ -678,7 +678,21 @@
}
}
+ //debug
+ public static unsafe void ColorAdjust (Gdk.Pixbuf src, Gdk.Pixbuf dest, Gdk.Rectangle area, Cms.Transform trans)
+ {
+ int width = src.Width;
+ byte * srcpix = (byte *) src.Pixels;
+ byte * destpix = (byte *) dest.Pixels;
+ for (int row = area.Y; row < area.Y + area.Height; row++) {
+ trans.Apply ((IntPtr) (srcpix + row * src.Rowstride),
+ (IntPtr) (destpix + row * dest.Rowstride),
+ (uint)width);
+ }
+
+ }
+
public static unsafe bool IsGray (Gdk.Pixbuf pixbuf, int max_difference)
{
int chan = pixbuf.NChannels;
Index: src/Core/ColorManagement.cs
===================================================================
--- src/Core/ColorManagement.cs (revision 0)
+++ src/Core/ColorManagement.cs (revision 0)
@@ -0,0 +1,165 @@
+/*
+ * FSpot.Core ?
+ *
+ * Author(s):
+ * Vasiliy Kirilichev <vasyok gmail com>
+ *
+ * This is free software. See COPYING for details.
+ *
+ */
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace FSpot {
+public static class ColorManagement {
+ private static Cms.Profile display_profile;
+ private static Cms.Profile destination_profile;
+ private static Cms.Profile[] display_profile_list;
+
+ public static ArrayList ProfilesPaths = new ArrayList();
+
+ public static Cms.Profile DisplayProfile {
+ set { display_profile = value; }
+ get { return display_profile; }
+ }
+
+ public static Cms.Profile DestinationProfile {
+ set { destination_profile = value; }
+ get { return destination_profile; }
+ }
+
+ public static Cms.Profile[] DisplayProfileList {
+ set { display_profile_list = value; }
+ get { return display_profile_list; }
+ }
+
+ public static void GetAllProfilesPaths ()
+ {
+ ProfilesPaths.Clear();
+ //DEBUG: it must probably search in the subdirectories too and use mask *.icc/*.icm (not *.ic?)
+ string [] search = {"/usr/share/color/icc", "~/.color/icc", "/usr/local/share/color/icc "};
+ foreach (string path in search)
+ if (Directory.Exists (path)) {
+ //foreach (string dir in Directory.GetDirectories (path))
+ //if (File.Exists (Path.Combine (path, "*.icc")) || File.Exists (Path.Combine (path, "*.icm")))
+ string[] ColorProfilList = System.IO.Directory.GetFiles(path, "*.ic?");
+ foreach (string ColorProfile in ColorProfilList)
+ ProfilesPaths.Add(ColorProfile);
+ }
+ }
+
+ private static void GetSettings ()
+ {
+ Gdk.Screen screen = Gdk.Screen.Default;
+ display_profile = Cms.Profile.GetScreenProfile (screen);
+ if (display_profile == null) {
+ try {
+ display_profile = new Cms.Profile (Preferences.Get<string> (Preferences.DISPLAY_COLOR_PROFILE_PATH));
+ //debug?
+ Gdk.Screen current_screen = Gdk.Screen.Default;
+ FSpot.Widgets.CompositeUtils.SetScreenProfile(current_screen, display_profile);
+ }
+ catch {
+ display_profile = Cms.Profile.CreateStandardRgb ();
+ //Preferences.Set<string> (Preferences.DISPLAY_COLOR_PROFILE_PATH, ""); //fixme
+ }
+ }
+ //debug!!!!!!!! how can I make it right?
+ Cms.Profile display_profile_from_settings = Cms.Profile.CreateStandardRgb ();
+ try { display_profile_from_settings = new Cms.Profile (Preferences.Get<string> (Preferences.DISPLAY_COLOR_PROFILE_PATH)); } catch {}
+ if (display_profile.ProductName != display_profile_from_settings.ProductName) {
+ Preferences.Set (Preferences.DISPLAY_COLOR_PROFILE_PATH, String.Empty);
+ foreach (string ColorProfile in ProfilesPaths)
+ if (new Cms.Profile(ColorProfile).ProductName == display_profile.ProductName)
+ Preferences.Set (Preferences.DISPLAY_COLOR_PROFILE_PATH, ColorProfile);
+ }
+
+ if (destination_profile == null) {
+ try {
+ destination_profile = new Cms.Profile (Preferences.Get<string> (Preferences.OUTPUT_COLOR_PROFILE_PATH));
+ }
+ catch {
+ destination_profile = Cms.Profile.CreateStandardRgb ();
+ }
+ }
+ //debug!!!!!!!! how can I make it right?
+ Cms.Profile output_profile_from_settings = Cms.Profile.CreateStandardRgb ();
+ try { output_profile_from_settings = new Cms.Profile (Preferences.Get<string> (Preferences.OUTPUT_COLOR_PROFILE_PATH)); } catch {}
+ if (destination_profile.ProductName != output_profile_from_settings.ProductName) {
+ Preferences.Set (Preferences.OUTPUT_COLOR_PROFILE_PATH, String.Empty);
+ foreach (string ColorProfile in ProfilesPaths)
+ if (new Cms.Profile(ColorProfile).ProductName == destination_profile.ProductName)
+ Preferences.Set (Preferences.OUTPUT_COLOR_PROFILE_PATH, ColorProfile);
+ }
+ }
+
+ public static void LoadSettings()
+ {
+ GetAllProfilesPaths();
+ GetSettings();
+ LoadDisplayProfileList(); //?
+ }
+
+ public static void ReloadSettings()
+ {
+ GetSettings();
+ LoadDisplayProfileList(); //?
+ }
+
+ public static void LoadDisplayProfileList()
+ {
+ Cms.Profile image_profile = Cms.Profile.CreateStandardRgb (); //?
+ FSpot.ColorManagement.DisplayProfileList = new Cms.Profile [] {image_profile, display_profile};
+ }
+
+ public static void ApplyScreenProfile(Gdk.Pixbuf pixbuf)
+ {
+ Cms.Transform transform = new Cms.Transform (DisplayProfileList,
+ PixbufUtils.PixbufCmsFormat (pixbuf),
+ PixbufUtils.PixbufCmsFormat (pixbuf),
+ Cms.Intent.Perceptual, 0x0000);
+ PixbufUtils.ColorAdjust (pixbuf, pixbuf, transform);
+ }
+
+// public static void ApplyScreenProfile(ref Gdk.Pixbuf pixbuf, Cms.Profile image_profile)
+// {
+// Cms.Profile [] list = new Cms.Profile [] { image_profile, display_profile };
+// Cms.Transform transform = new Cms.Transform (list,
+// PixbufUtils.PixbufCmsFormat (pixbuf),
+// PixbufUtils.PixbufCmsFormat (pixbuf),
+// Cms.Intent.Perceptual, 0x0000);
+// PixbufUtils.ColorAdjust (pixbuf, pixbuf, area, transform);
+// }
+
+ public static void ApplyScreenProfile(Gdk.Pixbuf pixbuf, Gdk.Rectangle area)
+ {
+ Cms.Transform transform = new Cms.Transform (DisplayProfileList,
+ PixbufUtils.PixbufCmsFormat (pixbuf),
+ PixbufUtils.PixbufCmsFormat (pixbuf),
+ Cms.Intent.Perceptual, 0x0000);
+ PixbufUtils.ColorAdjust (pixbuf, pixbuf, area, transform);
+ }
+
+// public static void ApplyScreenProfile(Gdk.Pixbuf src, Gdk.Pixbuf dest)
+// {
+// Cms.Transform transform = new Cms.Transform (DisplayProfileList,
+// PixbufUtils.PixbufCmsFormat (src),
+// PixbufUtils.PixbufCmsFormat (src),
+// Cms.Intent.Perceptual, 0x0000);
+// PixbufUtils.ColorAdjust (src, dest, transform);
+// }
+
+ public static void ApplyPrinterProfile(ref Gdk.Pixbuf pixbuf)
+ {
+ Cms.Profile image_profile = Cms.Profile.CreateStandardRgb (); //?
+ Cms.Profile [] list = new Cms.Profile [] { image_profile, destination_profile };
+ Cms.Transform transform = new Cms.Transform (list,
+ PixbufUtils.PixbufCmsFormat (pixbuf),
+ PixbufUtils.PixbufCmsFormat (pixbuf),
+ Cms.Intent.Perceptual, 0x0000);
+ PixbufUtils.ColorAdjust (pixbuf, pixbuf, transform);
+ }
+ }
+}
\ No newline at end of file
Index: src/Preferences.cs
===================================================================
--- src/Preferences.cs (revision 4185)
+++ src/Preferences.cs (working copy)
@@ -18,7 +18,10 @@
public const string MAIN_WINDOW_Y = "/apps/f-spot/ui/main_window_y";
public const string MAIN_WINDOW_WIDTH = "/apps/f-spot/ui/main_window_width";
public const string MAIN_WINDOW_HEIGHT = "/apps/f-spot/ui/main_window_height";
-
+ //debug
+ public const string DISPLAY_COLOR_PROFILE_PATH = "/apps/f-spot/ui/display_color_profile_path";
+ public const string OUTPUT_COLOR_PROFILE_PATH = "/apps/f-spot/ui/output_color_profile_path";
+ //
public const string IMPORT_WINDOW_WIDTH = "/apps/f-spot/ui/import_window_width";
public const string IMPORT_WINDOW_HEIGHT = "/apps/f-spot/ui/import_window_height";
public const string IMPORT_WINDOW_PANE_POSITION = "/apps/f-spot/ui/import_window_pane_position";
Index: src/UI.Dialog/ColorDialog.cs
===================================================================
--- src/UI.Dialog/ColorDialog.cs (revision 4185)
+++ src/UI.Dialog/ColorDialog.cs (working copy)
@@ -62,7 +62,7 @@
if (AdjustedPixbuf == null)
return;
- Cms.Profile display_profile = Cms.Profile.GetScreenProfile (view.Screen);
+ Cms.Profile display_profile = Cms.Profile.CreateStandardRgb ();//Cms.Profile.GetScreenProfile (view.Screen);
Cms.Profile [] list;
if (display_profile == null)
@@ -190,7 +190,7 @@
Cms.Profile abs = AdjustmentProfile ();
// FIXME this shouldn't use the screen as the destination profile.
- Cms.Profile destination = Cms.Profile.GetScreenProfile (view.Screen);
+ Cms.Profile destination = FSpot.ColorManagement.DestinationProfile;
if (destination == null)
destination = Cms.Profile.CreateStandardRgb ();
Index: src/UI.Dialog/PreferenceDialog.cs
===================================================================
--- src/UI.Dialog/PreferenceDialog.cs (revision 4185)
+++ src/UI.Dialog/PreferenceDialog.cs (working copy)
@@ -16,33 +16,33 @@
using FSpot.Widgets;
namespace FSpot.UI.Dialog {
-#if FALSE
public class ProfileList : TreeStore {
- public ProfileList () : base (typeof (Profile))
+ public ProfileList () : base (typeof (Cms.Profile))
{
- this.AppendValues (Profile.CreateStandardRgb ());
- this.AppendValues (Profile.CreateAlternateRgb ());
+ this.AppendValues (Cms.Profile.CreateStandardRgb ());
+ this.AppendValues (Cms.Profile.CreateAlternateRgb ());
+ FSpot.ColorManagement.GetAllProfilesPaths();
+ foreach (string path in FSpot.ColorManagement.ProfilesPaths)
+ this.AppendValues (new Cms.Profile(path));
}
public static void ProfileNameDataFunc (CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter)
{
- Profile profile = (Profile) model.GetValue (iter, 0);
+ Cms.Profile profile = (Cms.Profile) model.GetValue (iter, 0);
(renderer as Gtk.CellRendererText).Text = profile.ProductName;
}
public static void ProfileDescriptionDataFunc (CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter)
{
- Profile profile = (Profile) model.GetValue (iter, 0);
+ Cms.Profile profile = (Cms.Profile) model.GetValue (iter, 0);
(renderer as Gtk.CellRendererText).Text = profile.ProductDescription;
}
}
-#endif
+
public class PreferenceDialog : GladeDialog {
[Glade.Widget] private CheckButton metadata_check;
-#if FALSE
[Glade.Widget] private ComboBox display_combo;
[Glade.Widget] private ComboBox destination_combo;
-#endif
[Glade.Widget] private HBox tagselectionhbox;
[Glade.Widget] private Button set_saver_button;
[Glade.Widget] private FileChooserButton photosdir_chooser;
@@ -58,8 +58,9 @@
[Glade.Widget] private Button refreshtheme_button;
private ComboBox themelist_combo;
private MenuButton tag_button;
+
+ public static PhotoImageView image_view; // debug
-
private static PreferenceDialog prefs = null;
int screensaver_tag;
private const string SaverCommand = "screensavers-f-spot-screensaver";
@@ -79,7 +80,7 @@
photosdir_chooser.SetCurrentFolder(Global.PhotoDirectory);
photosdir_chooser.Sensitive = false;
}
-#if FALSE
+
Gtk.CellRendererText name_cell = new Gtk.CellRendererText ();
Gtk.CellRendererText desc_cell = new Gtk.CellRendererText ();
@@ -88,6 +89,25 @@
display_combo.PackStart (name_cell, true);
display_combo.SetCellDataFunc (name_cell, new CellLayoutDataFunc (ProfileList.ProfileNameDataFunc));
display_combo.SetCellDataFunc (desc_cell, new CellLayoutDataFunc (ProfileList.ProfileDescriptionDataFunc));
+ //debug. not good part of code, I haven't any compare method for color profiles
+ //and it can't show normal the standart profile..
+ //how can I get the Value from display_combo items???
+ switch (FSpot.ColorManagement.DisplayProfile.ProductName) {
+ case "sRGB built-in - (lcms internal)":
+ display_combo.Active = 0;
+ break;
+ case "rgb built-in - (lcms internal)":
+ display_combo.Active = 1;
+ break;
+ default:
+ int it1 = 2; //first two - standart
+ foreach (string path in FSpot.ColorManagement.ProfilesPaths) {
+ if (path == Preferences.Get<string> (Preferences.DISPLAY_COLOR_PROFILE_PATH)) // :(
+ display_combo.Active = it1;
+ it1++;
+ }
+ break;
+ }
display_combo.Changed += HandleDisplayChanged;
destination_combo.Model = new ProfileList ();
@@ -95,8 +115,26 @@
destination_combo.PackStart (name_cell, true);
destination_combo.SetCellDataFunc (name_cell, new CellLayoutDataFunc (ProfileList.ProfileNameDataFunc));
destination_combo.SetCellDataFunc (desc_cell, new CellLayoutDataFunc (ProfileList.ProfileDescriptionDataFunc));
- destination_combo.Changed += HandleDisplayChanged;
-#endif
+ //destination_combo.Changed += HandleDisplayChanged;
+ destination_combo.Changed += HandleDestinationChanged;
+ //debug
+ switch (FSpot.ColorManagement.DestinationProfile.ProductName) {
+ case "sRGB built-in - (lcms internal)":
+ destination_combo.Active = 0;
+ break;
+ case "rgb built-in - (lcms internal)":
+ destination_combo.Active = 1;
+ break;
+ default:
+ int it1 = 2; //first two - standart
+ foreach (string path in FSpot.ColorManagement.ProfilesPaths) {
+ if (new Cms.Profile(path).ProductName == FSpot.ColorManagement.DestinationProfile.ProductName)
+ destination_combo.Active = it1;
+ it1++;
+ }
+ break;
+ }
+
TagMenu tagmenu = new TagMenu (null, MainWindow.Toplevel.Database.Tags);
tagmenu.Populate (false);
@@ -150,21 +188,48 @@
this.Dialog.Destroyed += HandleDestroyed;
}
-#if FALSE
private void HandleDisplayChanged (object sender, System.EventArgs args)
- {
+ {
TreeIter iter;
- if (display_combo.GetActiveIter (out iter))
- FSpot.Global.DisplayProfile = (Profile) display_combo.Model.GetValue (iter, 0);
+ Gdk.Screen screen = Gdk.Screen.Default;
+ if (display_combo.GetActiveIter (out iter)) {
+ //FSpot.Global.DisplayProfile = (Cms.Profile) display_combo.Model.GetValue (iter, 0);
+ FSpot.ColorManagement.DisplayProfile = (Cms.Profile) display_combo.Model.GetValue (iter, 0);
+ FSpot.Widgets.CompositeUtils.SetScreenProfile(screen, FSpot.ColorManagement.DisplayProfile);
+ FSpot.ColorManagement.ReloadSettings();
+ image_view.Reload ();
+
+
+ /*
+ Cms.Profile profile1 = Cms.Profile.GetScreenProfile (screen);
+ byte [] data2 = profile1.Save ();
+ byte [] data1 = FSpot.Global.DisplayProfile.Save ();
+
+ if (profile1 != FSpot.Global.DisplayProfile)
+ {
+ MessageDialog md = new MessageDialog (null,
+ DialogFlags.DestroyWithParent,
+ MessageType.Error,
+ ButtonsType.Close,
+ FSpot.Global.DisplayProfile.ProductDescription + " " + data1.Length.ToString() + " | " + profile1.ProductDescription + " " + data2.Length.ToString());
+
+ int result = md.Run ();
+ md.Destroy();
+ }
+ */
+ }
}
private void HandleDestinationChanged (object sender, System.EventArgs args)
{
TreeIter iter;
- if (destination_combo.GetActiveIter (out iter))
- FSpot.Global.DestinationProfile = (Profile) destination_combo.Model.GetValue (iter, 0);
+ if (destination_combo.GetActiveIter (out iter)) {
+ //FSpot.Global.DestinationProfile = (Cms.Profile) destination_combo.Model.GetValue (iter, 0);
+ FSpot.ColorManagement.DestinationProfile = (Cms.Profile) destination_combo.Model.GetValue (iter, 0);
+ //FSpot.ColorManagement.ReloadProfileList();
+ }
}
-#endif
+
private void HandleTagMenuSelected (Tag t)
{
tag_button.Label = t.Name;
Index: src/MainWindow.cs
===================================================================
--- src/MainWindow.cs (revision 4185)
+++ src/MainWindow.cs (working copy)
@@ -247,6 +247,7 @@
LoadPreference (Preferences.SIDEBAR_POSITION);
LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);
+ FSpot.ColorManagement.LoadSettings(); //debug
toolbar = new Gtk.Toolbar ();
toolbar_vbox.PackStart (toolbar);
@@ -1660,6 +1661,7 @@
public void HandlePreferences (object sender, EventArgs args)
{
+ PreferenceDialog.image_view = photo_view.photo_view; //debug: to reload pic after change color profile "on fly"
PreferenceDialog.Show ();
}
Index: src/PhotoView.cs
===================================================================
--- src/PhotoView.cs (revision 4185)
+++ src/PhotoView.cs (working copy)
@@ -29,7 +29,7 @@
FSpot.Delay commit_delay;
private bool has_selection = false;
- private FSpot.PhotoImageView photo_view;
+ public FSpot.PhotoImageView photo_view; //debug?
private ScrolledWindow photo_view_scrolled;
private EventBox background;
@@ -277,7 +277,9 @@
try {
FSpot.SepiaTone sepia = new FSpot.SepiaTone (photo);
- sepia.Image = View.CompletePixbuf ();
+ //sepia.Image = View.CompletePixbuf ();
+ //debug
+ sepia.Image = FSpot.PhotoLoader.Load (query.Items [photo_view.Item.Index]);
sepia.Adjust ();
photo.Changes.DataChanged = true;
Core.Database.Photos.Commit (photo);
@@ -292,7 +294,9 @@
try {
FSpot.Desaturate desaturate = new FSpot.Desaturate (photo);
- desaturate.Image = View.CompletePixbuf ();
+ //desaturate.Image = View.CompletePixbuf ();
+ //debug
+ desaturate.Image = FSpot.PhotoLoader.Load (query.Items [photo_view.Item.Index]);
desaturate.Adjust ();
photo.Changes.DataChanged = true;
Core.Database.Photos.Commit (photo);
@@ -322,7 +326,9 @@
Photo photo = (Photo)Item.Current;
try {
- Pixbuf original_pixbuf = photo_view.CompletePixbuf ();
+ //Pixbuf original_pixbuf = photo_view.CompletePixbuf ();
+ //debug
+ Pixbuf original_pixbuf = FSpot.PhotoLoader.Load (query.Items [photo_view.Item.Index]);
if (original_pixbuf == null) {
return;
}
@@ -688,7 +694,7 @@
break;
case ConstraintType.SameAsPhoto:
try {
- Pixbuf pb = photo_view.CompletePixbuf ();
+ Pixbuf pb = photo_view.CompletePixbuf (); //debug: must be fixed or not?
photo_view.SelectionXyRatio = (double)pb.Width / (double)pb.Height;
} catch (System.Exception ex) {
Console.WriteLine (ex);
Index: src/TagSelectionWidget.cs
===================================================================
--- src/TagSelectionWidget.cs (revision 4185)
+++ src/TagSelectionWidget.cs (working copy)
@@ -192,8 +192,16 @@
SetBackground (renderer, tag);
// FIXME I can't set the Pixbuf to null, not sure if it's a GTK# bug...
- if (tag.Icon != null)
- (renderer as CellRendererPixbuf).Pixbuf = tag.SizedIcon;
+ if (tag.Icon != null) {
+ //debug
+ if (!tag.SizedIcon.HasAlpha) {
+ Gdk.Pixbuf test = tag.SizedIcon.Copy();
+ FSpot.ColorManagement.ApplyScreenProfile(test);
+ (renderer as CellRendererPixbuf).Pixbuf = test;//tag.SizedIcon;
+ }
+ else
+ (renderer as CellRendererPixbuf).Pixbuf = tag.SizedIcon;
+ }
else
(renderer as CellRendererPixbuf).Pixbuf = empty_pixbuf;
}
Index: src/GPhotoCamera.cs
===================================================================
--- src/GPhotoCamera.cs (revision 4185)
+++ src/GPhotoCamera.cs (working copy)
@@ -183,7 +183,10 @@
if (bytedata.Length > 0) {
MemoryStream dataStream = new MemoryStream (bytedata);
try {
- return new Pixbuf (dataStream);
+ //debug
+ Gdk.Pixbuf temp = new Pixbuf (dataStream);
+ FSpot.ColorManagement.ApplyScreenProfile(temp);
+ return temp;
} catch (Exception e) {
// Actual errors with the data libgphoto gives us have been
// observed here see b.g.o #357569.
Index: src/PrintOperation.cs
===================================================================
--- src/PrintOperation.cs (revision 4185)
+++ src/PrintOperation.cs (working copy)
@@ -188,7 +188,9 @@
case CustomPrintWidget.FitMode.Scaled:
scalex = scaley = Math.Min (w/pixbuf.Width, h/pixbuf.Height);
break;
- }
+ }
+ //debug
+ FSpot.ColorManagement.ApplyPrinterProfile(ref pixbuf);
double rectw = w / scalex;
double recth = h / scaley;
Index: src/TagCommands.cs
===================================================================
--- src/TagCommands.cs (revision 4185)
+++ src/TagCommands.cs (working copy)
@@ -281,7 +281,8 @@
orig_name = last_valid_name = t.Name;
tag_name_entry.Text = t.Name;
-
+
+ FSpot.ColorManagement.ApplyScreenProfile(t.Icon); //debug
icon_image.Pixbuf = t.Icon;
PopulateCategoryOptionMenu (t);
@@ -409,13 +410,19 @@
if (image_view.Pixbuf != null) {
if (width > 0 && height > 0) {
- tmp = new Gdk.Pixbuf (image_view.Pixbuf, x, y, width, height);
+ //debug
+ Gdk.Pixbuf temp = FSpot.PhotoLoader.Load (query.Items [image_view.Item.Index]);
+ tmp = new Gdk.Pixbuf (temp, x, y, width, height);
PreviewPixbuf = PixbufUtils.TagIconFromPixbuf (tmp);
+ FSpot.ColorManagement.ApplyScreenProfile(PreviewPixbuf); //debug
tmp.Dispose ();
} else {
- PreviewPixbuf = PixbufUtils.TagIconFromPixbuf (image_view.Pixbuf);
+ //debug
+ Gdk.Pixbuf temp = FSpot.PhotoLoader.Load (query.Items [image_view.Item.Index]);
+ PreviewPixbuf = PixbufUtils.TagIconFromPixbuf (temp);
+ FSpot.ColorManagement.ApplyScreenProfile(PreviewPixbuf); //debug
}
}
}
Index: src/Makefile.am
===================================================================
--- src/Makefile.am (revision 4185)
+++ src/Makefile.am (working copy)
@@ -73,8 +73,7 @@
$(srcdir)/Widgets/Rating.cs \
$(srcdir)/Widgets/SaneTreeView.cs \
$(srcdir)/Widgets/ScrolledView.cs \
- $(srcdir)/Widgets/Sidebar.cs \
- $(srcdir)/Widgets/TagView.cs
+ $(srcdir)/Widgets/Sidebar.cs
F_SPOT_CSDISTFILES = \
$(srcdir)/AsyncPixbufLoader.cs \
@@ -86,6 +85,7 @@
$(srcdir)/CompatFileChooser.cs \
$(srcdir)/ControlOverlay.cs \
$(srcdir)/Core.cs \
+ $(srcdir)/Core/ColorManagement.cs \
$(srcdir)/Core/Photo.cs \
$(srcdir)/Core/PhotoVersion.cs \
$(srcdir)/DateCommands.cs \
@@ -252,6 +252,7 @@
$(srcdir)/Widgets/SoftFocus.cs \
$(srcdir)/Widgets/TagEntry.cs \
$(srcdir)/Widgets/TagMenu.cs \
+ $(srcdir)/Widgets/TagView.cs \
$(srcdir)/Widgets/Tilt.cs \
$(srcdir)/Widgets/TrayView.cs \
$(srcdir)/Widgets/Wipe.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]