<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # QMatrix Class Reference ## [[QtGui](index.htm) module] 該系列QMatrix類指定坐標系的2D變換。[More...](#details) ### Methods * `__init__ (self)` * `__init__ (self, float?m11, float?m12, float?m21, float?m22, float?dx, float?dy)` * `__init__ (self, QMatrix?matrix)` * `float det (self)` * `float determinant (self)` * `float dx (self)` * `float dy (self)` * `(QMatrix, bool?invertible) inverted (self)` * `bool isIdentity (self)` * `bool isInvertible (self)` * `float m11 (self)` * `float m12 (self)` * `float m21 (self)` * `float m22 (self)` * `(int?tx, int?ty) map (self, int?x, int?y)` * `(float?tx, float?ty) map (self, float?x, float?y)` * `QPoint map (self, QPoint?p)` * `QPointF map (self, QPointF?p)` * `QLine map (self, QLine?l)` * `QLineF map (self, QLineF?l)` * `QPolygonF map (self, QPolygonF?a)` * `QPolygon map (self, QPolygon?a)` * `QRegion map (self, QRegion?r)` * `QPainterPath map (self, QPainterPath?p)` * `QRect mapRect (self, QRect)` * `QRectF mapRect (self, QRectF)` * `QPolygon mapToPolygon (self, QRect?r)` * `reset (self)` * `QMatrix rotate (self, float?a)` * `QMatrix scale (self, float?sx, float?sy)` * `setMatrix (self, float?m11, float?m12, float?m21, float?m22, float?dx, float?dy)` * `QMatrix shear (self, float?sh, float?sv)` * `QMatrix translate (self, float?dx, float?dy)` ### Special Methods * `bool __eq__ (self, QMatrix)` * `QMatrix __imul__ (self, QMatrix)` * `QMatrix __mul__ (self, QMatrix?o)` * `bool __ne__ (self, QMatrix)` * * * ## Detailed Description 這個類可以醃制。 該系列QMatrix類指定坐標系的2D變換。 矩陣指定如何轉換,縮放,剪切或旋轉的坐標系,并繪制圖形時,通常使用。的QMatrix ,在對比[QTransform](qtransform.html),不允許透視變換。[QTransform](qtransform.html)是Qt的建議轉換類。 一個系列QMatrix對象可使用內置的[setMatrix](qmatrix.html#setMatrix)( )[scale](qmatrix.html#scale)( )[rotate](qmatrix.html#rotate)( )[translate](qmatrix.html#translate)()和[shear](qmatrix.html#shear)()函數。另外,它可以通過施加建[basic matrix operations](#basic-matrix-operations)。該矩陣也可以被定義時構造,并且它可以使用被重置為單位矩陣(默認值)的[reset](qmatrix.html#reset)()函數。 該系列QMatrix類支持的圖形原語映射:一個給定的點,線,多邊形,區域或畫家路徑可以映射到由坐標系定義_this_使用矩陣[map](qmatrix.html#map)()函數。在情況下的四邊形的,它的坐標可以用轉化的[mapRect](qmatrix.html#mapRect)()函數。矩形也可以被改造成一個_polygon_(映射到定義的坐標系_this_矩陣),使用[mapToPolygon](qmatrix.html#mapToPolygon)()函數。 系列QMatrix提供[isIdentity](qmatrix.html#isIdentity)()函數,如果矩陣是單位矩陣,并且該方法返回True,則[isInvertible](qmatrix.html#isInvertible)( )函數如果矩陣是非奇異的(即AB = BA = I ),它返回True 。該[inverted](qmatrix.html#inverted)( )函數返回一個倒置的副本_this_矩陣,如果它是可逆的(否則返回單位矩陣) 。此外,系列QMatrix提供[determinant](qmatrix.html#determinant)( )函數返回矩陣的行列式。 最后,該系列QMatrix類支持矩陣乘法,而類的對象可以被串流播放,以及比較。 ### Rendering Graphics 在繪制圖形時,矩陣定義轉換,但實際轉換是由繪圖函數中執行[QPainter](qpainter.html)。 默認情況下,[QPainter](qpainter.html)操作相關聯的設備自己的坐標系上。標準坐標系統[QPaintDevice](qpaintdevice.html)有其原點位于左上角的位置。該_x_值向右增大;_y_值向下增大。有關完整說明,請參閱[coordinate system](index.htm)文檔。 [QPainter](qpainter.html)有功能轉換,縮放,剪切和旋轉坐標系不使用的QMatrix 。例如: | ![](https://img.kancloud.cn/a9/37/a937c12f5b08aefdb93bf821a61d3e1d_115x114.png) | ``` void SimpleTransformation.paintEvent([QPaintEvent](qpaintevent.html) *) { [QPainter](qpainter.html) painter(this); painter.setPen([QPen](qpen.html)([Qt](qt.html).blue, 1, [Qt](qt.html).DashLine)); painter.drawRect(0, 0, 100, 100); painter.rotate(45); painter.setFont([QFont](qfont.html)("Helvetica", 24)); painter.setPen([QPen](qpen.html)([Qt](qt.html).black, 1)); painter.drawText(20, 10, "QMatrix"); } ``` | 雖然這些功能都非常的方便,它可以更有效地建立的QMatrix和呼叫[QPainter.setMatrix](index.htm#setMatrix)( )如果你想執行一個以上的變換操作。例如: | ![](https://img.kancloud.cn/75/c8/75c8ed8e46553cff471efd86952a32af_113x113.png) | ``` void CombinedTransformation.paintEvent([QPaintEvent](qpaintevent.html) *) { [QPainter](qpainter.html) painter(this); painter.setPen([QPen](qpen.html)([Qt](qt.html).blue, 1, [Qt](qt.html).DashLine)); painter.drawRect(0, 0, 100, 100); QMatrix matrix; matrix.translate(50, 50); matrix.rotate(45); matrix.scale(0.5, 1.0); painter.setMatrix(matrix); painter.setFont([QFont](qfont.html)("Helvetica", 24)); painter.setPen([QPen](qpen.html)([Qt](qt.html).black, 1)); painter.drawText(20, 10, "QMatrix"); } ``` | ### Basic Matrix Operations ![](https://img.kancloud.cn/8c/81/8c812f40e058ca2118de621d99ccae84_210x209.png) 一個系列QMatrix對象包含一個3× 3的矩陣。該`dx`和`dy`元素指定水平和垂直平移。該`m11`和`m22`元素指定水平和垂直縮放。最后,本`m21`和`m12`元素指定水平和垂直_shearing_。 使用下列公式的QMatrix轉換成在平面上的點到另一點: ``` x' = m11*x + m21*y + dx y' = m22*y + m12*x + dy ``` 點_(x, y)_是原來的點,并_(x', y')_是變換點。_(x', y')_可以轉化回_(x, y)_通過執行在相同的操作[inverted](qmatrix.html#inverted)( )矩陣。 各矩陣元素可以構造矩陣時進行設置,或通過使用[setMatrix](qmatrix.html#setMatrix)( )函數以后。它們也可以通過使用操縱[translate](qmatrix.html#translate)( )[rotate](qmatrix.html#rotate)( )[scale](qmatrix.html#scale)()和[shear](qmatrix.html#shear)( )的便利功能,當前設定的值可以使用檢索[m11](qmatrix.html#m11)( )[m12](qmatrix.html#m12)( )[m21](qmatrix.html#m21)( )[m22](qmatrix.html#m22)( )[dx](qmatrix.html#dx)()和[dy](qmatrix.html#dy)()函數。 翻譯是最簡單的改造。環境`dx`和`dy`將移動坐標系`dx`沿X軸和單位`dy`沿Y軸的單位。縮放可以通過設置來實現`m11`和`m22`。例如,設置`m11`為2,并`m22`1.5將增加一倍的高度,增加50%的寬度。該單位矩陣`m11`和`m22`設置為1(所有其他被設置為0)的點映射到其自身。剪切被控制`m12`和`m21`。這些元件設置值不同于零將扭轉的坐標系。旋轉通過仔細設置兩個剪切因子和比例因子實現。 下面是使用基本的矩陣運算組合變換的例子: | ![](https://img.kancloud.cn/75/c8/75c8ed8e46553cff471efd86952a32af_113x113.png) | ``` void BasicOperations.paintEvent([QPaintEvent](qpaintevent.html) *) { double pi = 3.14; double a = pi/180 * 45.0; double sina = sin(a); double cosa = cos(a); QMatrix translationMatrix(1, 0, 0, 1, 50.0, 50.0); QMatrix rotationMatrix(cosa, sina, -sina, cosa, 0, 0); QMatrix scalingMatrix(0.5, 0, 0, 1.0, 0, 0); QMatrix matrix; matrix = scalingMatrix * rotationMatrix * translationMatrix; [QPainter](qpainter.html) painter(this); painter.setPen([QPen](qpen.html)([Qt](qt.html).blue, 1, [Qt](qt.html).DashLine)); painter.drawRect(0, 0, 100, 100); painter.setMatrix(matrix); painter.setFont([QFont](qfont.html)("Helvetica", 24)); painter.setPen([QPen](qpen.html)([Qt](qt.html).black, 1)); painter.drawText(20, 10, "QMatrix"); } ``` | * * * ## Method Documentation ``` QMatrix.__init__ (self) ``` 構造一個單位矩陣。 所有的元素都設置為零,除了`m11`和`m22`(指定刻度),它被設置為1 。 **See also** [reset](qmatrix.html#reset)( ) 。 ``` QMatrix.__init__ (self, float?m11, float?m12, float?m21, float?m22, float?dx, float?dy) ``` ``` QMatrix.__init__ (self, QMatrix?matrix) ``` 構造一個矩陣的元素,_m11_,_m12_,_m21_,_m22_,_dx_和_dy_。 **See also** [setMatrix](qmatrix.html#setMatrix)( ) 。 ``` float QMatrix.det (self) ``` ``` float QMatrix.determinant (self) ``` 返回矩陣的行列式。 此功能被引入Qt的4.6 。 ``` float QMatrix.dx (self) ``` 返回水平平移因子。 **See also** [translate](qmatrix.html#translate)()和[Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` float QMatrix.dy (self) ``` 返回垂直平移因子。 **See also** [translate](qmatrix.html#translate)()和[Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` (QMatrix, bool?invertible) QMatrix.inverted (self) ``` 返回該矩陣的一個倒置的副本。 如果矩陣是奇異的(不可逆的) ,則返回的矩陣是單位矩陣。如果_invertible_是有效的(即不為0 ) ,將其值設置為True,如果矩陣是可逆的,否則設置為False 。 **See also** [isInvertible](qmatrix.html#isInvertible)( ) 。 ``` bool QMatrix.isIdentity (self) ``` 返回True如果矩陣為單位矩陣,否則返回False 。 **See also** [reset](qmatrix.html#reset)( ) 。 ``` bool QMatrix.isInvertible (self) ``` 返回True如果矩陣是可逆的,否則返回False 。 **See also** [inverted](qmatrix.html#inverted)( ) 。 ``` float QMatrix.m11 (self) ``` 返回水平縮放系數。 **See also** [scale](qmatrix.html#scale)()和[Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` float QMatrix.m12 (self) ``` 返回垂直剪切因素。 **See also** [shear](qmatrix.html#shear)()和[Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` float QMatrix.m21 (self) ``` 返回水平剪切的因素。 **See also** [shear](qmatrix.html#shear)()和[Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` float QMatrix.m22 (self) ``` 返回垂直縮放系數。 **See also** [scale](qmatrix.html#scale)()和[Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` (int?tx, int?ty) QMatrix.map (self, int?x, int?y) ``` 對應給定的坐標_x_和_y_成由該矩陣定義的坐標系。被放置在所得到的值*_tx_和*_ty_元。 則坐標值用下面的公式轉化: ``` x' = m11*x + m21*y + dx y' = m22*y + m12*x + dy ``` 點(x ,y)是原始的點,和( X',Y ')是變換后的??點。 **See also** [Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` (float?tx, float?ty) QMatrix.map (self, float?x, float?y) ``` ``` QPoint QMatrix.map (self, QPoint?p) ``` [ 這是一個重載函數。 對應給定的坐標_x_和_y_成由該矩陣定義的坐標系。被放置在所得到的值*_tx_和*_ty_元。需要注意的是轉換后的坐標四舍五入到最接近的整數。 ](qpoint.html) ``` QPointF QMatrix.map (self, QPointF?p) ``` [ 這是一個重載函數。 ](qpointf.html) [創建并返回一個](qpointf.html)[QPointF](qpointf.html)對象,它是給定一個副本_point_,映射到由該矩陣定義的坐標系。 ``` QLine QMatrix.map (self, QLine?l) ``` [ 這是一個重載函數。 ](qline.html) [創建并返回一個](qline.html)[QPoint](qpoint.html)對象,它是給定一個副本_point_,映射到由該矩陣定義的坐標系。需要注意的是轉換后的坐標四舍五入到最接近的整數。 ``` QLineF QMatrix.map (self, QLineF?l) ``` [ 這是一個重載函數。 ](qlinef.html) [創建并返回一個](qlinef.html)[QLineF](qlinef.html)對象,它是給定一個副本_line_,映射到由該矩陣定義的坐標系。 ``` QPolygonF QMatrix.map (self, QPolygonF?a) ``` [ 這是一個重載函數。 ](qpolygonf.html) [創建并返回一個](qpolygonf.html)[QLine](qline.html)對象,它是給定一個副本_line_,映射到由該矩陣定義的坐標系。需要注意的是轉換后的坐標四舍五入到最接近的整數。 ``` QPolygon QMatrix.map (self, QPolygon?a) ``` [ 這是一個重載函數。 ](qpolygon.html) [創建并返回一個](qpolygon.html)[QPolygonF](qpolygonf.html)對象,它是給定一個副本_polygon_,映射到由該矩陣定義的坐標系。 ``` QRegion QMatrix.map (self, QRegion?r) ``` [ 這是一個重載函數。 ](qregion.html) [創建并返回一個](qregion.html)[QPolygon](qpolygon.html)對象,它是給定一個副本_polygon_,映射到由該矩陣定義的坐標系。需要注意的是轉換后的坐標四舍五入到最接近的整數。 ``` QPainterPath QMatrix.map (self, QPainterPath?p) ``` [ 這是一個重載函數。 ](qpainterpath.html) [創建并返回一個](qpainterpath.html)[QRegion](qregion.html)對象,它是給定一個副本_region_,映射到由該矩陣定義的坐標系。 調用此方法可以是相當昂貴的,如果旋轉或剪切的使用。 ``` QRect QMatrix.mapRect (self, QRect) ``` [](qrect.html) [創建并返回一個](qrect.html)[QRectF](qrectf.html)對象,它是給定一個副本_rectangle_,映射到由該矩陣定義的坐標系。 矩形的坐標是用下面的公式轉化: ``` x' = m11*x + m21*y + dx y' = m22*y + m12*x + dy ``` 如果已經指定旋轉或剪切,這個函數返回_bounding_矩形。要檢索的精確區域定_rectangle_映射到,使用[mapToPolygon](qmatrix.html#mapToPolygon)( )函數來代替。 **See also** [mapToPolygon](qmatrix.html#mapToPolygon)()和[Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` QRectF QMatrix.mapRect (self, QRectF) ``` [ 這是一個重載函數。 ](qrectf.html) [創建并返回一個](qrectf.html)[QRect](qrect.html)對象,它是給定一個副本_rectangle_,映射到由該矩陣定義的坐標系。需要注意的是轉換后的坐標四舍五入到最接近的整數。 ``` QPolygon QMatrix.mapToPolygon (self, QRect?r) ``` [](qpolygon.html) [創建并返回一個](qpolygon.html)[QPolygon](qpolygon.html)給定的表示_rectangle_,映射到由該矩陣定義的坐標系。 矩形的坐標是用下面的公式轉化: ``` x' = m11*x + m21*y + dx y' = m22*y + m12*x + dy ``` 多邊形和矩形的行為略有不同,當轉換(由于四舍五入的整數) ,所以`matrix.map(QPolygon(rectangle))`并不總是相同`matrix.mapToPolygon(rectangle)`。 **See also** [mapRect](qmatrix.html#mapRect)()和[Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` QMatrix.reset (self) ``` 重置矩陣單位矩陣,即所有元素都設置為零,除非`m11`和`m22`(指定刻度),其被設置為1 。 **See also** [QMatrix](qmatrix.html#QMatrix)( )[isIdentity](qmatrix.html#isIdentity)()和[Basic Matrix Operations](qmatrix.html#basic-matrix-operations)。 ``` QMatrix QMatrix.rotate (self, float?a) ``` [ 旋轉坐標系中給出_degrees_逆時針。 ](qmatrix.html) [請注意,如果你申請一個](qmatrix.html)[QMatrix](qmatrix.html)在小窗口坐標定義的一個點,該旋轉方向將因為y軸指向下是順時針。 返回一個引用到矩陣。 **See also** [setMatrix](qmatrix.html#setMatrix)( ) 。 ``` QMatrix QMatrix.scale (self, float?sx, float?sy) ``` [ 通過縮放坐標系_sx_水平和_sy_垂直,并返回一個引用到矩陣。 ](qmatrix.html) [**See also**](qmatrix.html) [setMatrix](qmatrix.html#setMatrix)( ) 。 ``` QMatrix.setMatrix (self, float?m11, float?m12, float?m21, float?m22, float?dx, float?dy) ``` 設置矩陣的元素為指定的值,_m11_,_m12_,_m21_,_m22_,_dx_和_dy_。 請注意,此功能取代了以前的值。[QMatrix](qmatrix.html)提供[translate](qmatrix.html#translate)( )[rotate](qmatrix.html#rotate)( )[scale](qmatrix.html#scale)()和[shear](qmatrix.html#shear)( )方便的功能來操作基于當前定義的坐標系統中的各種矩陣元素。 **See also** [QMatrix](qmatrix.html#QMatrix)( ) 。 ``` QMatrix QMatrix.shear (self, float?sh, float?sv) ``` [ 通過剪坐標系_sh_水平和_sv_垂直,并返回一個引用到矩陣。 ](qmatrix.html) [**See also**](qmatrix.html) [setMatrix](qmatrix.html#setMatrix)( ) 。 ``` QMatrix QMatrix.translate (self, float?dx, float?dy) ``` [ 移動的坐標系統_dx_沿x軸和_dy_沿著y軸,并返回引用到矩陣。 ](qmatrix.html) [**See also**](qmatrix.html) [setMatrix](qmatrix.html#setMatrix)( ) 。 ``` bool QMatrix.__eq__ (self, QMatrix) ``` ``` QMatrix QMatrix.__imul__ (self, QMatrix) ``` [](qmatrix.html) ``` QMatrix QMatrix.__mul__ (self, QMatrix?o) ``` [ ``` bool QMatrix.__ne__ (self, QMatrix) ``` ](qmatrix.html)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看