Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media / DrawingImage.cs / 1 / DrawingImage.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: DrawingImage class // An ImageSource with a Drawing for content // // // History: // 05/26/2005 : [....] - Created it // //--------------------------------------------------------------------------- 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; using System.Windows.Media.Imaging; namespace System.Windows.Media { ////// The class definition for DrawingImage /// public sealed partial class DrawingImage : ImageSource { ////// Default DrawingImage ctor /// public DrawingImage() { } ////// DrawingImage ctor that takes a Drawing /// /// The content of the DrawingImage public DrawingImage(Drawing drawing) { Drawing = drawing; } ////// Width of the DrawingImage /// public override double Width { get { ReadPreamble(); return Size.Width; } } ////// Height of the DrawingImage /// public override double Height { get { ReadPreamble(); return Size.Height; } } ////// Get the Metadata of the DrawingImage /// public override ImageMetadata Metadata { get { ReadPreamble(); // DrawingImage does not have any metadata currently defined. return null; } } ////// Size for the DrawingImage /// internal override Size Size { get { Drawing drawing = Drawing; if (drawing != null) { Size size = drawing.GetBounds().Size; if (!size.IsEmpty) { return size; } else { return new Size(); } } else { return new Size(); } } } ////// Precompute is called during the frame preparation phase. Derived classes /// typically check if the brush requires realizations during this phase. /// internal override void Precompute() { Drawing drawing = Drawing; _requiresRealizationUpdates = false; if (drawing != null) { drawing.PrecomputeCore(); _requiresRealizationUpdates = drawing.RequiresRealizationUpdates; } } ////// Checks if realization updates are requried for this resource. /// internal override bool RequiresRealizationUpdates { get { return _requiresRealizationUpdates; } } ////// Derived classes must override this method and update realizations on dependent /// resources if required. /// internal override void UpdateRealizations(RealizationContext ctx) { if (_requiresRealizationUpdates) { Drawing drawing = Drawing; Debug.Assert(drawing != null); // Otherwise _requiresRealizationUpdates would be false. drawing.UpdateRealizations(ctx); } } ////// This node can introduce graphness /// internal override bool CanIntroduceGraphness() { return true; } 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
- EndpointBehaviorElementCollection.cs
- TaskFormBase.cs
- LinqToSqlWrapper.cs
- EntityDataSourceEntityTypeFilterItem.cs
- PointAnimation.cs
- RunWorkerCompletedEventArgs.cs
- BooleanToVisibilityConverter.cs
- TempEnvironment.cs
- UpdateTranslator.cs
- MediaEntryAttribute.cs
- QueryTaskGroupState.cs
- CompilerResults.cs
- NonSerializedAttribute.cs
- TextTreePropertyUndoUnit.cs
- RichTextBoxAutomationPeer.cs
- DesigntimeLicenseContext.cs
- ProtocolsConfiguration.cs
- BooleanAnimationBase.cs
- NotFiniteNumberException.cs
- SecureConversationVersion.cs
- FormDesigner.cs
- hwndwrapper.cs
- ProfileServiceManager.cs
- BindingSource.cs
- VectorKeyFrameCollection.cs
- UserPersonalizationStateInfo.cs
- TablePatternIdentifiers.cs
- DbConnectionPoolGroupProviderInfo.cs
- Int32Animation.cs
- XmlWriterTraceListener.cs
- RelationshipSet.cs
- PointAnimationUsingKeyFrames.cs
- JobStaple.cs
- PhysicalAddress.cs
- SelectedGridItemChangedEvent.cs
- DateTimeOffsetStorage.cs
- SubstitutionList.cs
- HashAlgorithm.cs
- Label.cs
- RectConverter.cs
- VScrollProperties.cs
- CodeNamespaceCollection.cs
- DefaultDiscoveryServiceExtension.cs
- PrivilegedConfigurationManager.cs
- GenericAuthenticationEventArgs.cs
- XmlDeclaration.cs
- PackageDigitalSignature.cs
- SafeWaitHandle.cs
- NativeCompoundFileAPIs.cs
- RuntimeWrappedException.cs
- Visual3DCollection.cs
- IOException.cs
- CommunicationException.cs
- WhiteSpaceTrimStringConverter.cs
- SchemaImporterExtension.cs
- DbModificationCommandTree.cs
- CatalogZoneBase.cs
- HttpListenerRequest.cs
- GridItemPatternIdentifiers.cs
- DrawingImage.cs
- ServicesSection.cs
- CompensationDesigner.cs
- RTLAwareMessageBox.cs
- FilterQuery.cs
- WhitespaceRuleReader.cs
- _TransmitFileOverlappedAsyncResult.cs
- CircleHotSpot.cs
- PrintPreviewControl.cs
- SudsCommon.cs
- ControlDesignerState.cs
- DiscoveryDocument.cs
- TypeSystem.cs
- ExpressionVisitor.cs
- _FtpControlStream.cs
- _BasicClient.cs
- OdbcConnectionOpen.cs
- SystemNetworkInterface.cs
- MemberAssignmentAnalysis.cs
- XPathChildIterator.cs
- WebPartTransformerCollection.cs
- KeyEventArgs.cs
- SafePEFileHandle.cs
- Bits.cs
- IPPacketInformation.cs
- HandlerBase.cs
- SafeEventLogWriteHandle.cs
- Itemizer.cs
- xmlglyphRunInfo.cs
- RoleManagerEventArgs.cs
- IOThreadScheduler.cs
- WorkflowServiceOperationListItem.cs
- SoundPlayerAction.cs
- CryptoStream.cs
- RtfControlWordInfo.cs
- MemoryResponseElement.cs
- DelegateArgumentValue.cs
- Vector3DConverter.cs
- PointLight.cs
- NavigationHelper.cs
- MissingSatelliteAssemblyException.cs