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
- X509Certificate2.cs
- XamlFilter.cs
- MenuAdapter.cs
- BindStream.cs
- FontResourceCache.cs
- Control.cs
- MemberNameValidator.cs
- ThaiBuddhistCalendar.cs
- NameValuePermission.cs
- BitSet.cs
- WithParamAction.cs
- SyndicationElementExtension.cs
- DbCommandTree.cs
- QilTypeChecker.cs
- ConfigXmlComment.cs
- ToolStripPanelDesigner.cs
- OracleRowUpdatedEventArgs.cs
- AssociationProvider.cs
- Socket.cs
- SqlAggregateChecker.cs
- ToolBarPanel.cs
- ListDictionaryInternal.cs
- Wildcard.cs
- WindowsTokenRoleProvider.cs
- EarlyBoundInfo.cs
- UserControl.cs
- FormViewCommandEventArgs.cs
- WindowsSysHeader.cs
- LingerOption.cs
- SymmetricKeyWrap.cs
- Nodes.cs
- UniqueConstraint.cs
- MenuItemStyleCollection.cs
- UserThread.cs
- BookmarkWorkItem.cs
- XmlEntity.cs
- CodeCatchClauseCollection.cs
- HandlerWithFactory.cs
- DescendantBaseQuery.cs
- MouseEventArgs.cs
- AnnotationAuthorChangedEventArgs.cs
- _LoggingObject.cs
- NativeBuffer.cs
- ConnectionPoint.cs
- SuppressMergeCheckAttribute.cs
- XmlSchemaResource.cs
- MultiSelector.cs
- WindowsAuthenticationModule.cs
- StringValidatorAttribute.cs
- QuaternionIndependentAnimationStorage.cs
- ObjectDataProvider.cs
- BindingValueChangedEventArgs.cs
- DescendantOverDescendantQuery.cs
- DataColumnMapping.cs
- DocumentApplicationJournalEntry.cs
- ConvertEvent.cs
- TimelineGroup.cs
- SourceInterpreter.cs
- ActiveDocumentEvent.cs
- MemberAssignment.cs
- Cloud.cs
- DocumentXmlWriter.cs
- NativeObjectSecurity.cs
- UIPermission.cs
- X509ChainPolicy.cs
- CommandHelper.cs
- IdentityValidationException.cs
- MasterPageParser.cs
- _CacheStreams.cs
- EntityViewGenerationConstants.cs
- MouseEventArgs.cs
- ToolStripItemImageRenderEventArgs.cs
- AnnotationDocumentPaginator.cs
- ServiceOperation.cs
- EditorZoneBase.cs
- FileEnumerator.cs
- ManagementQuery.cs
- IISMapPath.cs
- MarkupExtensionReturnTypeAttribute.cs
- BulletedListEventArgs.cs
- FormsAuthenticationUser.cs
- FontUnit.cs
- InkCanvasInnerCanvas.cs
- PanelStyle.cs
- Unit.cs
- SuppressMessageAttribute.cs
- XmlElementAttribute.cs
- SecurityTokenException.cs
- AudioSignalProblemOccurredEventArgs.cs
- FunctionNode.cs
- CommentAction.cs
- WebPartZone.cs
- SQLInt16.cs
- UnmanagedMemoryAccessor.cs
- SequentialOutput.cs
- SQLMembershipProvider.cs
- KeyboardEventArgs.cs
- CommandID.cs
- Stack.cs
- TempFiles.cs