Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / Effects / BlurBitmapEffect.cs / 1407647 / BlurBitmapEffect.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2005 // // File: BlurBitmapEffect.cs //----------------------------------------------------------------------------- using MS.Internal; using System; using System.IO; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Diagnostics; using System.Reflection; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Media; using System.Windows.Markup; using System.Windows.Media.Animation; using System.Windows.Media.Composition; using MS.Internal.PresentationCore; using System.Security; namespace System.Windows.Media.Effects { ////// BlurBitmapEffectPrimitive /// public sealed partial class BlurBitmapEffect : BitmapEffect { ////// Constructor /// public BlurBitmapEffect() { } ////// Creates the unmanaged effect handle /// ////// Critical - returns a security critical type SafeHandle. /// Safe - Always returns null. /// [SecuritySafeCritical] [Obsolete(MS.Internal.Media.VisualTreeUtils.BitmapEffectObsoleteMessage)] unsafe protected override SafeHandle CreateUnmanagedEffect() { return null; } ////// Update (propagetes) properties to the unmanaged effect /// ////// This method demands permission because effects should not be run /// in partial trust. /// /// SecurityCritical - because SetValue has a link demand /// SecutiryTreatAsSafe - because it demans UIWindow permission /// [SecurityCritical, SecurityTreatAsSafe] [Obsolete(MS.Internal.Media.VisualTreeUtils.BitmapEffectObsoleteMessage)] protected override void UpdateUnmanagedPropertyState(SafeHandle unmanagedEffect) { SecurityHelper.DemandUIWindowPermission(); } ////// An ImageEffect can be used to emulate a BlurBitmapEffect with certain restrictions. This /// method returns true when it is possible to emulate the BlurBitmapEffect using an ImageEffect. /// internal override bool CanBeEmulatedUsingEffectPipeline() { return (Radius <= 100.0); } ////// Returns a Effect that emulates this BlurBitmapEffect. /// internal override Effect GetEmulatingEffect() { if (_imageEffectEmulation != null && _imageEffectEmulation.IsFrozen) { return _imageEffectEmulation; } if (_imageEffectEmulation == null) { _imageEffectEmulation = new BlurEffect(); } double radius = Radius; if (_imageEffectEmulation.Radius != radius) { _imageEffectEmulation.Radius = radius; } KernelType kernelType = KernelType; if (_imageEffectEmulation.KernelType != kernelType) { _imageEffectEmulation.KernelType = kernelType; } _imageEffectEmulation.RenderingBias = RenderingBias.Performance; if (this.IsFrozen) { _imageEffectEmulation.Freeze(); } return _imageEffectEmulation; } BlurEffect _imageEffectEmulation; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2005 // // File: BlurBitmapEffect.cs //----------------------------------------------------------------------------- using MS.Internal; using System; using System.IO; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Diagnostics; using System.Reflection; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Media; using System.Windows.Markup; using System.Windows.Media.Animation; using System.Windows.Media.Composition; using MS.Internal.PresentationCore; using System.Security; namespace System.Windows.Media.Effects { ////// BlurBitmapEffectPrimitive /// public sealed partial class BlurBitmapEffect : BitmapEffect { ////// Constructor /// public BlurBitmapEffect() { } ////// Creates the unmanaged effect handle /// ////// Critical - returns a security critical type SafeHandle. /// Safe - Always returns null. /// [SecuritySafeCritical] [Obsolete(MS.Internal.Media.VisualTreeUtils.BitmapEffectObsoleteMessage)] unsafe protected override SafeHandle CreateUnmanagedEffect() { return null; } ////// Update (propagetes) properties to the unmanaged effect /// ////// This method demands permission because effects should not be run /// in partial trust. /// /// SecurityCritical - because SetValue has a link demand /// SecutiryTreatAsSafe - because it demans UIWindow permission /// [SecurityCritical, SecurityTreatAsSafe] [Obsolete(MS.Internal.Media.VisualTreeUtils.BitmapEffectObsoleteMessage)] protected override void UpdateUnmanagedPropertyState(SafeHandle unmanagedEffect) { SecurityHelper.DemandUIWindowPermission(); } ////// An ImageEffect can be used to emulate a BlurBitmapEffect with certain restrictions. This /// method returns true when it is possible to emulate the BlurBitmapEffect using an ImageEffect. /// internal override bool CanBeEmulatedUsingEffectPipeline() { return (Radius <= 100.0); } ////// Returns a Effect that emulates this BlurBitmapEffect. /// internal override Effect GetEmulatingEffect() { if (_imageEffectEmulation != null && _imageEffectEmulation.IsFrozen) { return _imageEffectEmulation; } if (_imageEffectEmulation == null) { _imageEffectEmulation = new BlurEffect(); } double radius = Radius; if (_imageEffectEmulation.Radius != radius) { _imageEffectEmulation.Radius = radius; } KernelType kernelType = KernelType; if (_imageEffectEmulation.KernelType != kernelType) { _imageEffectEmulation.KernelType = kernelType; } _imageEffectEmulation.RenderingBias = RenderingBias.Performance; if (this.IsFrozen) { _imageEffectEmulation.Freeze(); } return _imageEffectEmulation; } BlurEffect _imageEffectEmulation; } } // 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
- ObjectPersistData.cs
- MsmqHostedTransportManager.cs
- WindowsTab.cs
- SqlReferenceCollection.cs
- ClientRoleProvider.cs
- Pair.cs
- ExpressionHelper.cs
- BaseWebProxyFinder.cs
- CompModSwitches.cs
- StyleHelper.cs
- HttpBrowserCapabilitiesWrapper.cs
- altserialization.cs
- PhysicalAddress.cs
- HashFinalRequest.cs
- ClientFormsIdentity.cs
- ToolStripSplitStackLayout.cs
- SHA512.cs
- IsolatedStorageFilePermission.cs
- SettingsProperty.cs
- ExtentJoinTreeNode.cs
- SplitContainerDesigner.cs
- NeutralResourcesLanguageAttribute.cs
- ServiceMetadataPublishingElement.cs
- MsmqDecodeHelper.cs
- TextParagraphCache.cs
- DesignerImageAdapter.cs
- ReachObjectContext.cs
- RecordsAffectedEventArgs.cs
- ObjectTag.cs
- TemplatedWizardStep.cs
- AttachInfo.cs
- SliderAutomationPeer.cs
- ImmutableClientRuntime.cs
- DataGridViewSelectedRowCollection.cs
- NextPreviousPagerField.cs
- PieceDirectory.cs
- GeneralTransform3DTo2D.cs
- XmlNamespaceManager.cs
- XmlBinaryReaderSession.cs
- RootBrowserWindowProxy.cs
- LayoutEngine.cs
- XmlSerializerNamespaces.cs
- WebCategoryAttribute.cs
- TaskFormBase.cs
- Profiler.cs
- ValueSerializer.cs
- SqlRowUpdatedEvent.cs
- CodeCatchClause.cs
- IDispatchConstantAttribute.cs
- InvalidPropValue.cs
- AdPostCacheSubstitution.cs
- TileModeValidation.cs
- IMembershipProvider.cs
- ConnectionStringsExpressionBuilder.cs
- InputBinder.cs
- DiscardableAttribute.cs
- DataGridPagerStyle.cs
- Decorator.cs
- CompatibleIComparer.cs
- TypeUsage.cs
- GridViewDeleteEventArgs.cs
- GregorianCalendarHelper.cs
- EdmType.cs
- ConfigurationValues.cs
- VirtualizedContainerService.cs
- DataSet.cs
- PublisherIdentityPermission.cs
- TemplateControl.cs
- _SafeNetHandles.cs
- SendMailErrorEventArgs.cs
- IApplicationTrustManager.cs
- PropertyGrid.cs
- NetworkCredential.cs
- TypeProvider.cs
- LookupBindingPropertiesAttribute.cs
- IsolatedStorageFileStream.cs
- SystemNetHelpers.cs
- EntityConnectionStringBuilder.cs
- NativeMsmqMessage.cs
- IPEndPointCollection.cs
- CurrentChangingEventArgs.cs
- CancellationToken.cs
- TypeListConverter.cs
- BufferedStream.cs
- XmlnsDictionary.cs
- cookiecollection.cs
- RequestBringIntoViewEventArgs.cs
- FSWPathEditor.cs
- UiaCoreApi.cs
- HtmlButton.cs
- TypefaceMap.cs
- GestureRecognitionResult.cs
- ServiceElementCollection.cs
- ComponentCollection.cs
- IssuedTokenServiceCredential.cs
- MarkupWriter.cs
- WebPartDescriptionCollection.cs
- QualifiedCellIdBoolean.cs
- IODescriptionAttribute.cs
- JsonEncodingStreamWrapper.cs