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
- ipaddressinformationcollection.cs
- ServiceNameElementCollection.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- XPathSelectionIterator.cs
- MD5CryptoServiceProvider.cs
- ThemeInfoAttribute.cs
- SoapIncludeAttribute.cs
- _Events.cs
- MemoryMappedView.cs
- CommentEmitter.cs
- SecurityHeaderLayout.cs
- CodeStatement.cs
- SynchronizedDisposablePool.cs
- ActiveXHost.cs
- FloaterParagraph.cs
- StreamReader.cs
- SystemIPInterfaceProperties.cs
- FacetValueContainer.cs
- CalendarDateChangedEventArgs.cs
- DataBindEngine.cs
- HGlobalSafeHandle.cs
- AdRotatorDesigner.cs
- Configuration.cs
- ItemCollection.cs
- DataGridPagerStyle.cs
- cookiecontainer.cs
- FilterableAttribute.cs
- _NativeSSPI.cs
- TransformerConfigurationWizardBase.cs
- CreateParams.cs
- Solver.cs
- DataSourceControl.cs
- LinkClickEvent.cs
- FamilyMap.cs
- ModifiableIteratorCollection.cs
- ParserStreamGeometryContext.cs
- SQlBooleanStorage.cs
- RectKeyFrameCollection.cs
- DataServiceRequestOfT.cs
- TimerElapsedEvenArgs.cs
- EasingFunctionBase.cs
- TraceListeners.cs
- LinqDataSource.cs
- M3DUtil.cs
- SafeLibraryHandle.cs
- URI.cs
- PlatformCulture.cs
- ResourceKey.cs
- TypeExtensionSerializer.cs
- StrokeFIndices.cs
- CompilerCollection.cs
- Rotation3DAnimation.cs
- CodeRegionDirective.cs
- MouseOverProperty.cs
- ManifestSignatureInformation.cs
- SqlCacheDependencySection.cs
- DataGridViewCheckBoxCell.cs
- CatalogZone.cs
- FormatVersion.cs
- ThreadStateException.cs
- PageBuildProvider.cs
- DateTimeFormatInfoScanner.cs
- ClientCultureInfo.cs
- MimeTypePropertyAttribute.cs
- FontFaceLayoutInfo.cs
- wmiprovider.cs
- ButtonPopupAdapter.cs
- ShaderRenderModeValidation.cs
- RuleValidation.cs
- DataSourceCache.cs
- IisTraceWebEventProvider.cs
- MarshalDirectiveException.cs
- NamespaceCollection.cs
- ConnectionManagementElementCollection.cs
- XmlSerializerSection.cs
- X500Name.cs
- InheritanceRules.cs
- HostingMessageProperty.cs
- DSASignatureFormatter.cs
- Point3DCollectionValueSerializer.cs
- ContractAdapter.cs
- AddInAttribute.cs
- PermissionListSet.cs
- UnmanagedMemoryStream.cs
- NumberSubstitution.cs
- NavigationProperty.cs
- UnknownExceptionActionHelper.cs
- TemplateAction.cs
- LockRenewalTask.cs
- ContactManager.cs
- SafeSystemMetrics.cs
- CssStyleCollection.cs
- HttpResponse.cs
- CheckBoxStandardAdapter.cs
- VariableQuery.cs
- connectionpool.cs
- SerializationAttributes.cs
- GacUtil.cs
- SoapCommonClasses.cs
- SaveWorkflowCommand.cs