Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media / DrawingBrush.cs / 1 / DrawingBrush.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: DrawingBrush.cs // // Description: This file contains the implementation of DrawingBrush. // The DrawingBrush is a TileBrush which defines its tile content // by use of a Drawing. // // History: // 2003/07/17 : [....] - Created it. // 2003/07/28 : [....] - Renamed it and hooked it up to the unmanaged code. // //--------------------------------------------------------------------------- using MS.Internal; using System; using System.ComponentModel; using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Composition; namespace System.Windows.Media { ////// DrawingBrush - This TileBrush defines its content as a Drawing /// public sealed partial class DrawingBrush : TileBrush { #region Constructors ////// Default constructor for DrawingBrush. The resulting Brush has no content. /// public DrawingBrush() { } ////// DrawingBrush Constructor where the image is set to the parameter's value /// /// The Drawing representing the contents of this Brush. public DrawingBrush(Drawing drawing) { Drawing = drawing; } #endregion Constructors ////// This node can introduce graphness /// internal override bool CanIntroduceGraphness() { return true; } ////// Obtains the current bounds of the brush's content /// /// Output bounds of content protected override void GetContentBounds(out Rect contentBounds) { contentBounds = Drawing.GetBounds(); } #region Realization Support ////// A drawing brush requires realizations if the drawing assigned to it requires realizations. /// Note that Precompute is best called only once per managed frame. /// internal override void Precompute() { // Drawing drawing = Drawing; if (drawing != null) { drawing.PrecomputeCore(); _requiresRealizationUpdates = drawing.RequiresRealizationUpdates; } else { _requiresRealizationUpdates = false; } } ////// Checks if realization updates are requried for this resource. /// Before querying this property Precompute must be called to validate the property /// value. /// internal override bool RequiresRealizationUpdates { get { return _requiresRealizationUpdates; } } ////// Updates realizations for all dependant resources that might require realization updates. /// internal override void UpdateRealizations(Rect fillShapeBounds, RealizationContext ctx) { if (_requiresRealizationUpdates) { Matrix m; Drawing drawing = Drawing; Debug.Assert(drawing != null); // RequiresRealizationUpdates sets the _requiresRealizationUpdates member to false if drawing == null. GetTileBrushMapping(fillShapeBounds, out m); ctx.TransformStack.Push(ref m, true); drawing.UpdateRealizations(ctx); ctx.TransformStack.Pop(); } } #endregion private bool _requiresRealizationUpdates; } } // 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
- HashCodeCombiner.cs
- PageContentCollection.cs
- MexHttpBindingElement.cs
- BrowserDefinition.cs
- ExtendedProtectionPolicyTypeConverter.cs
- DataGridViewCellParsingEventArgs.cs
- UnsafeNetInfoNativeMethods.cs
- SpecialFolderEnumConverter.cs
- CollectionChangedEventManager.cs
- DataGridRelationshipRow.cs
- DataTablePropertyDescriptor.cs
- ConcurrentDictionary.cs
- AuthenticatedStream.cs
- DataGridViewControlCollection.cs
- ReferenceSchema.cs
- TableItemPattern.cs
- LinearQuaternionKeyFrame.cs
- TypedElement.cs
- RtfNavigator.cs
- InitializerFacet.cs
- URLBuilder.cs
- XmlNavigatorFilter.cs
- InternalCache.cs
- TextLineBreak.cs
- FixedSOMPageElement.cs
- SQLByteStorage.cs
- TagPrefixAttribute.cs
- xmlsaver.cs
- SQLInt32Storage.cs
- WorkflowPrinting.cs
- PerfCounters.cs
- DataFormats.cs
- Vector3DKeyFrameCollection.cs
- KnowledgeBase.cs
- DataGridViewAccessibleObject.cs
- Visual3DCollection.cs
- StorageFunctionMapping.cs
- SchemaContext.cs
- DBParameter.cs
- DefaultCommandExtensionCallback.cs
- HtmlControl.cs
- ImmutablePropertyDescriptorGridEntry.cs
- ClientSettingsStore.cs
- XmlILIndex.cs
- MouseButtonEventArgs.cs
- PlaceHolder.cs
- CodeIdentifier.cs
- ConfigurationSectionCollection.cs
- PackageDigitalSignatureManager.cs
- ResourceManagerWrapper.cs
- XamlVector3DCollectionSerializer.cs
- ObjectViewFactory.cs
- XmlDesignerDataSourceView.cs
- EdmToObjectNamespaceMap.cs
- OciEnlistContext.cs
- CodeTypeDeclarationCollection.cs
- TrackingExtract.cs
- AnnotationObservableCollection.cs
- RawAppCommandInputReport.cs
- AuthenticationModulesSection.cs
- CompoundFileDeflateTransform.cs
- CodeCatchClauseCollection.cs
- TextEvent.cs
- parserscommon.cs
- IsolatedStorageException.cs
- CompiledQueryCacheKey.cs
- ProfileProvider.cs
- SqlDataReader.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- ReceiveReply.cs
- CommandTreeTypeHelper.cs
- OperationContractAttribute.cs
- SelectionItemPattern.cs
- EpmCustomContentDeSerializer.cs
- ListControlConvertEventArgs.cs
- WmlLinkAdapter.cs
- SpoolingTaskBase.cs
- localization.cs
- GridViewItemAutomationPeer.cs
- DetailsViewDeleteEventArgs.cs
- XmlAttributeCollection.cs
- RangeValuePattern.cs
- Interlocked.cs
- CompilationRelaxations.cs
- XmlWriter.cs
- WorkflowView.cs
- _PooledStream.cs
- OdbcTransaction.cs
- DataSourceProvider.cs
- GradientStop.cs
- PropertyTab.cs
- ClientCredentialsSecurityTokenManager.cs
- XmlNodeList.cs
- ButtonBaseAutomationPeer.cs
- DirectoryInfo.cs
- ZoneButton.cs
- XmlSchemaCollection.cs
- PlatformNotSupportedException.cs
- CodeParameterDeclarationExpression.cs
- AuthenticatedStream.cs