Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media / GlyphRunDrawing.cs / 1 / GlyphRunDrawing.cs
//---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // Description: GlyphRunDrawing represents a drawing operation that renders // a GlyphRun. // // History: // // 2004/11/17 : [....] - Created it. // //--------------------------------------------------------------------------- using System.Diagnostics; namespace System.Windows.Media { ////// GlyphRunDrawing represents a drawing operation that renders a GlyphRun. /// public sealed partial class GlyphRunDrawing : Drawing { #region Constructors ////// Default GlyphRunDrawing constructor. /// Constructs an object with all properties set to their default values /// public GlyphRunDrawing() { } ////// Two-argument GlyphRunDrawing constructor. /// Constructs an object with the GlyphRun and ForegroundBrush properties /// set to the value of their respective arguments. /// public GlyphRunDrawing(Brush foregroundBrush, GlyphRun glyphRun) { GlyphRun = glyphRun; ForegroundBrush = foregroundBrush; } #endregion #region Internal methods ////// Called when an object needs to Update it's realizations. /// Currently, GlyphRun is the only MIL object that needs realization /// updates. /// internal override void UpdateRealizations(RealizationContext realizationContext) { if (RequiresRealizationUpdates) { GlyphRun glyphRun = GlyphRun; Brush foregroundBrush = ForegroundBrush; Debug.Assert(glyphRun != null, "Because the RequriesRealizationUpdates flag is only set if GlyphRun != null."); Debug.Assert(foregroundBrush!= null, "Because the RequiresRealizationUpdates flag is only set if ForegroundBrush != null."); Rect bounds = glyphRun.ComputeInkBoundingBox(); if (!bounds.IsEmpty) { Point baselineOrigin = glyphRun.BaselineOrigin; bounds.X += baselineOrigin.X; bounds.Y += baselineOrigin.Y; foregroundBrush.UpdateRealizations(bounds, realizationContext); } glyphRun.MarkVisibleRealization(realizationContext); } } ////// Calls methods on the DrawingContext that are equivalent to the /// Drawing with the Drawing's current value. /// internal override void WalkCurrentValue(DrawingContextWalker ctx) { // We avoid unneccessary ShouldStopWalking checks based on assumptions // about when ShouldStopWalking is set. Guard that assumption with an // assertion. See DrawingGroup.WalkCurrentValue comment for more details. Debug.Assert(!ctx.ShouldStopWalking); ctx.DrawGlyphRun( ForegroundBrush, GlyphRun ); } ////// PrecomputeCore for GlyphRuns. /// internal override void PrecomputeCore() { // Reset the flag. RequiresRealizationUpdates = false; // Check if we need to push realization updates into the foreground brush. if (GlyphRun != null) { Brush foregroundBrush = ForegroundBrush; if (foregroundBrush != null) { foregroundBrush.Precompute(); // We require realization no matter what because this is a glyph run // drawing. RequiresRealizationUpdates = true; } } } #endregion Internal methods } } // 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
- ExpressionLexer.cs
- HelpProvider.cs
- GZipUtils.cs
- FacetValues.cs
- DataGridRelationshipRow.cs
- TemplateBindingExtension.cs
- TypeGeneratedEventArgs.cs
- WorkflowInstance.cs
- EntityTypeBase.cs
- DataRelation.cs
- _HTTPDateParse.cs
- NamespaceQuery.cs
- SByte.cs
- MessageBox.cs
- BaseInfoTable.cs
- AuthenticationManager.cs
- MethodCallTranslator.cs
- coordinatorfactory.cs
- View.cs
- SyncOperationState.cs
- TailPinnedEventArgs.cs
- TdsParserStaticMethods.cs
- StringFreezingAttribute.cs
- DocumentViewer.cs
- QueryAccessibilityHelpEvent.cs
- RegionInfo.cs
- HtmlHead.cs
- FileCodeGroup.cs
- FileIOPermission.cs
- MimeBasePart.cs
- AndCondition.cs
- RSAPKCS1KeyExchangeFormatter.cs
- TextServicesCompartmentContext.cs
- FontInfo.cs
- TextServicesCompartmentEventSink.cs
- EventTrigger.cs
- IgnoreDeviceFilterElementCollection.cs
- RouteValueDictionary.cs
- TitleStyle.cs
- WebPartZone.cs
- InputManager.cs
- BaseCodeDomTreeGenerator.cs
- XmlArrayAttribute.cs
- DiscoveryClientDocuments.cs
- WebPartsPersonalizationAuthorization.cs
- ProxySimple.cs
- CompiledRegexRunner.cs
- KnownAssembliesSet.cs
- ManagementPath.cs
- HtmlEncodedRawTextWriter.cs
- DBConnectionString.cs
- ADRoleFactoryConfiguration.cs
- ContainerTracking.cs
- SqlSupersetValidator.cs
- AssemblyNameEqualityComparer.cs
- DesignerLabelAdapter.cs
- ColumnResult.cs
- Condition.cs
- ResXResourceReader.cs
- Coordinator.cs
- EventHandlersDesigner.cs
- PolygonHotSpot.cs
- Pen.cs
- ExecutionContext.cs
- ArraySegment.cs
- EncoderReplacementFallback.cs
- DesignerRegionMouseEventArgs.cs
- MatrixAnimationBase.cs
- _TLSstream.cs
- XmlReaderDelegator.cs
- ContainerControlDesigner.cs
- UxThemeWrapper.cs
- TransformerConfigurationWizardBase.cs
- PropVariant.cs
- WindowsTooltip.cs
- RegexWorker.cs
- QuaternionAnimation.cs
- ExtendedPropertyCollection.cs
- CharacterMetrics.cs
- RecommendedAsConfigurableAttribute.cs
- DataGridViewComboBoxCell.cs
- SingleAnimation.cs
- EntitySetBaseCollection.cs
- SchemaElementLookUpTable.cs
- DataContractSerializerElement.cs
- LinkArea.cs
- NetPeerTcpBinding.cs
- Roles.cs
- DataSet.cs
- WebRequestModuleElementCollection.cs
- GenerateHelper.cs
- Pens.cs
- SecurityContextSecurityTokenParameters.cs
- _NegoState.cs
- RegexParser.cs
- ListCollectionView.cs
- CodeArrayIndexerExpression.cs
- SapiInterop.cs
- PageVisual.cs
- InternalBase.cs