@@ -1873,6 +1873,39 @@ def scale(self, sx, sy=None):
1873
1873
self .invalidate ()
1874
1874
return self
1875
1875
1876
+ def skew (self , xAxisRot , yAxisRot ):
1877
+ """
1878
+ Adds a skew in place.
1879
+
1880
+ *xAxisRot* and *yAxisRot* are the rotations of the *x*- and
1881
+ *y*-axes, respectively, in radians.
1882
+
1883
+ Returns *self*, so this method can easily be chained with more
1884
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
1885
+ and :meth:`scale`.
1886
+ """
1887
+ rotX = np .tan (xAxisRot )
1888
+ rotY = np .tan (yAxisRot )
1889
+ skew_mtx = np .array (
1890
+ [[1.0 , rotY , 0.0 ], [rotX , 1.0 , 0.0 ], [0.0 , 0.0 , 1.0 ]],
1891
+ np .float_ )
1892
+ self ._mtx = np .dot (skew_mtx , self ._mtx )
1893
+ self .invalidate ()
1894
+ return self
1895
+
1896
+ def skew_deg (self , xAxisRot , yAxisRot ):
1897
+ """
1898
+ Adds a skew in place.
1899
+
1900
+ *xAxisRot* and *yAxisRot* are the rotations of the *x*- and
1901
+ *y*-axes, respectively, in degrees.
1902
+
1903
+ Returns *self*, so this method can easily be chained with more
1904
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
1905
+ and :meth:`scale`.
1906
+ """
1907
+ return self .skew (np .deg2rad (xAxisRot ), np .deg2rad (yAxisRot ))
1908
+
1876
1909
def _get_is_separable (self ):
1877
1910
mtx = self .get_matrix ()
1878
1911
return mtx [0 , 1 ] == 0.0 and mtx [1 , 0 ] == 0.0
0 commit comments