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
- FileSystemWatcher.cs
- HexParser.cs
- ObjectDataSourceView.cs
- _BufferOffsetSize.cs
- QilStrConcatenator.cs
- SqlConnectionStringBuilder.cs
- EdmEntityTypeAttribute.cs
- TextTreeUndoUnit.cs
- Property.cs
- PnrpPermission.cs
- Compiler.cs
- TypeConverterValueSerializer.cs
- LocationChangedEventArgs.cs
- FontFamily.cs
- RelatedEnd.cs
- FixedSOMPageElement.cs
- CryptoKeySecurity.cs
- TextChange.cs
- Timeline.cs
- StringUtil.cs
- EdgeProfileValidation.cs
- BulletedListDesigner.cs
- ErrorBehavior.cs
- OleDbWrapper.cs
- MatrixCamera.cs
- TextControl.cs
- SchemaTypeEmitter.cs
- SchemaImporterExtensionElement.cs
- RepeatButton.cs
- SchemaConstraints.cs
- EdmFunctionAttribute.cs
- DataGridPagerStyle.cs
- PassportAuthenticationModule.cs
- CodeCommentStatement.cs
- ComponentTray.cs
- CircleEase.cs
- RTLAwareMessageBox.cs
- GlobalDataBindingHandler.cs
- SponsorHelper.cs
- TraceData.cs
- DataTableExtensions.cs
- XmlNotation.cs
- ScriptControl.cs
- ConstraintManager.cs
- RowsCopiedEventArgs.cs
- ClientConfigurationSystem.cs
- _NegotiateClient.cs
- ToggleButton.cs
- XmlSequenceWriter.cs
- AppendHelper.cs
- Executor.cs
- XmlSchemaObjectTable.cs
- FontInfo.cs
- PropertyPathConverter.cs
- XhtmlBasicValidationSummaryAdapter.cs
- RoleManagerModule.cs
- PeerNameResolver.cs
- IsolatedStorageFile.cs
- Internal.cs
- HttpModuleActionCollection.cs
- GuidConverter.cs
- AnimationClock.cs
- RayMeshGeometry3DHitTestResult.cs
- TypeLoadException.cs
- BrowserDefinitionCollection.cs
- x509store.cs
- DESCryptoServiceProvider.cs
- httpstaticobjectscollection.cs
- ResourceExpression.cs
- Table.cs
- PropertyInformationCollection.cs
- StringValueSerializer.cs
- EntityDataSourceValidationException.cs
- StateDesigner.CommentLayoutGlyph.cs
- DataContractJsonSerializerOperationFormatter.cs
- CheckedPointers.cs
- AssociationProvider.cs
- MetadataFile.cs
- PrtCap_Base.cs
- ExecutedRoutedEventArgs.cs
- DataSourceView.cs
- ReferencedAssembly.cs
- PermissionAttributes.cs
- ContextBase.cs
- ToolStripItemEventArgs.cs
- RepeaterItemEventArgs.cs
- WsatServiceCertificate.cs
- MenuItem.cs
- JpegBitmapEncoder.cs
- NonParentingControl.cs
- GridViewRowCollection.cs
- IndexedEnumerable.cs
- ComboBox.cs
- X509IssuerSerialKeyIdentifierClause.cs
- RootContext.cs
- RectKeyFrameCollection.cs
- GroupItemAutomationPeer.cs
- JoinTreeNode.cs
- GroupPartitionExpr.cs
- ListItemConverter.cs