Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- fixedPageContentExtractor.cs
- XmlSerializerNamespaces.cs
- SymbolEqualComparer.cs
- XmlSchemaSimpleContentExtension.cs
- LayoutInformation.cs
- Mappings.cs
- IntegerFacetDescriptionElement.cs
- ToolStripPanel.cs
- HttpModuleAction.cs
- TextEditorSelection.cs
- Buffer.cs
- MenuItem.cs
- VisualStyleRenderer.cs
- TypeUtil.cs
- EntityDataSourceSelectedEventArgs.cs
- Queue.cs
- EditorPartCollection.cs
- UpWmlMobileTextWriter.cs
- DataGridTextBoxColumn.cs
- shaperfactory.cs
- FactoryRecord.cs
- ListSortDescription.cs
- TrailingSpaceComparer.cs
- StringReader.cs
- DtrList.cs
- IImplicitResourceProvider.cs
- XmlSerializerSection.cs
- MultipleViewPattern.cs
- UserControlParser.cs
- CodeNamespaceImport.cs
- Underline.cs
- CompositeScriptReferenceEventArgs.cs
- CodeMethodReturnStatement.cs
- OdbcError.cs
- DtrList.cs
- WebDescriptionAttribute.cs
- TemplateControlCodeDomTreeGenerator.cs
- Logging.cs
- Vertex.cs
- Brush.cs
- DataListCommandEventArgs.cs
- SessionPageStateSection.cs
- DefaultAuthorizationContext.cs
- COM2Enum.cs
- _HelperAsyncResults.cs
- TextAnchor.cs
- Emitter.cs
- documentation.cs
- EntityWithKeyStrategy.cs
- DynamicExpression.cs
- Resources.Designer.cs
- RSAPKCS1SignatureDeformatter.cs
- DataGridViewCellValidatingEventArgs.cs
- PropertyTab.cs
- MachinePropertyVariants.cs
- ConnectionPoolManager.cs
- SchemaImporter.cs
- ZipPackage.cs
- SQlBooleanStorage.cs
- SemaphoreFullException.cs
- GrammarBuilderDictation.cs
- OdbcEnvironment.cs
- ClientScriptItemCollection.cs
- DesignerVerb.cs
- mactripleDES.cs
- PagePropertiesChangingEventArgs.cs
- Helpers.cs
- DoubleAnimation.cs
- XamlStackWriter.cs
- ClientSettingsStore.cs
- WmlCommandAdapter.cs
- XmlSortKey.cs
- BmpBitmapEncoder.cs
- ProvidePropertyAttribute.cs
- StylusButtonEventArgs.cs
- Type.cs
- CodeStatement.cs
- COM2TypeInfoProcessor.cs
- OrderedDictionary.cs
- KerberosSecurityTokenProvider.cs
- DataConnectionHelper.cs
- PropertyEmitterBase.cs
- MetaModel.cs
- ApplicationId.cs
- HttpRequest.cs
- TypeListConverter.cs
- PropertyChangeTracker.cs
- XamlToRtfWriter.cs
- HttpSysSettings.cs
- bidPrivateBase.cs
- X509Utils.cs
- DataGridViewImageCell.cs
- ArraySortHelper.cs
- ModelTreeManager.cs
- FontFamilyConverter.cs
- DirectionalLight.cs
- DeclarativeConditionsCollection.cs
- RegexWriter.cs
- Trigger.cs
- ThicknessKeyFrameCollection.cs