Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / Media / Drawing.cs / 1 / Drawing.cs
//---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // Description: Drawing is the base Drawing class that defines the standard // interface which Drawing's must implement. // // History: // 2003/07/16 : adsmith - Created it. // 2003/07/28 : adsmith - Renamed it and hooked it up to the unmanaged code. // 2004/11/17 : timothyc - Repurposed Drawing from being a Changeable // implementation that contains render data into the base // class for the enumerable & modifiable Drawing subclasses. // 2005/01/26 : timothyc - Made Drawing abstract & removed legacy Drawing // support, including .Open() & IAddChild. // //--------------------------------------------------------------------------- using MS.Internal; using System; using System.Collections; using System.ComponentModel; using System.Diagnostics; using System.Resources; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Composition; using System.Windows.Markup; using System.Windows.Threading; namespace System.Windows.Media { ////// Base class for the enumerable and modifiable Drawing subclasses. /// [Localizability(LocalizationCategory.None, Readability = Readability.Unreadable)] public abstract partial class Drawing : Animatable, IDrawingContent, DUCE.IResource { #region Constructors ////// Constructor for Drawing /// ////// This constructor is internal to prevent external subclassing. /// internal Drawing() { } #endregion Constructors #region Public Properties ////// Bounds - the axis-aligned bounds of this Drawing. /// ////// Rect - the axis-aligned bounds of this Drawing. /// public Rect Bounds { get { ReadPreamble(); return GetBounds(); } } #endregion Public Properties #region Internal Methods ////// This node can introduce graphness /// internal override bool CanIntroduceGraphness() { return true; } ////// Called when an object needs to Update it's realizations. /// Currently, GlyphRun is the only MIL object that needs realization /// updates. /// internal abstract void UpdateRealizations(RealizationContext realizationContext); ////// Calls methods on the DrawingContext that are equivalent to the /// Drawing with the Drawing's current value. /// internal abstract void WalkCurrentValue(DrawingContextWalker ctx); #endregion Internal Methods #region IDrawingContent implementation void IDrawingContent.PrecomputeContent() { PrecomputeCore(); } bool IDrawingContent.ContentRequiresRealizationUpdates { get { return this.RequiresRealizationUpdates; } } ////// True if this content can introduce graphness /// bool IDrawingContent.ContentIntroducesGraphness { get { return CanIntroduceGraphness(); } } #endregion IDrawingContent implementation ////// Precompute updates cached data on the Drawings. Currently it is only caching the /// realization flag. /// internal override void Precompute() { PrecomputeCore(); } ////// Derived classes implement the caching of the RequiresRealizationUpdates flag /// in this method. /// ////// internal abstract void PrecomputeCore(); /// /// True if and only if the Drawing requires realization updates. /// internal override bool RequiresRealizationUpdates { get { return m_requiresRealizationUpdates; } set { m_requiresRealizationUpdates = value; } } ////// Returns the bounding box occupied by the content /// ////// Bounding box occupied by the content /// Rect IDrawingContent.GetContentBounds(BoundsDrawingContextWalker ctx) { Debug.Assert(ctx != null); WalkCurrentValue(ctx); return ctx.Bounds; } ////// Forward the current value of the content to the DrawingContextWalker /// methods. /// /// DrawingContextWalker to forward content to. void IDrawingContent.WalkContent(DrawingContextWalker ctx) { ((Drawing)this).WalkCurrentValue(ctx); } ////// Determines whether or not a point exists within the content /// /// Point to hit-test for. ////// 'true' if the point exists within the content, 'false' otherwise /// bool IDrawingContent.HitTestPoint(Point point) { return DrawingServices.HitTestPoint(this, point); } ////// Hit-tests a geometry against this content /// /// PathGeometry to hit-test for. ////// IntersectionDetail describing the result of the hit-test /// IntersectionDetail IDrawingContent.HitTestGeometry(PathGeometry geometry) { return DrawingServices.HitTestGeometry(this, geometry); } ////// Propagates an event handler to Freezables referenced by /// the content. /// /// Event handler to propagate /// 'true' to add the handler, 'false' to remove it void IDrawingContent.PropagateChangedHandler(EventHandler handler, bool adding) { if (!IsFrozen) { if (adding) { ((Drawing)this).Changed += handler; } else { ((Drawing)this).Changed -= handler; } } } ////// Calls UpdatesRealization on GlyphRun's referenced by the content /// /// Context to create realization updates for void IDrawingContent.UpdateRealizations(RealizationContext realizationContext) { ((Drawing)this).UpdateRealizations(realizationContext); } ////// GetBounds to calculate the bounds of this drawing. /// internal Rect GetBounds() { BoundsDrawingContextWalker ctx = new BoundsDrawingContextWalker(); WalkCurrentValue(ctx); return ctx.Bounds; } // private bool m_requiresRealizationUpdates; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // Description: Drawing is the base Drawing class that defines the standard // interface which Drawing's must implement. // // History: // 2003/07/16 : adsmith - Created it. // 2003/07/28 : adsmith - Renamed it and hooked it up to the unmanaged code. // 2004/11/17 : timothyc - Repurposed Drawing from being a Changeable // implementation that contains render data into the base // class for the enumerable & modifiable Drawing subclasses. // 2005/01/26 : timothyc - Made Drawing abstract & removed legacy Drawing // support, including .Open() & IAddChild. // //--------------------------------------------------------------------------- using MS.Internal; using System; using System.Collections; using System.ComponentModel; using System.Diagnostics; using System.Resources; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Composition; using System.Windows.Markup; using System.Windows.Threading; namespace System.Windows.Media { ////// Base class for the enumerable and modifiable Drawing subclasses. /// [Localizability(LocalizationCategory.None, Readability = Readability.Unreadable)] public abstract partial class Drawing : Animatable, IDrawingContent, DUCE.IResource { #region Constructors ////// Constructor for Drawing /// ////// This constructor is internal to prevent external subclassing. /// internal Drawing() { } #endregion Constructors #region Public Properties ////// Bounds - the axis-aligned bounds of this Drawing. /// ////// Rect - the axis-aligned bounds of this Drawing. /// public Rect Bounds { get { ReadPreamble(); return GetBounds(); } } #endregion Public Properties #region Internal Methods ////// This node can introduce graphness /// internal override bool CanIntroduceGraphness() { return true; } ////// Called when an object needs to Update it's realizations. /// Currently, GlyphRun is the only MIL object that needs realization /// updates. /// internal abstract void UpdateRealizations(RealizationContext realizationContext); ////// Calls methods on the DrawingContext that are equivalent to the /// Drawing with the Drawing's current value. /// internal abstract void WalkCurrentValue(DrawingContextWalker ctx); #endregion Internal Methods #region IDrawingContent implementation void IDrawingContent.PrecomputeContent() { PrecomputeCore(); } bool IDrawingContent.ContentRequiresRealizationUpdates { get { return this.RequiresRealizationUpdates; } } ////// True if this content can introduce graphness /// bool IDrawingContent.ContentIntroducesGraphness { get { return CanIntroduceGraphness(); } } #endregion IDrawingContent implementation ////// Precompute updates cached data on the Drawings. Currently it is only caching the /// realization flag. /// internal override void Precompute() { PrecomputeCore(); } ////// Derived classes implement the caching of the RequiresRealizationUpdates flag /// in this method. /// ////// internal abstract void PrecomputeCore(); /// /// True if and only if the Drawing requires realization updates. /// internal override bool RequiresRealizationUpdates { get { return m_requiresRealizationUpdates; } set { m_requiresRealizationUpdates = value; } } ////// Returns the bounding box occupied by the content /// ////// Bounding box occupied by the content /// Rect IDrawingContent.GetContentBounds(BoundsDrawingContextWalker ctx) { Debug.Assert(ctx != null); WalkCurrentValue(ctx); return ctx.Bounds; } ////// Forward the current value of the content to the DrawingContextWalker /// methods. /// /// DrawingContextWalker to forward content to. void IDrawingContent.WalkContent(DrawingContextWalker ctx) { ((Drawing)this).WalkCurrentValue(ctx); } ////// Determines whether or not a point exists within the content /// /// Point to hit-test for. ////// 'true' if the point exists within the content, 'false' otherwise /// bool IDrawingContent.HitTestPoint(Point point) { return DrawingServices.HitTestPoint(this, point); } ////// Hit-tests a geometry against this content /// /// PathGeometry to hit-test for. ////// IntersectionDetail describing the result of the hit-test /// IntersectionDetail IDrawingContent.HitTestGeometry(PathGeometry geometry) { return DrawingServices.HitTestGeometry(this, geometry); } ////// Propagates an event handler to Freezables referenced by /// the content. /// /// Event handler to propagate /// 'true' to add the handler, 'false' to remove it void IDrawingContent.PropagateChangedHandler(EventHandler handler, bool adding) { if (!IsFrozen) { if (adding) { ((Drawing)this).Changed += handler; } else { ((Drawing)this).Changed -= handler; } } } ////// Calls UpdatesRealization on GlyphRun's referenced by the content /// /// Context to create realization updates for void IDrawingContent.UpdateRealizations(RealizationContext realizationContext) { ((Drawing)this).UpdateRealizations(realizationContext); } ////// GetBounds to calculate the bounds of this drawing. /// internal Rect GetBounds() { BoundsDrawingContextWalker ctx = new BoundsDrawingContextWalker(); WalkCurrentValue(ctx); return ctx.Bounds; } // private bool m_requiresRealizationUpdates; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ClientSettingsProvider.cs
- DateTimeFormatInfoScanner.cs
- StdRegProviderWrapper.cs
- FunctionMappingTranslator.cs
- HitTestResult.cs
- LifetimeServices.cs
- Selection.cs
- CollectionDataContractAttribute.cs
- CopyAttributesAction.cs
- SyntaxCheck.cs
- DataGridViewButtonColumn.cs
- WebPartVerb.cs
- ResourceReferenceExpression.cs
- ExtensionSimplifierMarkupObject.cs
- UIAgentInitializationException.cs
- ListSourceHelper.cs
- RSAOAEPKeyExchangeDeformatter.cs
- CLRBindingWorker.cs
- RpcAsyncResult.cs
- ViewEvent.cs
- Evidence.cs
- AudioSignalProblemOccurredEventArgs.cs
- DataGridViewLinkColumn.cs
- SynthesizerStateChangedEventArgs.cs
- IItemContainerGenerator.cs
- ChannelPool.cs
- DetailsViewInsertEventArgs.cs
- ThreadPool.cs
- NameScope.cs
- AssociationSetEnd.cs
- ProxyGenerationError.cs
- TableNameAttribute.cs
- SqlResolver.cs
- NativeWindow.cs
- ContainerFilterService.cs
- FixUp.cs
- EditingScopeUndoUnit.cs
- SQlBooleanStorage.cs
- ContextMenuService.cs
- TableLayoutPanelCodeDomSerializer.cs
- GetWorkflowTree.cs
- SoapAttributeOverrides.cs
- EntityDataSourceContextCreatedEventArgs.cs
- DataGridViewTextBoxCell.cs
- AncillaryOps.cs
- OracleRowUpdatedEventArgs.cs
- XmlDataSource.cs
- ToolStripDropDownButton.cs
- GeometryConverter.cs
- FileDialog.cs
- NotConverter.cs
- CachingHintValidation.cs
- InstanceHandleConflictException.cs
- XsltInput.cs
- DataServiceRequestOfT.cs
- DuplicateWaitObjectException.cs
- TaskFormBase.cs
- SizeAnimationBase.cs
- ClaimTypeElement.cs
- XmlCompatibilityReader.cs
- RSAOAEPKeyExchangeDeformatter.cs
- PeerUnsafeNativeCryptMethods.cs
- ScrollViewer.cs
- IxmlLineInfo.cs
- DateTimeConstantAttribute.cs
- GridEntry.cs
- PermissionRequestEvidence.cs
- StringStorage.cs
- XmlnsDefinitionAttribute.cs
- SeekStoryboard.cs
- DataGridViewBindingCompleteEventArgs.cs
- RoutedEventConverter.cs
- CodeGen.cs
- ExtensionWindow.cs
- UserPreferenceChangingEventArgs.cs
- GridViewDeleteEventArgs.cs
- HttpCacheParams.cs
- versioninfo.cs
- WebDisplayNameAttribute.cs
- FontWeights.cs
- InvokeHandlers.cs
- TraversalRequest.cs
- Size3DValueSerializer.cs
- NamedPipeTransportBindingElement.cs
- PointHitTestParameters.cs
- TextDpi.cs
- DataServiceConfiguration.cs
- PropertyConverter.cs
- OleDbParameter.cs
- CaseInsensitiveOrdinalStringComparer.cs
- WebPartCatalogAddVerb.cs
- NotFiniteNumberException.cs
- BigInt.cs
- EmptyWithCancelationCheckWorkItem.cs
- BinaryFormatterWriter.cs
- BamlBinaryReader.cs
- AssemblyBuilderData.cs
- SendMailErrorEventArgs.cs
- FontFamilyValueSerializer.cs
- EventSchemaTraceListener.cs