語言

Matrix.ScaleAtPrepend(Double, Double, Double, Double) 方法

定義

在指定刻度前加上該點的指定點 Matrix。

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

參數

scaleX
Double

就是 x 軸比例因子。

scaleY
Double

就是縱軸比例因子。

centerX
Double

尺度運算所繞點的 x 座標。

centerY
Double

尺度運算所繞的點的 y 座標。

範例

以下範例展示了如何在 前加一個刻度。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;
}

備註

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

適用於