次の方法で共有


Matrix3x2F::Rotation メソッド

指定した角度と中心点を持つ回転変換を作成します。

構文

static Matrix3x2F Rotation(
    FLOAT angle,
    D2D1_POINT_2F centerPoint = D2D1::Point2F()
);

パラメーター

  • angle
    FLOAT 回転角度 (度単位)。正の角度の場合は時計回りの回転、負の角度の場合は反時計回りの回転を作成します。
  • centerPoint
    D2D1_POINT_2F 回転の中心となる点。

戻り値

Matrix3x2F

新しい回転変換。

解説

このメソッドを呼び出すときに、オブジェクトを回転する際の軸となる centerPoint、および回転角度 angle (度単位) を指定します。次の図は、四角形の中心を軸に 45°回転した四角形を示しています。

 

四角形の中心を軸に 45°回転された四角形を示すスクリーン ショット

 

次の例では、D2D1::Matrix3x2F::Rotation メソッドを使用して、四角形をその中心を軸に時計回りに 45°回転する回転行列を作成し、その行列をレンダー ターゲット (m_pRenderTarget) の SetTransform メソッドに渡します。

次の図は、前の回転変換を四角形に適用した結果を示しています。元の四角形は点線で、回転後の四角形は実線で描画されています。

 

四角形の中心を軸に時計回りに 45°回転された四角形の図

 

      // Create a rectangle.
    D2D1_RECT_F rectangle = D2D1::Rect(438.0f, 301.5f, 498.0f, 361.5f);

    // Draw the rectangle.
    m_pRenderTarget->DrawRectangle(
        rectangle,
        m_pOriginalShapeBrush,
        1.0f,
        m_pStrokeStyleDash
        );

    // Apply the rotation transform to the render target.
    m_pRenderTarget->SetTransform(
        D2D1::Matrix3x2F::Rotation(
            45.0f,
            D2D1::Point2F(468.0f, 331.5f))
        );

    // Fill the rectangle.
    m_pRenderTarget->FillRectangle(rectangle, m_pFillBrush);

    // Draw the transformed rectangle.
    m_pRenderTarget->DrawRectangle(rectangle, m_pTransformedShapeBrush);

この例では、コードが省略されています。完全な例については、「単一の変換の例」を参照してください。変換の詳細については、「変換の概要」を参照してください。

要件

クライアントの最小要件

Windows 7, Windows Vista SP2 および Windows Vista 用のプラットフォーム更新プログラム

サーバーの最小要件

Windows Server 2008 R2, Windows Server 2008 SP2 および Windows Server 2008 用のプラットフォーム更新プログラム

ヘッダー

D2d1helper.h

ライブラリ

D2d1.lib

DLL

D2d1.dll

名前空間

D2D1

参照

Matrix3x2F