[ease/text] Added "zoom" property to Actor.
- From: Nate Stedman <natesm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ease/text] Added "zoom" property to Actor.
- Date: Fri, 24 Dec 2010 06:03:20 +0000 (UTC)
commit 28c019a6892686dfef694766bbf8f39946e2232d
Author: Nate Stedman <natesm gmail com>
Date: Mon Nov 29 15:36:36 2010 -0500
Added "zoom" property to Actor.
Allows Cairo-based actors to perform higher resolution renders to
prevent pixelization/blurring. Also makes the editor rectangle
always visible, even when zoomed out to 10%.
ease-core/ease-actor.vala | 13 +++++++++++++
ease-core/ease-cairo-actor.vala | 12 +++++++++++-
ease/ease-editor-embed.vala | 5 +++++
3 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/ease-core/ease-actor.vala b/ease-core/ease-actor.vala
index 1493caa..01bca7a 100644
--- a/ease-core/ease-actor.vala
+++ b/ease-core/ease-actor.vala
@@ -75,6 +75,14 @@ public abstract class Ease.Actor : Clutter.Group
* Whether or not the actor is currently in editing mode.
*/
public bool editing { get; set; default = false; }
+
+ /**
+ * The current zoom factor of the Actor. This refers to the size at which
+ * the Actor is being displayed, typically in an editor view. Actors that
+ * use Cairo rendering can use this properly to properly use Cairo's vector
+ * nature to provide non-pixelated renderings at higher zoom levels.
+ */
+ public float zoom { get; set; default = 1; }
/**
* Instantiate a new Actor
@@ -100,6 +108,11 @@ public abstract class Ease.Actor : Clutter.Group
editor_rect.width = e.width;
editor_rect.height = e.height;
add_actor(editor_rect);
+
+ notify["zoom"].connect(() => {
+ editor_rect.border_width =
+ (uint)Math.ceil(((1 / zoom) * RECT_WIDTH));
+ });
}
// update the actor's position when changed in the element
diff --git a/ease-core/ease-cairo-actor.vala b/ease-core/ease-cairo-actor.vala
index 2a98bb4..f8087a8 100644
--- a/ease-core/ease-cairo-actor.vala
+++ b/ease-core/ease-cairo-actor.vala
@@ -39,15 +39,25 @@ public class Ease.CairoActor : Actor
// draw at full resolution again once redraw is complete
notify["resizing"].connect(() => { if (!resizing) draw(); });
+
+ // render when zooming
+ notify["zoom"].connect(() => {
+ if (zoom > 1) draw();
+ });
}
internal void draw()
{
- tex.set_surface_size((uint)element.width, (uint)element.height);
+ // only rescale if zoom is larger than 1
+ var render_zoom = zoom > 1 ? zoom : 1;
+
+ tex.set_surface_size((uint)(element.width * render_zoom),
+ (uint)(element.height * render_zoom));
tex.clear();
var cr = tex.create();
try
{
+ cr.scale(render_zoom, render_zoom);
element.cairo_render(cr, resizing);
}
catch (Error e)
diff --git a/ease/ease-editor-embed.vala b/ease/ease-editor-embed.vala
index f56ad07..1a72415 100644
--- a/ease/ease-editor-embed.vala
+++ b/ease/ease-editor-embed.vala
@@ -397,6 +397,11 @@ internal class Ease.EditorEmbed : ScrolledEmbedWindow, UndoSource
return;
}
+ foreach (var actor in slide_actor.contents)
+ {
+ (actor as Actor).zoom = zoom;
+ }
+
var w = zoom * slide_actor.slide.width;
var h = zoom * slide_actor.slide.height;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]