Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / System / Windows / Media / Effects / BitmapEffectrendercontext.cs / 1 / BitmapEffectrendercontext.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2005 // // File: BitmapEffectRenderContext.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 System.Security; using MS.Internal.PresentationCore; namespace System.Windows.Media.Effects { ////// BitmapEffectRenderContext /// internal class BitmapEffectRenderContext { SafeMILHandle /*IMILBitmapEffectRenderContext*/ context; ////// BitmapEffectRenderContext /// public BitmapEffectRenderContext() { Create(); } ////// NativeContext /// internal SafeMILHandle NativeContextSafeHandle { get { return context; } } ////// Sets the output pixel format /// public PixelFormat OutputPixelFormat { #if never get { Guid guid; HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.GetOutputPixelFormat(NativeContextSafeHandle, out guid)); return PixelFormat.GetPixelFormat(guid); } #endif set { Guid guid = value.Guid; HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetOutputPixelFormat(NativeContextSafeHandle, ref guid)); } } #if never ////// /// public bool SoftwareRenderer { set { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetUseSoftwareRenderer(context, value)); } } #endif ////// Gets or sets the transform for the effects pipeline /// public Matrix Transform { get { double m11, m12, m21, m22, m31, m32; HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.GetFinalTransform(NativeContextSafeHandle, out m11, out m12, out m21, out m22, out m31, out m32)); return new Matrix(m11, m12, m21, m22, m31, m32); } set { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetInitialTransform(NativeContextSafeHandle, value.M11, value.M12, value.M21, value.M22, value.OffsetX, value.OffsetY)); } } ////// Sets the output DPI /// public Point OutputDPI { #if never get { double dpiX, dpiY; HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.GetOutputDPI(NativeContextSafeHandle, out dpiX, out dpiY)); return new Point(dpiX, dpiY); } #endif set { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetOutputDPI(NativeContextSafeHandle, value.X, value.Y)); } } ////// Sets the region of interest /// public Rect RenderRect { set { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetRegionOfInterest(context, ref value)); } } ////// Create context /// ////// Critical - calls critical code method FactoryMaker.FactoryMaker /// TreatAsSafe - as there is a demand /// [SecurityCritical, SecurityTreatAsSafe] internal void Create() { SecurityHelper.DemandUIWindowPermission(); using (FactoryMaker myFactory = new FactoryMaker()) { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.MILFactoryEffects.CreateBitmapEffectContext(myFactory.FactoryPtr, out context)); } } } } // 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: BitmapEffectRenderContext.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 System.Security; using MS.Internal.PresentationCore; namespace System.Windows.Media.Effects { ////// BitmapEffectRenderContext /// internal class BitmapEffectRenderContext { SafeMILHandle /*IMILBitmapEffectRenderContext*/ context; ////// BitmapEffectRenderContext /// public BitmapEffectRenderContext() { Create(); } ////// NativeContext /// internal SafeMILHandle NativeContextSafeHandle { get { return context; } } ////// Sets the output pixel format /// public PixelFormat OutputPixelFormat { #if never get { Guid guid; HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.GetOutputPixelFormat(NativeContextSafeHandle, out guid)); return PixelFormat.GetPixelFormat(guid); } #endif set { Guid guid = value.Guid; HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetOutputPixelFormat(NativeContextSafeHandle, ref guid)); } } #if never ////// /// public bool SoftwareRenderer { set { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetUseSoftwareRenderer(context, value)); } } #endif ////// Gets or sets the transform for the effects pipeline /// public Matrix Transform { get { double m11, m12, m21, m22, m31, m32; HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.GetFinalTransform(NativeContextSafeHandle, out m11, out m12, out m21, out m22, out m31, out m32)); return new Matrix(m11, m12, m21, m22, m31, m32); } set { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetInitialTransform(NativeContextSafeHandle, value.M11, value.M12, value.M21, value.M22, value.OffsetX, value.OffsetY)); } } ////// Sets the output DPI /// public Point OutputDPI { #if never get { double dpiX, dpiY; HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.GetOutputDPI(NativeContextSafeHandle, out dpiX, out dpiY)); return new Point(dpiX, dpiY); } #endif set { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetOutputDPI(NativeContextSafeHandle, value.X, value.Y)); } } ////// Sets the region of interest /// public Rect RenderRect { set { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.IMILBitmapEffectRenderContext.SetRegionOfInterest(context, ref value)); } } ////// Create context /// ////// Critical - calls critical code method FactoryMaker.FactoryMaker /// TreatAsSafe - as there is a demand /// [SecurityCritical, SecurityTreatAsSafe] internal void Create() { SecurityHelper.DemandUIWindowPermission(); using (FactoryMaker myFactory = new FactoryMaker()) { HRESULT.Check(MS.Win32.PresentationCore.UnsafeNativeMethods.MILFactoryEffects.CreateBitmapEffectContext(myFactory.FactoryPtr, out context)); } } } } // 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
- WaitHandleCannotBeOpenedException.cs
- QueryableDataSource.cs
- SimpleExpression.cs
- AttributeAction.cs
- IndentedWriter.cs
- DataTemplateSelector.cs
- ProtectedConfigurationProviderCollection.cs
- WebPartEventArgs.cs
- Calendar.cs
- DBSqlParserTable.cs
- TableLayoutSettings.cs
- BaseDataList.cs
- Int16Storage.cs
- DSACryptoServiceProvider.cs
- MsmqBindingMonitor.cs
- DbParameterCollectionHelper.cs
- NullToBooleanConverter.cs
- DependencyPropertyChangedEventArgs.cs
- OdbcReferenceCollection.cs
- EntityDataSourceValidationException.cs
- ContentPlaceHolder.cs
- CellTreeSimplifier.cs
- DispatcherObject.cs
- StandardToolWindows.cs
- RecommendedAsConfigurableAttribute.cs
- SqlClientFactory.cs
- ColorConverter.cs
- TheQuery.cs
- SpecialNameAttribute.cs
- PropertyChangedEventManager.cs
- DataObjectEventArgs.cs
- Convert.cs
- TextViewBase.cs
- JpegBitmapEncoder.cs
- PageThemeParser.cs
- SafeArrayTypeMismatchException.cs
- HyperLinkStyle.cs
- exports.cs
- DeploymentSection.cs
- AlphabetConverter.cs
- StaticExtensionConverter.cs
- PathSegmentCollection.cs
- RuntimeTrackingProfile.cs
- ViewBox.cs
- MultiDataTrigger.cs
- smtppermission.cs
- StateDesigner.LayoutSelectionGlyph.cs
- RegexWriter.cs
- InvalidPipelineStoreException.cs
- ServerValidateEventArgs.cs
- StreamWithDictionary.cs
- Drawing.cs
- PasswordPropertyTextAttribute.cs
- OutputCacheProfile.cs
- ElementAction.cs
- Panel.cs
- Content.cs
- RealProxy.cs
- EDesignUtil.cs
- HttpCapabilitiesSectionHandler.cs
- ExcludeFromCodeCoverageAttribute.cs
- StorageMappingItemLoader.cs
- ContextProperty.cs
- precedingsibling.cs
- RemotingConfigParser.cs
- LogManagementAsyncResult.cs
- DelegatingConfigHost.cs
- TraceUtils.cs
- CodeSnippetCompileUnit.cs
- listitem.cs
- PieceNameHelper.cs
- AttachedAnnotation.cs
- ToolboxControl.cs
- EntityDataSourceWizardForm.cs
- SettingsSection.cs
- KeyInstance.cs
- StringBuilder.cs
- HtmlButton.cs
- HeaderFilter.cs
- Symbol.cs
- ProjectionCamera.cs
- RenderTargetBitmap.cs
- CodeTypeConstructor.cs
- SystemException.cs
- ProjectionPruner.cs
- DummyDataSource.cs
- ValueQuery.cs
- TimerElapsedEvenArgs.cs
- TraceLevelHelper.cs
- TraceLevelStore.cs
- DefaultTraceListener.cs
- BamlStream.cs
- MappingItemCollection.cs
- IListConverters.cs
- CreateUserErrorEventArgs.cs
- DeploymentSection.cs
- ImagingCache.cs
- PropertyItemInternal.cs
- CharEntityEncoderFallback.cs
- QueryOperationResponseOfT.cs