Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / 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 : adsmith - Created it. // 2003/07/28 : adsmith - 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. //---------------------------------------------------------------------------- // // 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 : adsmith - Created it. // 2003/07/28 : adsmith - 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
- SiblingIterators.cs
- storepermission.cs
- AnimationClock.cs
- DataExpression.cs
- TextBoxAutoCompleteSourceConverter.cs
- TwoPhaseCommitProxy.cs
- OutputWindow.cs
- ActiveXHelper.cs
- ControlEvent.cs
- TypeForwardedFromAttribute.cs
- InkCanvasAutomationPeer.cs
- SqlDataSourceSelectingEventArgs.cs
- PropertyItem.cs
- ContextStack.cs
- XmlAtomErrorReader.cs
- UpdateCompiler.cs
- HandlerBase.cs
- X500Name.cs
- ReadWriteSpinLock.cs
- LogReservationCollection.cs
- ProjectionCamera.cs
- RSAPKCS1KeyExchangeFormatter.cs
- CopyOnWriteList.cs
- RegisteredArrayDeclaration.cs
- WindowsFormsEditorServiceHelper.cs
- GenericWebPart.cs
- OverrideMode.cs
- ContainerUIElement3D.cs
- Mutex.cs
- ColumnHeaderCollectionEditor.cs
- ColumnProvider.cs
- ToolStripOverflow.cs
- VirtualPath.cs
- MulticastOption.cs
- SafeNativeMethodsCLR.cs
- CodeIterationStatement.cs
- GlyphRun.cs
- DataGridCheckBoxColumn.cs
- RepeaterItemEventArgs.cs
- RequestQueue.cs
- GridViewColumn.cs
- BitmapEffectrendercontext.cs
- ExpressionPrinter.cs
- UIElement.cs
- FormViewDeletedEventArgs.cs
- Bold.cs
- BmpBitmapDecoder.cs
- ArglessEventHandlerProxy.cs
- XmlReflectionImporter.cs
- TraceLog.cs
- Configuration.cs
- RelationshipConverter.cs
- EmptyStringExpandableObjectConverter.cs
- EventItfInfo.cs
- SystemBrushes.cs
- RubberbandSelector.cs
- TimeoutConverter.cs
- TimeSpanValidator.cs
- PrivilegeNotHeldException.cs
- WindowsAltTab.cs
- IdentitySection.cs
- MemoryStream.cs
- MimeXmlReflector.cs
- BooleanSwitch.cs
- CustomError.cs
- StateElementCollection.cs
- DelegatingChannelListener.cs
- Error.cs
- ParallelTimeline.cs
- ButtonColumn.cs
- PageBreakRecord.cs
- UdpConstants.cs
- TextServicesHost.cs
- AssemblyHash.cs
- TextParentUndoUnit.cs
- XmlNodeReader.cs
- WebPartsSection.cs
- behaviorssection.cs
- NumericUpDownAcceleration.cs
- TemplateBindingExpressionConverter.cs
- BatchWriter.cs
- SmiEventSink_Default.cs
- TogglePatternIdentifiers.cs
- InternalConfigEventArgs.cs
- RegisteredDisposeScript.cs
- ExtractCollection.cs
- TimelineClockCollection.cs
- EmptyQuery.cs
- OpenTypeLayout.cs
- FileLogRecord.cs
- CompositeFontInfo.cs
- PluralizationService.cs
- CompressionTransform.cs
- BinaryParser.cs
- CompilationSection.cs
- DocumentReference.cs
- PointCollection.cs
- DataGridViewLinkColumn.cs
- RoleManagerModule.cs
- ComponentEditorForm.cs