From a9e14ddb5134736d7f0239a7bd9fc917b72bbadd Mon Sep 17 00:00:00 2001 From: Hywel Thomas Date: Thu, 23 Feb 2012 12:16:21 +0100 Subject: [PATCH] Added ResetTransform method to Context --- Xwt.Gtk/Xwt.GtkBackend/ContextBackendHandler.cs | 8 +++++++- Xwt/Xwt.Backends/IContextBackendHandler.cs | 4 +++- Xwt/Xwt.Drawing/Context.cs | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Xwt.Gtk/Xwt.GtkBackend/ContextBackendHandler.cs b/Xwt.Gtk/Xwt.GtkBackend/ContextBackendHandler.cs index ce1f48b8..9b6de308 100644 --- a/Xwt.Gtk/Xwt.GtkBackend/ContextBackendHandler.cs +++ b/Xwt.Gtk/Xwt.GtkBackend/ContextBackendHandler.cs @@ -254,7 +254,13 @@ namespace Xwt.GtkBackend ctx.Context.Fill ();*/ } - public void Rotate (object backend, double angle) + public void ResetTransform (object backend) + { + GtkContext gc = (GtkContext)backend; + gc.Context.IdentityMatrix(); + } + + public void Rotate (object backend, double angle) { GtkContext gc = (GtkContext)backend; gc.Context.Rotate ((angle * System.Math.PI) / 180); diff --git a/Xwt/Xwt.Backends/IContextBackendHandler.cs b/Xwt/Xwt.Backends/IContextBackendHandler.cs index c605ffa0..20dddd28 100644 --- a/Xwt/Xwt.Backends/IContextBackendHandler.cs +++ b/Xwt/Xwt.Backends/IContextBackendHandler.cs @@ -86,7 +86,9 @@ namespace Xwt.Backends void DrawImage (object backend, object img, double x, double y, double alpha); void DrawImage (object backend, object img, double x, double y, double width, double height, double alpha); - + + void ResetTransform (object backend); + void Rotate (object backend, double angle); void Translate (object backend, double tx, double ty); diff --git a/Xwt/Xwt.Drawing/Context.cs b/Xwt/Xwt.Drawing/Context.cs index 65d6bd35..b788b7d0 100644 --- a/Xwt/Xwt.Drawing/Context.cs +++ b/Xwt/Xwt.Drawing/Context.cs @@ -245,6 +245,15 @@ namespace Xwt.Drawing { handler.DrawImage (Backend, GetBackend (img), rect.X, rect.Y, rect.Width, rect.Height, alpha); } + + /// + /// Resets the Current Trasnformation Matrix (CTM) to the Identity Matrix + /// + public void ResetTransform () + { + handler.ResetTransform (Backend); + } + /// /// Applies a rotation transformation