void IRenderLoopHost.OnRenderLoop_PrepareRendering(EngineDevice engineDevice) { if ((m_targetPanel != null) && (m_renderLoop != null) && (m_renderLoop.Camera != null) && (m_swapChain != null)) { // Update swap chain scaling (only relevant for SwapChainPanel targets) // see https://www.packtpub.com/books/content/integrating-direct3d-xaml-and-windows-81 if (m_compositionScaleChanged && m_targetPanel.CompositionRescalingNeeded) { m_compositionScaleChanged = false; DXGI.SwapChain2 swapChain2 = m_swapChain.QueryInterfaceOrNull <DXGI.SwapChain2>(); if (swapChain2 != null) { try { SharpDX.Mathematics.Interop.RawMatrix3x2 inverseScale = new SharpDX.Mathematics.Interop.RawMatrix3x2(); inverseScale.M11 = 1.0f / (float)m_targetPanel.CompositionScaleX; inverseScale.M22 = 1.0f / (float)m_targetPanel.CompositionScaleY; swapChain2.MatrixTransform = inverseScale; } finally { swapChain2.Dispose(); } } } } }
/// <summary> /// <p>Indicates whether the specified matrix is invertible.</p> /// </summary> /// <param name = "matrix"><dd> <p>The matrix to test.</p> </dd></param> /// <returns><p><strong>true</strong> if the matrix was inverted; otherwise, <strong>false</strong>.</p></returns> /// <doc-id>dd368045</doc-id> /// <unmanaged>BOOL D2D1IsMatrixInvertible([In] const D2D_MATRIX_3X2_F* matrix)</unmanaged> /// <unmanaged-short>D2D1IsMatrixInvertible</unmanaged-short> public static unsafe SharpDX.Mathematics.Interop.RawBool IsMatrixInvertible(ref SharpDX.Mathematics.Interop.RawMatrix3x2 matrix) { SharpDX.Mathematics.Interop.RawBool __result__; fixed(void *matrix_ = &matrix) __result__ = D2D1IsMatrixInvertible_(matrix_); return(__result__); }
/// <summary> /// <p>Creates a rotation transformation that rotates by the specified angle about the specified point.</p> /// </summary> /// <param name="angle"><dd> <p>The clockwise rotation angle, in degrees. </p> </dd></param> /// <param name="center"><dd> <p>The point about which to rotate.</p> </dd></param> /// <param name="matrix"><dd> <p>When this method returns, contains the new rotation transformation. You must allocate storage for this parameter. </p> </dd></param> /// <remarks> /// <p>Rotation occurs in the plane of the 2-D surface.</p><p><strong>Windows Phone 8.1:</strong> This API is supported.</p> /// </remarks> /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='D2D1MakeRotateMatrix']/*"/> /// <msdn-id>dd368049</msdn-id> /// <unmanaged>void D2D1MakeRotateMatrix([In] float angle,[In] D2D_POINT_2F center,[Out] D2D_MATRIX_3X2_F* matrix)</unmanaged> /// <unmanaged-short>D2D1MakeRotateMatrix</unmanaged-short> public static void MakeRotateMatrix(float angle, SharpDX.Mathematics.Interop.RawVector2 center, out SharpDX.Mathematics.Interop.RawMatrix3x2 matrix) { unsafe { matrix = new SharpDX.Mathematics.Interop.RawMatrix3x2(); fixed(void *matrix_ = &matrix) D2D1MakeRotateMatrix_(angle, center, matrix_); } }
public SharpDX.Mathematics.Interop.RawMatrix3x2 GetCurrentTransform(object clientDrawingContext) { D2D.RenderTarget render = clientDrawingContext as D2D.RenderTarget; if (render == null) { throw new InvalidOperationException("render is null"); } SharpDX.Mathematics.Interop.RawMatrix3x2 d2Dmatrix = render.Transform; return(d2Dmatrix); }
/// <summary> /// <p>Tries to invert the specified matrix.</p> /// </summary> /// <param name="matrix"><dd> <p>The matrix to invert.</p> </dd></param> /// <returns><p><strong>true</strong> if the matrix was inverted; otherwise, <strong>false</strong>.</p></returns> /// <remarks> /// <p><strong>Windows Phone 8.1:</strong> This API is supported.</p> /// </remarks> /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='D2D1InvertMatrix']/*"/> /// <msdn-id>dd368044</msdn-id> /// <unmanaged>BOOL D2D1InvertMatrix([InOut] D2D_MATRIX_3X2_F* matrix)</unmanaged> /// <unmanaged-short>D2D1InvertMatrix</unmanaged-short> public static SharpDX.Mathematics.Interop.RawBool InvertMatrix(ref SharpDX.Mathematics.Interop.RawMatrix3x2 matrix) { unsafe { SharpDX.Mathematics.Interop.RawBool __result__; fixed(void *matrix_ = &matrix) __result__ = D2D1InvertMatrix_(matrix_); return(__result__); } }
/// <summary> /// <p>Computes the maximum factor by which a given transform can stretch any vector.</p> /// </summary> /// <param name="matrix"><dd> <p>The input transform matrix.</p> </dd></param> /// <returns><p>The scale factor.</p></returns> /// <remarks> /// <p>Formally, if M is the input matrix, this method will return the maximum value of |V * M| / |V| for all vectors V, where |.| denotes length. </p><p><strong>Note</strong>??Since this describes how M affects vectors (rather than points), the translation components (_31 and _32) of M are ignored.</p><p><strong>Windows Phone 8.1:</strong> This API is supported.</p> /// </remarks> /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='D2D1ComputeMaximumScaleFactor']/*"/> /// <msdn-id>dn280381</msdn-id> /// <unmanaged>float D2D1ComputeMaximumScaleFactor([In] const D2D_MATRIX_3X2_F* matrix)</unmanaged> /// <unmanaged-short>D2D1ComputeMaximumScaleFactor</unmanaged-short> public static float ComputeMaximumScaleFactor(ref SharpDX.Mathematics.Interop.RawMatrix3x2 matrix) { unsafe { float __result__; fixed(void *matrix_ = &matrix) __result__ = D2D1ComputeMaximumScaleFactor_(matrix_); return(__result__); } }
/// <summary> /// <p>Creates a skew transformation that has the specified x-axis angle, y-axis angle, and center point. </p> /// </summary> /// <param name = "angleX"><dd> <p>The x-axis skew angle, which is measured in degrees counterclockwise from the y-axis.</p> </dd></param> /// <param name = "angleY"><dd> <p>The y-axis skew angle, which is measured in degrees counterclockwise from the x-axis.</p> </dd></param> /// <param name = "center"><dd> <p>The center point of the skew operation.</p> </dd></param> /// <param name = "matrix"><dd> <p>When this method returns, contains the rotation transformation. You must allocate storate for this parameter.</p> </dd></param> /// <doc-id>dd368052</doc-id> /// <unmanaged>void D2D1MakeSkewMatrix([In] float angleX,[In] float angleY,[In] D2D_POINT_2F center,[Out] D2D_MATRIX_3X2_F* matrix)</unmanaged> /// <unmanaged-short>D2D1MakeSkewMatrix</unmanaged-short> public static unsafe void MakeSkewMatrix(System.Single angleX, System.Single angleY, SharpDX.Mathematics.Interop.RawVector2 center, out SharpDX.Mathematics.Interop.RawMatrix3x2 matrix) { matrix = default(SharpDX.Mathematics.Interop.RawMatrix3x2); fixed(void *matrix_ = &matrix) D2D1MakeSkewMatrix_(angleX, angleY, center, matrix_); }
public static System.Drawing.Drawing2D.Matrix ToMatrix(SharpDX.Mathematics.Interop.RawMatrix3x2 matrix) { return(new System.Drawing.Drawing2D.Matrix(matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.M31, matrix.M32)); }