[ease] [editor] Automatically sized imported images



commit 44e9b776eca6765eb8eb1605bcd5f3e0ffe18215
Author: Nate Stedman <natesm gmail com>
Date:   Mon Aug 23 07:48:18 2010 -0400

    [editor] Automatically sized imported images
    
    Images that are too large to fit on the slide will be
    automatically scaled down, maintaining their aspect
    ratio.

 ease/ease-editor-window.vala |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/ease/ease-editor-window.vala b/ease/ease-editor-window.vala
index 63357c5..cebf268 100644
--- a/ease/ease-editor-window.vala
+++ b/ease/ease-editor-window.vala
@@ -451,6 +451,20 @@ internal class Ease.EditorWindow : Gtk.Window
 			int width = 0, height = 0;
 			img.get_base_size(out width, out height);
 			
+			if (width > document.width)
+			{
+				var factor = document.width / (float)width;
+				width = (int)(factor * width);
+				height = (int)(factor * height);
+			}
+			
+			if (height > document.height)
+			{
+				var factor = document.height / (float)height;
+				width = (int)(factor * width);
+				height = (int)(factor * height);
+			}
+			
 			e.width = width;
 			e.height = height;
 			e.x = slide.width / 2 - width / 2;



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