Matrix.ScalePrepend(Double, Double) 方法

定義

在這個 Matrix 結構之前加上指定的縮放向量。

public:
 void ScalePrepend(double scaleX, double scaleY);
public void ScalePrepend (double scaleX, double scaleY);
member this.ScalePrepend : double * double -> unit
Public Sub ScalePrepend (scaleX As Double, scaleY As Double)

參數

scaleX
Double

要沿著 X 軸縮放這個 Matrix 結構的值。

scaleY
Double

要沿著 Y 軸縮放這個 Matrix 結構的值。

範例

下列範例示範如何在結構前面加上尺規 Matrix


private Matrix scalePrependExample()
{
    Matrix myMatrix = new Matrix(5, 10, 15, 20, 25, 30);
    
    // Prepend a scale ab with a horizontal factor of 2
    // and a vertical factor of 4 about the origin.
    // After this operation,
    // myMatrix is equal to (10, 20, 60, 80, 25, 30)
    myMatrix.ScalePrepend(2, 4);
    
    return myMatrix;
}

private Matrix scalePrependAboutPointExample()
{
    Matrix myMatrix = new Matrix(5, 10, 15, 20, 25, 30);
    
    // Prepend a scale with a horizontal factor of 2
    // and a vertical factor of 4 about the 
    // point (100,100).
    // After this operation,
    // myMatrix is equal to (10, 20, 60, 80, -4975, -6970)
    myMatrix.ScaleAtPrepend(2, 4, 100, 100);
    
    return myMatrix;
}

備註

在複合轉換中,個別轉換的順序很重要。 例如,如果您第一次旋轉,然後縮放,則轉譯會得到與第一次轉譯、旋轉、縮放結果不同的結果。 其中一個原因是旋轉和縮放等轉換是在座標系統的原點上完成。 縮放位於原點的物件會產生與調整已移出原點的物件不同的結果。 同樣地,旋轉位於原點的物件會產生與旋轉已從原點移開的物件不同的結果。

適用於

另請參閱