[f-spot: 37/40] transform the selection for editors



commit c6c1b256815b1ef6af2ad8da3ad2cc85360eb8c3
Author: Stephane Delcroix <stephane delcroix org>
Date:   Tue Jun 23 16:49:29 2009 +0200

    transform the selection for editors
    
    As Editors uses a Loader automagically correcting the orientation, the Selection, which is in image non oriented coords, needs to be transformed.
    
    This would require a better solution at the Editor, or PhotoLoader level.

 src/Editors/CropEditor.cs   |    9 ++++++---
 src/Editors/RedEyeEditor.cs |    7 ++++---
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/Editors/CropEditor.cs b/src/Editors/CropEditor.cs
index ac6283c..eab6a33 100644
--- a/src/Editors/CropEditor.cs
+++ b/src/Editors/CropEditor.cs
@@ -170,12 +170,15 @@ namespace FSpot.Editors {
 		}
 
 		protected override Pixbuf Process (Pixbuf input, Cms.Profile input_profile) {
+			Rectangle selection = FSpot.Utils.PixbufUtils.TransformOrientation ((int)State.PhotoImageView.PixbufOrientation <= 4 ? input.Width : input.Height,
+											    (int)State.PhotoImageView.PixbufOrientation <= 4 ? input.Height : input.Width,
+											    State.Selection, State.PhotoImageView.PixbufOrientation);
 			Pixbuf edited = new Pixbuf (input.Colorspace,
 						 input.HasAlpha, input.BitsPerSample,
-						 State.Selection.Width, State.Selection.Height);
+						 selection.Width, selection.Height);
 
-			input.CopyArea (State.Selection.X, State.Selection.Y,
-					State.Selection.Width, State.Selection.Height, edited, 0, 0);
+			input.CopyArea (selection.X, selection.Y,
+					selection.Width, selection.Height, edited, 0, 0);
 			return edited;
 		}
 	}
diff --git a/src/Editors/RedEyeEditor.cs b/src/Editors/RedEyeEditor.cs
index 4fd9749..9da7a1d 100644
--- a/src/Editors/RedEyeEditor.cs
+++ b/src/Editors/RedEyeEditor.cs
@@ -26,10 +26,11 @@ namespace FSpot.Editors {
 		}
 
 		protected override Pixbuf Process (Pixbuf input, Cms.Profile input_profile) {
-			Gdk.Rectangle area = new Gdk.Rectangle (State.Selection.X, State.Selection.Y,
-					State.Selection.Width, State.Selection.Height);
+			Rectangle selection = FSpot.Utils.PixbufUtils.TransformOrientation ((int)State.PhotoImageView.PixbufOrientation <= 4 ? input.Width : input.Height,
+											    (int)State.PhotoImageView.PixbufOrientation <= 4 ? input.Height : input.Width,
+											    State.Selection, State.PhotoImageView.PixbufOrientation);
 			int threshold = Preferences.Get<int> (Preferences.EDIT_REDEYE_THRESHOLD);
-			return PixbufUtils.RemoveRedeye (input, area, threshold);
+			return PixbufUtils.RemoveRedeye (input, selection, threshold);
 		}
 	}
 }



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