Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / Composition.cs / 1305600 / Composition.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: Composition.cs // //--------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Windows; using System.Windows.Media; using System.Windows.Media.Media3D; using System.Runtime.InteropServices; using System.Windows.Media.Animation; using MS.Internal; using MS.Win32; using System.Diagnostics; using System.Windows.Media.Composition; using System.Security; using System.Security.Permissions; using Microsoft.Internal; namespace System.Windows.Media.Composition { internal static class CompositionResourceManager { public const int InvalidResourceHandle = 0; internal static MilColorF ColorToMilColorF(Color c) { MilColorF color; color.r = c.ScR; color.g = c.ScG; color.b = c.ScB; color.a = c.ScA; return color; } internal static D3DMATRIX Matrix3DToD3DMATRIX(Matrix3D m) { D3DMATRIX matrix; matrix._11 = (float) m.M11; matrix._12 = (float) m.M12; matrix._13 = (float) m.M13; matrix._14 = (float) m.M14; matrix._21 = (float) m.M21; matrix._22 = (float) m.M22; matrix._23 = (float) m.M23; matrix._24 = (float) m.M24; matrix._31 = (float) m.M31; matrix._32 = (float) m.M32; matrix._33 = (float) m.M33; matrix._34 = (float) m.M34; matrix._41 = (float) m.OffsetX; matrix._42 = (float) m.OffsetY; matrix._43 = (float) m.OffsetZ; matrix._44 = (float) m.M44; return matrix; } internal static MilPoint3F Point3DToMilPoint3F(Point3D p) { MilPoint3F point; point.X = (float) p.X; point.Y = (float) p.Y; point.Z = (float) p.Z; return point; } internal static MilPoint3F Vector3DToMilPoint3F(Vector3D v) { MilPoint3F point; point.X = (float) v.X; point.Y = (float) v.Y; point.Z = (float) v.Z; return point; } internal static MilQuaternionF QuaternionToMilQuaternionF(Quaternion q) { MilQuaternionF quat; quat.X = (float) q.X; quat.Y = (float) q.Y; quat.Z = (float) q.Z; quat.W = (float) q.W; return quat; } internal static MilMatrix4x4D MatrixToMilMatrix4x4D(Matrix m) { MilMatrix4x4D matrix; if (m.IsIdentity) { matrix.M_11 = 1.0; matrix.M_12 = 0.0; matrix.M_13 = 0.0; matrix.M_14 = 0.0; matrix.M_21 = 0.0; matrix.M_22 = 1.0; matrix.M_23 = 0.0; matrix.M_24 = 0.0; matrix.M_31 = 0.0; matrix.M_32 = 0.0; matrix.M_33 = 1.0; matrix.M_34 = 0.0; matrix.M_41 = 0.0; matrix.M_42 = 0.0; matrix.M_43 = 0.0; matrix.M_44 = 1.0; } else { matrix.M_11 = m.M11; matrix.M_12 = m.M12; matrix.M_13 = 0.0; matrix.M_14 = 0.0; matrix.M_21 = m.M21; matrix.M_22 = m.M22; matrix.M_23 = 0.0; matrix.M_24 = 0.0; matrix.M_31 = 0.0; matrix.M_32 = 0.0; matrix.M_33 = 1.0; matrix.M_34 = 0.0; matrix.M_41 = m.OffsetX; matrix.M_42 = m.OffsetY; matrix.M_43 = 0.0; matrix.M_44 = 1.0; } return matrix; } internal static MilMatrix3x2D TransformToMilMatrix3x2D(Transform t) { MilMatrix3x2D matrix; if (t == null || t.IsIdentity) { matrix.S_11 = 1.0; matrix.S_12 = 0.0; matrix.S_21 = 0.0; matrix.S_22 = 1.0; matrix.DX = 0.0; matrix.DY = 0.0; } else { Matrix m = t.Value; matrix.S_11 = m.M11; matrix.S_12 = m.M12; matrix.S_21 = m.M21; matrix.S_22 = m.M22; matrix.DX = m.OffsetX; matrix.DY = m.OffsetY; } return matrix; } internal static MilMatrix3x2D MatrixToMilMatrix3x2D(Matrix m) { return MatrixToMilMatrix3x2D(ref m); } internal static MilMatrix3x2D MatrixToMilMatrix3x2D(ref Matrix m) { MilMatrix3x2D matrix; if (m.IsIdentity) { matrix.S_11 = 1.0; matrix.S_12 = 0.0; matrix.S_21 = 0.0; matrix.S_22 = 1.0; matrix.DX = 0.0; matrix.DY = 0.0; } else { matrix.S_11 = m.M11; matrix.S_12 = m.M12; matrix.S_21 = m.M21; matrix.S_22 = m.M22; matrix.DX = m.OffsetX; matrix.DY = m.OffsetY; } return matrix; } internal static Matrix MilMatrix3x2DToMatrix(ref MilMatrix3x2D m) { return new Matrix(m.S_11, m.S_12, m.S_21, m.S_22, m.DX, m.DY); } internal static UInt32 BooleanToUInt32(Boolean v) { return (UInt32)(v ? -1 : 0); } } // This is a copy of what is in milcore.h // That file needs to be kept in [....] with this one! internal static partial class MilCoreApi { ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal static extern int MilComposition_SyncFlush( IntPtr pChannel ); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_GetPointAtLengthFraction( MilMatrix3x2D *pMatrix, FillRule fillRule, byte *pPathData, UInt32 nSize, double rFraction, out Point pt, out Point vecTangent); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_PolygonBounds( MilMatrix3x2D *pWorldMatrix, MIL_PEN_DATA *pPenData, double *pDashArray, Point *pPoints, byte *pTypes, UInt32 pointCount, UInt32 segmentCount, MilMatrix3x2D *pGeometryMatrix, double rTolerance, bool fRelative, bool fSkipHollows, Rect *pBounds); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_PolygonHitTest( MilMatrix3x2D *pGeometryMatrix, MIL_PEN_DATA *pPenData, double *pDashArray, Point* pPoints, byte *pTypes, UInt32 cPoints, UInt32 cSegments, double rTolerance, bool fRelative, Point* pHitPoint, out bool pDoesContain); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_PathGeometryHitTest( MilMatrix3x2D *pMatrix, MIL_PEN_DATA* pPenData, double* pDashArray, FillRule fillRule, byte *pPathData, UInt32 nSize, double rTolerance, bool fRelative, Point* pHitPoint, out bool pDoesContain); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_PathGeometryHitTestPathGeometry( MilMatrix3x2D *pMatrix1, FillRule fillRule1, byte *pPathData1, UInt32 nSize1, MilMatrix3x2D *pMatrix2, FillRule fillRule2, byte *pPathData2, UInt32 nSize2, double rTolerance, bool fRelative, IntersectionDetail* pDetail); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_GeometryGetArea( FillRule fillRule, byte *pPathData, UInt32 nSize, MilMatrix3x2D *pMatrix, double rTolerance, bool fRelative, double* pArea); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern void MilUtility_ArcToBezier( Point ptStart, // The arc's start point Size rRadii, // The ellipse's X and Y radii double rRotation, // Rotation angle of the ellipse's x axis bool fLargeArc, // Choose the larger of the 2 arcs if TRUE SweepDirection fSweepUp, // Sweep the arc increasing the angle if TRUE Point ptEnd, // The arc's end point MilMatrix3x2D* pMatrix, // Transformation matrix Point* pPt, // An array receiving the Bezier points out int cPieces); // The number of output Bezier curves } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: Composition.cs // //--------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Windows; using System.Windows.Media; using System.Windows.Media.Media3D; using System.Runtime.InteropServices; using System.Windows.Media.Animation; using MS.Internal; using MS.Win32; using System.Diagnostics; using System.Windows.Media.Composition; using System.Security; using System.Security.Permissions; using Microsoft.Internal; namespace System.Windows.Media.Composition { internal static class CompositionResourceManager { public const int InvalidResourceHandle = 0; internal static MilColorF ColorToMilColorF(Color c) { MilColorF color; color.r = c.ScR; color.g = c.ScG; color.b = c.ScB; color.a = c.ScA; return color; } internal static D3DMATRIX Matrix3DToD3DMATRIX(Matrix3D m) { D3DMATRIX matrix; matrix._11 = (float) m.M11; matrix._12 = (float) m.M12; matrix._13 = (float) m.M13; matrix._14 = (float) m.M14; matrix._21 = (float) m.M21; matrix._22 = (float) m.M22; matrix._23 = (float) m.M23; matrix._24 = (float) m.M24; matrix._31 = (float) m.M31; matrix._32 = (float) m.M32; matrix._33 = (float) m.M33; matrix._34 = (float) m.M34; matrix._41 = (float) m.OffsetX; matrix._42 = (float) m.OffsetY; matrix._43 = (float) m.OffsetZ; matrix._44 = (float) m.M44; return matrix; } internal static MilPoint3F Point3DToMilPoint3F(Point3D p) { MilPoint3F point; point.X = (float) p.X; point.Y = (float) p.Y; point.Z = (float) p.Z; return point; } internal static MilPoint3F Vector3DToMilPoint3F(Vector3D v) { MilPoint3F point; point.X = (float) v.X; point.Y = (float) v.Y; point.Z = (float) v.Z; return point; } internal static MilQuaternionF QuaternionToMilQuaternionF(Quaternion q) { MilQuaternionF quat; quat.X = (float) q.X; quat.Y = (float) q.Y; quat.Z = (float) q.Z; quat.W = (float) q.W; return quat; } internal static MilMatrix4x4D MatrixToMilMatrix4x4D(Matrix m) { MilMatrix4x4D matrix; if (m.IsIdentity) { matrix.M_11 = 1.0; matrix.M_12 = 0.0; matrix.M_13 = 0.0; matrix.M_14 = 0.0; matrix.M_21 = 0.0; matrix.M_22 = 1.0; matrix.M_23 = 0.0; matrix.M_24 = 0.0; matrix.M_31 = 0.0; matrix.M_32 = 0.0; matrix.M_33 = 1.0; matrix.M_34 = 0.0; matrix.M_41 = 0.0; matrix.M_42 = 0.0; matrix.M_43 = 0.0; matrix.M_44 = 1.0; } else { matrix.M_11 = m.M11; matrix.M_12 = m.M12; matrix.M_13 = 0.0; matrix.M_14 = 0.0; matrix.M_21 = m.M21; matrix.M_22 = m.M22; matrix.M_23 = 0.0; matrix.M_24 = 0.0; matrix.M_31 = 0.0; matrix.M_32 = 0.0; matrix.M_33 = 1.0; matrix.M_34 = 0.0; matrix.M_41 = m.OffsetX; matrix.M_42 = m.OffsetY; matrix.M_43 = 0.0; matrix.M_44 = 1.0; } return matrix; } internal static MilMatrix3x2D TransformToMilMatrix3x2D(Transform t) { MilMatrix3x2D matrix; if (t == null || t.IsIdentity) { matrix.S_11 = 1.0; matrix.S_12 = 0.0; matrix.S_21 = 0.0; matrix.S_22 = 1.0; matrix.DX = 0.0; matrix.DY = 0.0; } else { Matrix m = t.Value; matrix.S_11 = m.M11; matrix.S_12 = m.M12; matrix.S_21 = m.M21; matrix.S_22 = m.M22; matrix.DX = m.OffsetX; matrix.DY = m.OffsetY; } return matrix; } internal static MilMatrix3x2D MatrixToMilMatrix3x2D(Matrix m) { return MatrixToMilMatrix3x2D(ref m); } internal static MilMatrix3x2D MatrixToMilMatrix3x2D(ref Matrix m) { MilMatrix3x2D matrix; if (m.IsIdentity) { matrix.S_11 = 1.0; matrix.S_12 = 0.0; matrix.S_21 = 0.0; matrix.S_22 = 1.0; matrix.DX = 0.0; matrix.DY = 0.0; } else { matrix.S_11 = m.M11; matrix.S_12 = m.M12; matrix.S_21 = m.M21; matrix.S_22 = m.M22; matrix.DX = m.OffsetX; matrix.DY = m.OffsetY; } return matrix; } internal static Matrix MilMatrix3x2DToMatrix(ref MilMatrix3x2D m) { return new Matrix(m.S_11, m.S_12, m.S_21, m.S_22, m.DX, m.DY); } internal static UInt32 BooleanToUInt32(Boolean v) { return (UInt32)(v ? -1 : 0); } } // This is a copy of what is in milcore.h // That file needs to be kept in [....] with this one! internal static partial class MilCoreApi { ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal static extern int MilComposition_SyncFlush( IntPtr pChannel ); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_GetPointAtLengthFraction( MilMatrix3x2D *pMatrix, FillRule fillRule, byte *pPathData, UInt32 nSize, double rFraction, out Point pt, out Point vecTangent); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_PolygonBounds( MilMatrix3x2D *pWorldMatrix, MIL_PEN_DATA *pPenData, double *pDashArray, Point *pPoints, byte *pTypes, UInt32 pointCount, UInt32 segmentCount, MilMatrix3x2D *pGeometryMatrix, double rTolerance, bool fRelative, bool fSkipHollows, Rect *pBounds); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_PolygonHitTest( MilMatrix3x2D *pGeometryMatrix, MIL_PEN_DATA *pPenData, double *pDashArray, Point* pPoints, byte *pTypes, UInt32 cPoints, UInt32 cSegments, double rTolerance, bool fRelative, Point* pHitPoint, out bool pDoesContain); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_PathGeometryHitTest( MilMatrix3x2D *pMatrix, MIL_PEN_DATA* pPenData, double* pDashArray, FillRule fillRule, byte *pPathData, UInt32 nSize, double rTolerance, bool fRelative, Point* pHitPoint, out bool pDoesContain); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_PathGeometryHitTestPathGeometry( MilMatrix3x2D *pMatrix1, FillRule fillRule1, byte *pPathData1, UInt32 nSize1, MilMatrix3x2D *pMatrix2, FillRule fillRule2, byte *pPathData2, UInt32 nSize2, double rTolerance, bool fRelative, IntersectionDetail* pDetail); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern int MilUtility_GeometryGetArea( FillRule fillRule, byte *pPathData, UInt32 nSize, MilMatrix3x2D *pMatrix, double rTolerance, bool fRelative, double* pArea); ////// Critical as this code performs an elevation. /// [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(DllImport.MilCore)] internal unsafe static extern void MilUtility_ArcToBezier( Point ptStart, // The arc's start point Size rRadii, // The ellipse's X and Y radii double rRotation, // Rotation angle of the ellipse's x axis bool fLargeArc, // Choose the larger of the 2 arcs if TRUE SweepDirection fSweepUp, // Sweep the arc increasing the angle if TRUE Point ptEnd, // The arc's end point MilMatrix3x2D* pMatrix, // Transformation matrix Point* pPt, // An array receiving the Bezier points out int cPieces); // The number of output Bezier curves } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DesignBindingEditor.cs
- LongValidator.cs
- NotifyCollectionChangedEventArgs.cs
- CodeNamespaceImport.cs
- StringBuilder.cs
- _DomainName.cs
- BaseCAMarshaler.cs
- StrokeCollectionDefaultValueFactory.cs
- RTTrackingProfile.cs
- ControlParameter.cs
- DelegateArgumentValue.cs
- FamilyTypefaceCollection.cs
- figurelengthconverter.cs
- TableLayout.cs
- ObjectHandle.cs
- IODescriptionAttribute.cs
- SingleConverter.cs
- SessionStateUtil.cs
- GeneralTransform3DGroup.cs
- OleDbRowUpdatedEvent.cs
- ColumnPropertiesGroup.cs
- DrawingVisual.cs
- IDReferencePropertyAttribute.cs
- embossbitmapeffect.cs
- TargetPerspective.cs
- CustomMenuItemCollection.cs
- UnionQueryOperator.cs
- ControlValuePropertyAttribute.cs
- XmlResolver.cs
- WorkflowShape.cs
- DefaultBindingPropertyAttribute.cs
- TransformerInfoCollection.cs
- NamespaceInfo.cs
- RuleSettings.cs
- ToolboxBitmapAttribute.cs
- KeySplineConverter.cs
- MinMaxParagraphWidth.cs
- UIElement.cs
- TextClipboardData.cs
- StandardToolWindows.cs
- XmlUtilWriter.cs
- BamlRecordReader.cs
- DataMemberFieldConverter.cs
- DefaultSettingsSection.cs
- SafeWaitHandle.cs
- NetworkAddressChange.cs
- GrammarBuilderBase.cs
- QilPatternFactory.cs
- ServiceAuthorizationManager.cs
- CheckBox.cs
- XPathEmptyIterator.cs
- GenericEnumConverter.cs
- UIPropertyMetadata.cs
- Point.cs
- ListControl.cs
- SystemException.cs
- ControlValuePropertyAttribute.cs
- InternalResources.cs
- ToolStripSeparatorRenderEventArgs.cs
- login.cs
- DebugTracing.cs
- HealthMonitoringSection.cs
- StreamWriter.cs
- DataContractSerializerElement.cs
- NativeCppClassAttribute.cs
- Process.cs
- Attribute.cs
- BinaryFormatter.cs
- ExpressionList.cs
- RemotingConfigParser.cs
- ToolStripDropDownClosingEventArgs.cs
- MemoryStream.cs
- DataGridHeaderBorder.cs
- ChtmlSelectionListAdapter.cs
- SamlAuthenticationClaimResource.cs
- ConnectionManager.cs
- OverflowException.cs
- PersonalizablePropertyEntry.cs
- SoapProtocolImporter.cs
- XmlSchemaInclude.cs
- PartManifestEntry.cs
- InvalidateEvent.cs
- DataGridViewColumnDesigner.cs
- ResXBuildProvider.cs
- DBAsyncResult.cs
- ParallelRangeManager.cs
- CodeTypeReference.cs
- MultipleViewPattern.cs
- DesignerResources.cs
- StatusBarAutomationPeer.cs
- WebPartExportVerb.cs
- BaseServiceProvider.cs
- BamlLocalizableResourceKey.cs
- NamespaceCollection.cs
- SecurityUniqueId.cs
- Command.cs
- DockPatternIdentifiers.cs
- CompilerInfo.cs
- TextServicesLoader.cs
- SqlNamer.cs