Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Media / Effects / BitmapEffectDrawing.cs / 1 / BitmapEffectDrawing.cs
using System; using System.Diagnostics; using System.Collections.Generic; using MS.Internal; using MS.Internal.Collections; using MS.Internal.PresentationCore; using MS.Utility; using System.Windows; using System.Windows.Media; using System.Windows.Media.Composition; namespace System.Windows.Media.Effects { ////// This class is used by Bitmap Effects to marshal the world transforms /// and the corresponding realizations (bitmaps) for each world transform /// internal sealed partial class BitmapEffectDrawing : Drawing { #region Constructors ////// Default BitmapEffectDrawing constructor. /// Constructs an object with all properties set to their default values /// internal BitmapEffectDrawing() { } #endregion #region Internal methods ////// BitmapEffectDrawing should never have WalkCurrentValue called /// internal override void WalkCurrentValue(DrawingContextWalker ctx) { Debug.Assert(false); } ////// /// internal override void PrecomputeCore() { } ////// Add the transform if it is a new one and mark it for update /// internal override void UpdateRealizations(RealizationContext realizationContext) { Matrix transform = realizationContext.TransformStack.Peek(); if (realizationContext.BaseTransform.IsIdentity == false) { transform *= realizationContext.BaseTransform; } int index = ContainsTransform(transform); if (index == -1) { WorldTransforms.Add(new MatrixTransform(transform)); index = WorldTransforms.Count - 1; } _transformsToKeep.Add(index); _windowClip.Union(realizationContext.WindowClip); } ////// Given the transform, find the index of the corresponding effect drawing /// If there is none, return -1 /// /// ///internal int ContainsTransform(Matrix transform) { int count = Drawings.Count; TransformCollection worldTransforms = WorldTransforms; for (int i = 0; i < count; i++) { Matrix worldTransform = worldTransforms.Internal_GetItem(i).Value; if (worldTransform == transform) { return i; } } return -1; } /// /// Remove all transforms that are not marked to keep. /// If fRemoveDrawings is true, remove the drawings as well /// internal void UpdateTransformAndDrawingLists(bool fRemoveDrawings) { TransformCollection worldTransforms = WorldTransforms; DrawingCollection drawings = Drawings; for (int i = WorldTransforms.Count - 1; i >= 0; i--) { if (!_transformsToKeep.Contains(i)) { worldTransforms.RemoveAt(i); if (fRemoveDrawings) { drawings.RemoveAt(i); } } } _transformsToKeep.Clear(); } ////// Clear both the Drawings and Transform lists /// internal void Clear(DUCE.Channel channel) { TransformCollection vWorldTransforms = WorldTransforms; DrawingCollection vDrawings = Drawings; for (int j = vWorldTransforms.Count - 1; j >= 0; j--) { vWorldTransforms.Internal_GetItem(j).ReleaseOnChannelCore(channel); vDrawings.Internal_GetItem(j).ReleaseOnChannelCore(channel); } vDrawings._collection.Clear(); vWorldTransforms._collection.Clear(); } #endregion Internal methods #region Internal properties internal bool ScheduleForUpdates { get { return _scheduleForUpdates; } set { _scheduleForUpdates = value; } } ////// Gets the window clip /// internal Rect WindowClip { get { return _windowClip; } set { _windowClip = value; } } internal bool IsOnChannel { get { return _duceResource.IsOnAnyChannel; } } #endregion Internal properties #region Private Fields List_transformsToKeep = new List (); bool _scheduleForUpdates = true; Rect _windowClip = Rect.Empty; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Diagnostics; using System.Collections.Generic; using MS.Internal; using MS.Internal.Collections; using MS.Internal.PresentationCore; using MS.Utility; using System.Windows; using System.Windows.Media; using System.Windows.Media.Composition; namespace System.Windows.Media.Effects { /// /// This class is used by Bitmap Effects to marshal the world transforms /// and the corresponding realizations (bitmaps) for each world transform /// internal sealed partial class BitmapEffectDrawing : Drawing { #region Constructors ////// Default BitmapEffectDrawing constructor. /// Constructs an object with all properties set to their default values /// internal BitmapEffectDrawing() { } #endregion #region Internal methods ////// BitmapEffectDrawing should never have WalkCurrentValue called /// internal override void WalkCurrentValue(DrawingContextWalker ctx) { Debug.Assert(false); } ////// /// internal override void PrecomputeCore() { } ////// Add the transform if it is a new one and mark it for update /// internal override void UpdateRealizations(RealizationContext realizationContext) { Matrix transform = realizationContext.TransformStack.Peek(); if (realizationContext.BaseTransform.IsIdentity == false) { transform *= realizationContext.BaseTransform; } int index = ContainsTransform(transform); if (index == -1) { WorldTransforms.Add(new MatrixTransform(transform)); index = WorldTransforms.Count - 1; } _transformsToKeep.Add(index); _windowClip.Union(realizationContext.WindowClip); } ////// Given the transform, find the index of the corresponding effect drawing /// If there is none, return -1 /// /// ///internal int ContainsTransform(Matrix transform) { int count = Drawings.Count; TransformCollection worldTransforms = WorldTransforms; for (int i = 0; i < count; i++) { Matrix worldTransform = worldTransforms.Internal_GetItem(i).Value; if (worldTransform == transform) { return i; } } return -1; } /// /// Remove all transforms that are not marked to keep. /// If fRemoveDrawings is true, remove the drawings as well /// internal void UpdateTransformAndDrawingLists(bool fRemoveDrawings) { TransformCollection worldTransforms = WorldTransforms; DrawingCollection drawings = Drawings; for (int i = WorldTransforms.Count - 1; i >= 0; i--) { if (!_transformsToKeep.Contains(i)) { worldTransforms.RemoveAt(i); if (fRemoveDrawings) { drawings.RemoveAt(i); } } } _transformsToKeep.Clear(); } ////// Clear both the Drawings and Transform lists /// internal void Clear(DUCE.Channel channel) { TransformCollection vWorldTransforms = WorldTransforms; DrawingCollection vDrawings = Drawings; for (int j = vWorldTransforms.Count - 1; j >= 0; j--) { vWorldTransforms.Internal_GetItem(j).ReleaseOnChannelCore(channel); vDrawings.Internal_GetItem(j).ReleaseOnChannelCore(channel); } vDrawings._collection.Clear(); vWorldTransforms._collection.Clear(); } #endregion Internal methods #region Internal properties internal bool ScheduleForUpdates { get { return _scheduleForUpdates; } set { _scheduleForUpdates = value; } } ////// Gets the window clip /// internal Rect WindowClip { get { return _windowClip; } set { _windowClip = value; } } internal bool IsOnChannel { get { return _duceResource.IsOnAnyChannel; } } #endregion Internal properties #region Private Fields List_transformsToKeep = new List (); bool _scheduleForUpdates = true; Rect _windowClip = Rect.Empty; #endregion } } // 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
- MetadataFile.cs
- ArrayElementGridEntry.cs
- ToolStripEditorManager.cs
- KoreanLunisolarCalendar.cs
- BufferedGraphics.cs
- safesecurityhelperavalon.cs
- SqlMethodTransformer.cs
- DiffuseMaterial.cs
- ResXResourceSet.cs
- PolygonHotSpot.cs
- securestring.cs
- GlobalAllocSafeHandle.cs
- ZipIOLocalFileHeader.cs
- KoreanLunisolarCalendar.cs
- X500Name.cs
- NullableLongSumAggregationOperator.cs
- PackagingUtilities.cs
- BamlResourceSerializer.cs
- ToolStripDropDown.cs
- ISO2022Encoding.cs
- SqlCacheDependency.cs
- WebBrowsableAttribute.cs
- CultureInfoConverter.cs
- TableLayoutCellPaintEventArgs.cs
- SoapException.cs
- WindowsProgressbar.cs
- PKCS1MaskGenerationMethod.cs
- PropertyRef.cs
- DesignTimeData.cs
- PriorityChain.cs
- Camera.cs
- SettingsPropertyValue.cs
- SoapClientMessage.cs
- NetNamedPipeSecurity.cs
- Single.cs
- StringCollectionEditor.cs
- CompilerTypeWithParams.cs
- FreezableDefaultValueFactory.cs
- DataTemplate.cs
- WSHttpBindingBaseElement.cs
- Transform.cs
- ComplusEndpointConfigContainer.cs
- HttpSocketManager.cs
- BinHexEncoder.cs
- ProtocolsConfigurationHandler.cs
- State.cs
- LateBoundBitmapDecoder.cs
- RecordsAffectedEventArgs.cs
- DesignerForm.cs
- ConfigXmlDocument.cs
- String.cs
- IISUnsafeMethods.cs
- UserControl.cs
- PermissionRequestEvidence.cs
- XmlSerializerNamespaces.cs
- WindowsEditBoxRange.cs
- QueryRelOp.cs
- RayHitTestParameters.cs
- ClosureBinding.cs
- CoTaskMemUnicodeSafeHandle.cs
- XmlIlGenerator.cs
- ExceptionUtil.cs
- DebugView.cs
- XmlRawWriter.cs
- ResourceReferenceExpression.cs
- SelectionWordBreaker.cs
- SingleResultAttribute.cs
- QilIterator.cs
- EventLogLink.cs
- columnmapkeybuilder.cs
- StylusPointProperty.cs
- AssertHelper.cs
- ButtonColumn.cs
- WizardForm.cs
- DataPointer.cs
- AuthorizationRule.cs
- MulticastNotSupportedException.cs
- DBProviderConfigurationHandler.cs
- DCSafeHandle.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- AuthenticationConfig.cs
- PopOutPanel.cs
- MetadataCache.cs
- AuthStoreRoleProvider.cs
- SynchronizationLockException.cs
- Sequence.cs
- SocketPermission.cs
- DataGridViewRowPostPaintEventArgs.cs
- NetWebProxyFinder.cs
- AsynchronousChannelMergeEnumerator.cs
- UTF32Encoding.cs
- XPathNodeInfoAtom.cs
- SmtpMail.cs
- DataBindingCollectionConverter.cs
- SqlVersion.cs
- MatrixAnimationBase.cs
- EntitySetBase.cs
- EventProvider.cs
- ObjectQueryExecutionPlan.cs
- XmlSortKeyAccumulator.cs