Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media / Composition.cs / 1 / 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 MIL_COLORF ColorToMIL_COLORF(Color c) { MIL_COLORF 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 MIL_3DPOINTF Point3DToMIL_3DPOINTF(Point3D p) { MIL_3DPOINTF point; point.X = (float) p.X; point.Y = (float) p.Y; point.Z = (float) p.Z; return point; } internal static MIL_3DPOINTF Vector3DToMIL_3DPOINTF(Vector3D v) { MIL_3DPOINTF point; point.X = (float) v.X; point.Y = (float) v.Y; point.Z = (float) v.Z; return point; } internal static MIL_3DQUATERNIONF QuaternionToMIL_3DQUATERNIONF(Quaternion q) { MIL_3DQUATERNIONF 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 MIL_MATRIXD MatrixToMIL_MATRIXD(Matrix m) { MIL_MATRIXD 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 MIL_MATRIX3X2D TransformToMIL_MATRIX3X2D(Transform t) { MIL_MATRIX3X2D 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 MIL_MATRIX3X2D MatrixToMIL_MATRIX3X2D(Matrix m) { return MatrixToMIL_MATRIX3X2D(ref m); } internal static MIL_MATRIX3X2D MatrixToMIL_MATRIX3X2D(ref Matrix m) { MIL_MATRIX3X2D 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 MIL_MATRIX3X2DToMatrix(ref MIL_MATRIX3X2D 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 sync with this one! internal static partial class MilCoreApi { [DllImport(DllImport.MilCore)] internal static extern int MilConnection_RecordUCE(); ////// 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( MIL_MATRIX3X2D *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( MIL_MATRIX3X2D *pWorldMatrix, MIL_PEN_DATA *pPenData, double *pDashArray, Point *pPoints, byte *pTypes, UInt32 pointCount, UInt32 segmentCount, MIL_MATRIX3X2D *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( MIL_MATRIX3X2D *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( MIL_MATRIX3X2D *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( MIL_MATRIX3X2D *pMatrix1, FillRule fillRule1, byte *pPathData1, UInt32 nSize1, MIL_MATRIX3X2D *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, MIL_MATRIX3X2D *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 MIL_MATRIX3X2D* 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
- Formatter.cs
- ThreadExceptionDialog.cs
- TabPage.cs
- MeshGeometry3D.cs
- XomlCompilerError.cs
- BaseResourcesBuildProvider.cs
- ToolBarPanel.cs
- TextParagraph.cs
- StaticExtension.cs
- NativeDirectoryServicesQueryAPIs.cs
- SmtpNetworkElement.cs
- DesignTimeVisibleAttribute.cs
- UniqueIdentifierService.cs
- PrintDocument.cs
- Graphics.cs
- ManagementEventWatcher.cs
- LayoutTable.cs
- ListControl.cs
- SelectedGridItemChangedEvent.cs
- ApplyTemplatesAction.cs
- PowerStatus.cs
- WebPartTransformerCollection.cs
- shaperfactoryquerycacheentry.cs
- Separator.cs
- TextTreeInsertElementUndoUnit.cs
- WebExceptionStatus.cs
- ToolStripSplitButton.cs
- Parser.cs
- MailMessageEventArgs.cs
- RtfFormatStack.cs
- TreeBuilder.cs
- DbgUtil.cs
- XmlNamespaceManager.cs
- XmlSubtreeReader.cs
- EntryPointNotFoundException.cs
- WindowsMenu.cs
- FileDetails.cs
- WsatAdminException.cs
- Mapping.cs
- ValueTypeFixupInfo.cs
- StorageEntityContainerMapping.cs
- Rotation3DKeyFrameCollection.cs
- PriorityItem.cs
- TextServicesDisplayAttributePropertyRanges.cs
- OperationBehaviorAttribute.cs
- StorageEntityContainerMapping.cs
- MsmqIntegrationBindingCollectionElement.cs
- LineGeometry.cs
- Compilation.cs
- MsmqHostedTransportConfiguration.cs
- ProfileService.cs
- ProtocolsInstallComponent.cs
- ConstrainedDataObject.cs
- SimpleTypeResolver.cs
- SQLUtility.cs
- DataRelationPropertyDescriptor.cs
- SoapEnumAttribute.cs
- TrackingProfileCache.cs
- SessionStateSection.cs
- SwitchAttribute.cs
- UniqueID.cs
- XmlSchemaComplexContentExtension.cs
- RealProxy.cs
- ToolStripControlHost.cs
- DataObjectAttribute.cs
- HttpStreamFormatter.cs
- SqlProviderManifest.cs
- TypeConverterHelper.cs
- XmlEntityReference.cs
- UnsafeNetInfoNativeMethods.cs
- BufferAllocator.cs
- UserPreferenceChangedEventArgs.cs
- ImageIndexConverter.cs
- DllNotFoundException.cs
- ClientSettingsProvider.cs
- PcmConverter.cs
- FormsAuthenticationTicket.cs
- IncrementalCompileAnalyzer.cs
- WebBrowserPermission.cs
- Merger.cs
- SQLDateTimeStorage.cs
- NetCodeGroup.cs
- DbConvert.cs
- HttpListener.cs
- WasNotInstalledException.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- EventLogTraceListener.cs
- CommandEventArgs.cs
- ContentPosition.cs
- BinHexDecoder.cs
- ConstraintStruct.cs
- Console.cs
- StylusEditingBehavior.cs
- BinaryOperationBinder.cs
- ProviderUtil.cs
- AlphabeticalEnumConverter.cs
- WebPartCancelEventArgs.cs
- ArrowControl.xaml.cs
- AsnEncodedData.cs
- FaultException.cs