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

定義

在這個 Matrix 前面加上以指定的點為中心的所指定縮放。Prepends the specified scale about the specified point of this 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 軸的縮放因數。The x-axis scale factor.

scaleY
Double

Y 軸的縮放因數。The y-axis scale factor.

centerX
Double

要做為縮放作業中心點的 X 座標。The x-coordinate of the point about which the scale operation is performed.

centerY
Double

要做為縮放作業中心點的 Y 座標。The y-coordinate of the point about which the scale operation is performed.

範例

下列範例將示範如何在中預先加上尺規 MatrixThe following example shows how to prepend a scale to a 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;
}        

備註

在複合轉換中,個別轉換的順序很重要。In a composite transformation, the order of individual transformations is important. 例如,如果您第一次旋轉,然後進行調整,然後轉譯,則會得到不同的結果,而不是您第一次轉譯、接著旋轉然後調整規模。For example, if you first rotate, then scale, then translate, you get a different result than if you first translate, then rotate, then scale. 其中一個原因是很重要的是,旋轉和縮放等轉換是針對座標系統的原點進行的。One reason order is significant is that transformations like rotation and scaling are done with respect to the origin of the coordinate system. 調整位於原點中央的物件會產生不同的結果,而不是縮放已從原點移出的物件。Scaling an object that is centered at the origin produces a different result than scaling an object that has been moved away from the origin. 同樣地,旋轉位於原點中央的物件會產生不同的結果,而不是旋轉離開來源的物件。Similarly, rotating an object that is centered at the origin produces a different result than rotating an object that has been moved away from the origin.

適用於