Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media / Effects / BitmapEffectDrawing.cs / 2 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StylusOverProperty.cs
- CollectionViewProxy.cs
- HtmlContainerControl.cs
- CodeAttributeDeclarationCollection.cs
- Expression.DebuggerProxy.cs
- XmlUrlResolver.cs
- UnknownBitmapEncoder.cs
- IChannel.cs
- HttpModuleActionCollection.cs
- ClientSideQueueItem.cs
- LocalBuilder.cs
- OleDbConnectionInternal.cs
- ImageKeyConverter.cs
- ModelPropertyImpl.cs
- BindingNavigator.cs
- InteropExecutor.cs
- PluralizationService.cs
- SafeNativeMethodsOther.cs
- AutoCompleteStringCollection.cs
- InputScope.cs
- InfiniteIntConverter.cs
- Processor.cs
- ScriptingJsonSerializationSection.cs
- RoleGroupCollection.cs
- SmiConnection.cs
- ApplicationTrust.cs
- AnnotationComponentChooser.cs
- StringResourceManager.cs
- ListViewDeletedEventArgs.cs
- CounterSampleCalculator.cs
- CompositeControl.cs
- NumericUpDownAcceleration.cs
- RangeValidator.cs
- DbDataRecord.cs
- TransformProviderWrapper.cs
- DataGridViewCellValidatingEventArgs.cs
- BlockUIContainer.cs
- WindowsListViewGroup.cs
- Timeline.cs
- MiniParameterInfo.cs
- DataGridPagerStyle.cs
- SessionState.cs
- HashHelper.cs
- PermissionRequestEvidence.cs
- RSAPKCS1KeyExchangeFormatter.cs
- RuntimeHelpers.cs
- ToolStripAdornerWindowService.cs
- ExternalDataExchangeService.cs
- XmlNodeChangedEventManager.cs
- CurrentTimeZone.cs
- HttpCapabilitiesSectionHandler.cs
- ServiceDescription.cs
- GenericPrincipal.cs
- RoleManagerSection.cs
- ServiceNameElement.cs
- NamespaceInfo.cs
- SharedRuntimeState.cs
- HotSpotCollection.cs
- ButtonFieldBase.cs
- ErrorWrapper.cs
- CheckoutException.cs
- RecipientServiceModelSecurityTokenRequirement.cs
- SqlCacheDependencySection.cs
- ComponentDispatcher.cs
- BuildProvidersCompiler.cs
- SHA512Cng.cs
- HttpListenerTimeoutManager.cs
- PeerApplicationLaunchInfo.cs
- NativeObjectSecurity.cs
- PrintDocument.cs
- LogReservationCollection.cs
- DataList.cs
- IssuanceTokenProviderBase.cs
- Bidi.cs
- OutputScopeManager.cs
- SqlExpander.cs
- CodeIdentifier.cs
- UInt16Converter.cs
- ActivationServices.cs
- GenerateScriptTypeAttribute.cs
- TransformerInfoCollection.cs
- CatalogZone.cs
- SQLByteStorage.cs
- SqlException.cs
- PointAnimationClockResource.cs
- InternalSafeNativeMethods.cs
- GAC.cs
- CustomWebEventKey.cs
- QueryGenerator.cs
- CounterSetInstanceCounterDataSet.cs
- Brushes.cs
- ControllableStoryboardAction.cs
- DesignerForm.cs
- TypedDataSetSchemaImporterExtensionFx35.cs
- ReceiveCompletedEventArgs.cs
- PropertyNames.cs
- WmlCommandAdapter.cs
- CustomServiceCredentials.cs
- BackStopAuthenticationModule.cs
- ExpressionPrefixAttribute.cs