[f-spot: 30/40] compute the reverse transfomation in order to get the source area
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Subject: [f-spot: 30/40] compute the reverse transfomation in order to get the source area
- Date: Wed, 24 Jun 2009 09:50:13 +0000 (UTC)
commit fb56f41d9a42ae42682dd12fe0cac761d85a93e9
Author: Stephane Delcroix <stephane delcroix org>
Date: Mon Jun 22 15:59:36 2009 +0200
compute the reverse transfomation in order to get the source area
src/Utils/PixbufUtils.cs | 20 ++++++++++++++++++++
src/Widgets/ImageView.cs | 10 +++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/src/Utils/PixbufUtils.cs b/src/Utils/PixbufUtils.cs
index a92dd96..8fef3ed 100644
--- a/src/Utils/PixbufUtils.cs
+++ b/src/Utils/PixbufUtils.cs
@@ -91,6 +91,26 @@ namespace FSpot.Utils
return area;
}
+ public static PixbufOrientation ReverseTransformation (PixbufOrientation orientation)
+ {
+ switch (orientation) {
+ default:
+ case PixbufOrientation.TopLeft:
+ case PixbufOrientation.TopRight:
+ case PixbufOrientation.BottomRight:
+ case PixbufOrientation.BottomLeft:
+ return orientation;
+ case PixbufOrientation.LeftTop:
+ return PixbufOrientation.RightBottom;
+ case PixbufOrientation.RightTop:
+ return PixbufOrientation.LeftBottom;
+ case PixbufOrientation.RightBottom:
+ return PixbufOrientation.LeftTop;
+ case PixbufOrientation.LeftBottom:
+ return PixbufOrientation.RightTop;
+ }
+ }
+
public static Pixbuf TransformOrientation (Pixbuf src, PixbufOrientation orientation)
{
Pixbuf dest;
diff --git a/src/Widgets/ImageView.cs b/src/Widgets/ImageView.cs
index a162b19..87b70ff 100644
--- a/src/Widgets/ImageView.cs
+++ b/src/Widgets/ImageView.cs
@@ -744,11 +744,11 @@ namespace FSpot.Widgets
Rectangle pixbuf_area = PixbufUtils.TransformOrientation ((int)scaled_width,
(int)scaled_height,
- new Rectangle (-(area.X - x_offset),
- -(area.Y - y_offset),
+ new Rectangle ((area.X - x_offset),
+ (area.Y - y_offset),
area.Width,
area.Height),
- pixbuf_orientation);
+ PixbufUtils.ReverseTransformation (pixbuf_orientation));
using (Pixbuf temp_pixbuf = new Pixbuf (Colorspace.Rgb, false, 8, pixbuf_area.Width, pixbuf_area.Height)) {
if (Pixbuf.HasAlpha)
temp_pixbuf.Fill (0x00000000);
@@ -756,10 +756,10 @@ namespace FSpot.Widgets
Pixbuf.CompositeColor (temp_pixbuf,
0, 0,
pixbuf_area.Width, pixbuf_area.Height,
- pixbuf_area.X, pixbuf_area.Y,
+ -pixbuf_area.X, -pixbuf_area.Y,
zoom, zoom,
zoom == 1.0 ? InterpType.Nearest : interpolation, 255,
- -pixbuf_area.X, -pixbuf_area.Y,
+ pixbuf_area.X, pixbuf_area.Y,
CheckPattern.CheckSize, CheckPattern.Color1, CheckPattern.Color2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]