Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / Imaging / UnmanagedBitmapWrapper.cs / 1305600 / UnmanagedBitmapWrapper.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation. All Rights Reserved. // // File: UnmanagedBitmapWrapper.cs // //----------------------------------------------------------------------------- using System; using System.IO; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Reflection; using MS.Internal; using MS.Win32.PresentationCore; using System.Security; using System.Security.Permissions; using System.Diagnostics; using System.Windows.Media; using System.Globalization; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Media.Animation; using System.Windows.Media.Composition; using MS.Internal.PresentationCore; using SR = MS.Internal.PresentationCore.SR; using SRID = MS.Internal.PresentationCore.SRID; namespace System.Windows.Media.Imaging { internal sealed class UnmanagedBitmapWrapper : BitmapSource { ////// Critical - calls critical code method BitmapSource.UpdateCachedSettings /// TreatAsSafe - all inputs are checked /// [SecurityCritical, SecurityTreatAsSafe] public UnmanagedBitmapWrapper(BitmapSourceSafeMILHandle bitmapSource) : base(true) { _bitmapInit.BeginInit(); // // This constructor is used by BitmapDecoder and BitmapFrameDecode for thumbnails and // previews. The bitmapSource parameter comes from BitmapSource.CreateCachedBitmap // which already calculated memory pressure, so there's no need to do it here. // WicSourceHandle = bitmapSource; _bitmapInit.EndInit(); UpdateCachedSettings(); } #region Protected Methods ////// Critical - eventually access'es critical resources (_wicSource) /// TreatAsSafe - all inputs are checked /// [SecurityCritical, SecurityTreatAsSafe] internal UnmanagedBitmapWrapper(bool initialize) : base(true) { // Call BeginInit and EndInit if initialize is true. if (initialize) { _bitmapInit.BeginInit(); _bitmapInit.EndInit(); } } ////// Implementation of protected override Freezable CreateInstanceCore() { return new UnmanagedBitmapWrapper(false); } private void CopyCommon(UnmanagedBitmapWrapper sourceBitmap) { _bitmapInit.BeginInit(); _bitmapInit.EndInit(); } ///Freezable.CreateInstanceCore . ////// Implementation of protected override void CloneCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.CloneCore(sourceFreezable); CopyCommon(sourceBitmap); } ///Freezable.CloneCore . ////// Implementation of protected override void CloneCurrentValueCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.CloneCurrentValueCore(sourceFreezable); CopyCommon(sourceBitmap); } ///Freezable.CloneCurrentValueCore . ////// Implementation of protected override void GetAsFrozenCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.GetAsFrozenCore(sourceFreezable); CopyCommon(sourceBitmap); } ///Freezable.GetAsFrozenCore . ////// Implementation of protected override void GetCurrentValueAsFrozenCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.GetCurrentValueAsFrozenCore(sourceFreezable); CopyCommon(sourceBitmap); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.Freezable.GetCurrentValueAsFrozenCore . ///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ControlBuilderAttribute.cs
- ForAllOperator.cs
- AutoScrollExpandMessageFilter.cs
- ProfileSection.cs
- TreeViewCancelEvent.cs
- RelAssertionDirectKeyIdentifierClause.cs
- PropertyTab.cs
- ModuleBuilder.cs
- SectionUpdates.cs
- OutputCacheSettingsSection.cs
- DataMemberFieldConverter.cs
- AQNBuilder.cs
- UnknownBitmapDecoder.cs
- WebPartsPersonalization.cs
- BitFlagsGenerator.cs
- OleDbParameterCollection.cs
- TableLayoutPanelDesigner.cs
- DBSchemaTable.cs
- RequestCacheValidator.cs
- SynchronizationHandlesCodeDomSerializer.cs
- XmlNamespaceManager.cs
- TypedTableHandler.cs
- SqlServer2KCompatibilityCheck.cs
- CursorConverter.cs
- GeneratedContractType.cs
- BidirectionalDictionary.cs
- FolderBrowserDialog.cs
- NameValueSectionHandler.cs
- ErrorHandlerFaultInfo.cs
- DataGridItem.cs
- GroupItem.cs
- DataBindingHandlerAttribute.cs
- PropertyGridCommands.cs
- Thumb.cs
- FormCollection.cs
- UIAgentAsyncEndRequest.cs
- OpacityConverter.cs
- MethodExecutor.cs
- NonBatchDirectoryCompiler.cs
- NetCodeGroup.cs
- CodeNamespaceImportCollection.cs
- WhiteSpaceTrimStringConverter.cs
- QueryRewriter.cs
- Models.cs
- ProfileGroupSettings.cs
- LogSwitch.cs
- WebPartRestoreVerb.cs
- EntityDataSourceChangedEventArgs.cs
- RowCache.cs
- JpegBitmapEncoder.cs
- MemoryMappedView.cs
- XmlParserContext.cs
- MeshGeometry3D.cs
- odbcmetadatacolumnnames.cs
- SeekableReadStream.cs
- DesignObjectWrapper.cs
- XmlNode.cs
- DetailsViewInsertEventArgs.cs
- PreviewKeyDownEventArgs.cs
- ToRequest.cs
- DataGridRelationshipRow.cs
- MatrixKeyFrameCollection.cs
- ModelItemCollection.cs
- CompiledRegexRunnerFactory.cs
- HeaderedContentControl.cs
- XmlNodeWriter.cs
- RequestCache.cs
- MultitargetUtil.cs
- SecurityMode.cs
- EditingContext.cs
- HttpDebugHandler.cs
- WorkflowServiceHost.cs
- BinaryObjectInfo.cs
- InputManager.cs
- RenderTargetBitmap.cs
- SQLString.cs
- ScaleTransform.cs
- ToolStripKeyboardHandlingService.cs
- ConstructorNeedsTagAttribute.cs
- Converter.cs
- CommonObjectSecurity.cs
- XamlReader.cs
- StaticExtensionConverter.cs
- TranslateTransform3D.cs
- StringConverter.cs
- UdpTransportBindingElement.cs
- AndCondition.cs
- BinaryNegotiation.cs
- GenericTypeParameterBuilder.cs
- SBCSCodePageEncoding.cs
- XmlBuffer.cs
- CaseStatement.cs
- NavigatorOutput.cs
- Boolean.cs
- IISUnsafeMethods.cs
- ObjectReferenceStack.cs
- ContextMenu.cs
- ArrayMergeHelper.cs
- ApplicationServicesHostFactory.cs
- PublisherMembershipCondition.cs