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
- DataComponentGenerator.cs
- TargetFrameworkAttribute.cs
- ClientSection.cs
- SerializerDescriptor.cs
- SqlFunctionAttribute.cs
- HtmlImage.cs
- NullableConverter.cs
- TrackingStringDictionary.cs
- ValueQuery.cs
- ApplicationServiceHelper.cs
- DbDataReader.cs
- formatstringdialog.cs
- EncoderReplacementFallback.cs
- Int32Converter.cs
- SafeHandles.cs
- DataGridViewDesigner.cs
- CompilationRelaxations.cs
- CompilerErrorCollection.cs
- TransactionsSectionGroup.cs
- WizardPanelChangingEventArgs.cs
- Site.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- FocusChangedEventArgs.cs
- ListViewItem.cs
- ClientConfigPaths.cs
- DisplayNameAttribute.cs
- EastAsianLunisolarCalendar.cs
- PrivilegedConfigurationManager.cs
- XamlGridLengthSerializer.cs
- DataQuery.cs
- TypefaceMap.cs
- HandlerBase.cs
- SnapshotChangeTrackingStrategy.cs
- WindowsListViewGroupSubsetLink.cs
- TemplateControl.cs
- EncoderParameters.cs
- IMembershipProvider.cs
- NotifyIcon.cs
- ellipse.cs
- LinkTarget.cs
- DefaultPrintController.cs
- Viewport3DVisual.cs
- TextSelection.cs
- RepeaterItemEventArgs.cs
- DataGridViewRowConverter.cs
- ClientOptions.cs
- HtmlTable.cs
- ValidationSummary.cs
- IISUnsafeMethods.cs
- ADMembershipUser.cs
- RepeaterCommandEventArgs.cs
- WindowsAltTab.cs
- CalloutQueueItem.cs
- TabControl.cs
- DiscreteKeyFrames.cs
- UserControlBuildProvider.cs
- AttachInfo.cs
- ProjectionPruner.cs
- RealProxy.cs
- InfoCardClaimCollection.cs
- ModelItemImpl.cs
- CultureData.cs
- ResourceAttributes.cs
- ProcessManager.cs
- RoutedCommand.cs
- _ConnectStream.cs
- objectquery_tresulttype.cs
- HttpDebugHandler.cs
- ObjectDataSourceMethodEditor.cs
- HttpChannelFactory.cs
- BaseCAMarshaler.cs
- ColumnBinding.cs
- base64Transforms.cs
- NamespaceInfo.cs
- ImportCatalogPart.cs
- ConnectorMovedEventArgs.cs
- SystemSounds.cs
- VScrollBar.cs
- ScriptControl.cs
- SymmetricAlgorithm.cs
- Column.cs
- LinkedResourceCollection.cs
- ContextProperty.cs
- RoleGroupCollection.cs
- AmbientValueAttribute.cs
- SqlBuilder.cs
- FocusTracker.cs
- Int32Collection.cs
- CustomTokenProvider.cs
- Int32CollectionConverter.cs
- ThicknessAnimationBase.cs
- PageEventArgs.cs
- SchemaImporterExtensionElement.cs
- XmlNamespaceMapping.cs
- TextPattern.cs
- ForeignKeyConstraint.cs
- ContextMenuStripGroup.cs
- Select.cs
- MailMessageEventArgs.cs
- SplitterPanel.cs