]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxGraphicsContext::CreateMatrix(wxAffineMatrix2D) overload.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 3 Apr 2012 11:50:19 +0000 (11:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 3 Apr 2012 11:50:19 +0000 (11:50 +0000)
Make it easy to convert generic wxAffineMatrix2D to native wxGraphicsMatrix.

Closes #13188.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71085 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/graphics.h
interface/wx/graphics.h

index d385d7db029424368c5f9f4af54d7850935b019e..ad0206e2d30fd6129924078f65ee960a29b48ae2 100644 (file)
@@ -510,6 +510,16 @@ public:
     virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
         wxDouble tx=0.0, wxDouble ty=0.0) const;
 
+    wxGraphicsMatrix CreateMatrix( const wxAffineMatrix2DBase& mat ) const
+    {
+        wxMatrix2D mat2D;
+        wxPoint2DDouble tr;
+        mat.Get(&mat2D, &tr);
+
+        return CreateMatrix(mat2D.m_11, mat2D.m_12, mat2D.m_21, mat2D.m_22,
+                            tr.m_x, tr.m_y);
+    }
+
     // push the current state of the context, ie the transformation matrix on a stack
     virtual void PushState() = 0;
 
index d2104f4425e6345fd7c5d63981289bc41a66f6e0..912763c38f60507cf54ca32ddf7cec7caf0965aa 100644 (file)
@@ -512,6 +512,14 @@ public:
                                           wxDouble tx = 0.0,
                                           wxDouble ty = 0.0) const;
 
+    /**
+        Creates a native affine transformation matrix from the passed
+        generic one.
+
+        @since 2.9.4
+    */
+    wxGraphicsMatrix CreateMatrix(const wxAffineMatrix2DBase& mat) const;
+
     /**
         Creates a native graphics path which is initially empty.
     */