Ejemplo n.º 1
0
        internal static unsafe void ConvertToD3DMATRIX(
            /* in */ Matrix* matrix, 
            /* out */ D3DMATRIX* d3dMatrix
            ) 
        { 
            *d3dMatrix = D3DMATRIXIdentity;
 
            float* pD3DMatrix = (float*)d3dMatrix;
            double* pMatrix = (double*)matrix;

            // m11 = m11 
            pD3DMatrix[0] = (float)pMatrix[0];
 
            // m12 = m12 
            pD3DMatrix[1] = (float)pMatrix[1];
 
            // m21 = m21
            pD3DMatrix[4] = (float)pMatrix[2];

            // m22 = m22 
            pD3DMatrix[5] = (float)pMatrix[3];
 
            // m41 = offsetX 
            pD3DMatrix[12] = (float)pMatrix[4];
 
            // m42 = offsetY
            pD3DMatrix[13] = (float)pMatrix[5];
        }
Ejemplo n.º 2
0
        internal static unsafe void ConvertFromD3DMATRIX(
            /* in */ D3DMATRIX* d3dMatrix, 
            /* out */ Matrix* matrix
            )
        {
            float* pD3DMatrix = (float*)d3dMatrix; 
            double* pMatrix = (double*)matrix;
 
            // 
            // Convert first D3DMatrix Vector
            // 

            pMatrix[0] = (double) pD3DMatrix[0]; // m11 = m11
            pMatrix[1] = (double) pD3DMatrix[1]; // m12 = m12
 
            // Assert that non-affine fields are identity or NaN
            // 
            // Multiplication with an affine 2D matrix (i.e., a matrix 
            // with only _11, _12, _21, _22, _41, & _42 set to non-identity
            // values) containing NaN's, can cause the NaN's to propagate to 
            // all other fields.  Thus, we allow NaN's in addition to
            // identity values.
            Debug.Assert(pD3DMatrix[2] == 0.0f || Single.IsNaN(pD3DMatrix[2]));
            Debug.Assert(pD3DMatrix[3] == 0.0f || Single.IsNaN(pD3DMatrix[3])); 

            // 
            // Convert second D3DMatrix Vector 
            //
 
            pMatrix[2] = (double) pD3DMatrix[4]; // m21 = m21
            pMatrix[3] = (double) pD3DMatrix[5]; // m22 = m22
            Debug.Assert(pD3DMatrix[6] == 0.0f || Single.IsNaN(pD3DMatrix[6]));
            Debug.Assert(pD3DMatrix[7] == 0.0f || Single.IsNaN(pD3DMatrix[7])); 

            // 
            // Convert third D3DMatrix Vector 
            //
 
            Debug.Assert(pD3DMatrix[8] == 0.0f || Single.IsNaN(pD3DMatrix[8]));
            Debug.Assert(pD3DMatrix[9] == 0.0f || Single.IsNaN(pD3DMatrix[9]));
            Debug.Assert(pD3DMatrix[10] == 1.0f || Single.IsNaN(pD3DMatrix[10]));
            Debug.Assert(pD3DMatrix[11] == 0.0f || Single.IsNaN(pD3DMatrix[11])); 

            // 
            // Convert fourth D3DMatrix Vector 
            //
 
            pMatrix[4] = (double) pD3DMatrix[12]; // m41 = offsetX
            pMatrix[5] = (double) pD3DMatrix[13]; // m42 = offsetY
            Debug.Assert(pD3DMatrix[14] == 0.0f || Single.IsNaN(pD3DMatrix[14]));
            Debug.Assert(pD3DMatrix[15] == 1.0f || Single.IsNaN(pD3DMatrix[15])); 

            *((MatrixTypes*)(pMatrix+6)) = MatrixTypes.TRANSFORM_IS_UNKNOWN; 
        } 
 unsafe internal static extern void MilUtility_GetTileBrushMapping(
     D3DMATRIX* transform,
     D3DMATRIX* relativeTransform,
     Stretch stretch, 
     AlignmentX alignmentX,
     AlignmentY alignmentY, 
     BrushMappingMode viewPortUnits, 
     BrushMappingMode viewBoxUnits,
     Rect* shapeFillBounds, 
     Rect* contentBounds,
     ref Rect viewport,
     ref Rect viewbox,
     out D3DMATRIX contentToShape, 
     out int brushIsEmpty
     ); 
Ejemplo n.º 4
0
 private extern static /*HRESULT*/ int MIL3DCalcProjected2DBounds(
     ref D3DMATRIX pFullTransform3D,
     ref MILRect3D pboxBounds, 
     out MilRectF prcDestRect);