Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Media / Effects / BitmapEffectGeneralTransform.cs / 1 / BitmapEffectGeneralTransform.cs
/****************************************************************************\
*
* File: BitmapEffectGeneralTransform.cs
*
* Description:
* BitmapEffectGeneralTransform.cs defines the "BitmapEffectGeneralTransform" object
*
* Copyright (C) 2002 by Microsoft Corporation. All rights reserved.
*
\***************************************************************************/
using MS.Internal;
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Windows;
using System.Windows.Media.Animation;
using System.Windows.Media.Composition;
using System.Windows.Markup;
using MS.Internal.PresentationCore;
using SR = MS.Internal.PresentationCore.SR;
using SRID = MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Effects
{
///
/// This is a general transform wrapper for a bitmap effect
///
internal partial class BitmapEffectGeneralTransform : GeneralTransform
{
private bool _fInverse = false;
private Rect _visualBounds = Rect.Empty;
///
/// Constructor
///
public BitmapEffectGeneralTransform() { }
///
/// Constructor
///
/// bitmap effect
/// bitmap effect input
/// Inverse transform
/// The bounds of the visual for
public BitmapEffectGeneralTransform(BitmapEffect effect, BitmapEffectInput input, bool fInverse, Rect visualBounds)
{
if (effect == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect, null));
this.BitmapEffect = effect.Clone();
this.BitmapEffectInput = (input != null) ? input.Clone() : new BitmapEffectInput();
_fInverse = fInverse;
_visualBounds = visualBounds;
}
///
/// Returns true if the transform is an inverse
///
internal bool IsInverse
{
get { return _fInverse; }
set { _fInverse = value; }
}
///
/// Implementation of Freezable.CloneCore .
///
///
protected override void CloneCore(Freezable sourceFreezable)
{
BitmapEffectGeneralTransform transform = (BitmapEffectGeneralTransform)sourceFreezable;
base.CloneCore(sourceFreezable);
CopyCommon(transform);
}
///
/// Implementation of Freezable.CloneCurrentValueCore .
///
///
protected override void CloneCurrentValueCore(Freezable sourceFreezable)
{
BitmapEffectGeneralTransform transform = (BitmapEffectGeneralTransform)sourceFreezable;
base.CloneCurrentValueCore(sourceFreezable);
CopyCommon(transform);
}
///
/// Implementation of Freezable.GetAsFrozenCore .
///
///
protected override void GetAsFrozenCore(Freezable sourceFreezable)
{
BitmapEffectGeneralTransform transform = (BitmapEffectGeneralTransform)sourceFreezable;
base.GetAsFrozenCore(sourceFreezable);
CopyCommon(transform);
}
///
/// Implementation of Freezable.GetCurrentValueAsFrozenCore .
///
///
protected override void GetCurrentValueAsFrozenCore(Freezable sourceFreezable)
{
BitmapEffectGeneralTransform transform = (BitmapEffectGeneralTransform)sourceFreezable;
base.GetCurrentValueAsFrozenCore(sourceFreezable);
CopyCommon(transform);
}
///
/// Transforms a point
///
/// input point
/// output point
/// false if the point cannot be transformed
public override bool TryTransform(Point inPoint, out Point result)
{
if (BitmapEffect == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect, null));
if (BitmapEffectInput == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect_Input, null));
BitmapEffect.VisualBounds = _visualBounds;
return BitmapEffect.TransformPoint(BitmapEffectInput, inPoint, out result, _fInverse);
}
///
/// Transform the rect bounds into the smallest axis alligned bounding box that
/// contains all the point in the original bounds.
///
///
///
public override Rect TransformBounds(Rect rect)
{
if (BitmapEffect == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect, null));
if (BitmapEffectInput == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect_Input, null));
return BitmapEffect.TransformRect(BitmapEffectInput, rect, _fInverse);
}
///
/// Returns the inverse transform if there is one, null otherwise
///
public override GeneralTransform Inverse
{
get
{
ReadPreamble();
if (!BitmapEffect.IsInverseTransform)
return null;
BitmapEffectGeneralTransform inverse = Clone();
inverse.IsInverse = !_fInverse;
return inverse;
}
}
///
/// Returns a best effort affine transform
///
internal override Transform AffineTransform
{
[FriendAccessAllowed] // Built into Core, also used by Framework.
get
{
return null;
}
}
///
/// Clones values that do not have corresponding DPs
///
///
private void CopyCommon(BitmapEffectGeneralTransform transform)
{
_fInverse = transform._fInverse;
_visualBounds = transform._visualBounds;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
/****************************************************************************\
*
* File: BitmapEffectGeneralTransform.cs
*
* Description:
* BitmapEffectGeneralTransform.cs defines the "BitmapEffectGeneralTransform" object
*
* Copyright (C) 2002 by Microsoft Corporation. All rights reserved.
*
\***************************************************************************/
using MS.Internal;
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Windows;
using System.Windows.Media.Animation;
using System.Windows.Media.Composition;
using System.Windows.Markup;
using MS.Internal.PresentationCore;
using SR = MS.Internal.PresentationCore.SR;
using SRID = MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Effects
{
///
/// This is a general transform wrapper for a bitmap effect
///
internal partial class BitmapEffectGeneralTransform : GeneralTransform
{
private bool _fInverse = false;
private Rect _visualBounds = Rect.Empty;
///
/// Constructor
///
public BitmapEffectGeneralTransform() { }
///
/// Constructor
///
/// bitmap effect
/// bitmap effect input
/// Inverse transform
/// The bounds of the visual for
public BitmapEffectGeneralTransform(BitmapEffect effect, BitmapEffectInput input, bool fInverse, Rect visualBounds)
{
if (effect == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect, null));
this.BitmapEffect = effect.Clone();
this.BitmapEffectInput = (input != null) ? input.Clone() : new BitmapEffectInput();
_fInverse = fInverse;
_visualBounds = visualBounds;
}
///
/// Returns true if the transform is an inverse
///
internal bool IsInverse
{
get { return _fInverse; }
set { _fInverse = value; }
}
///
/// Implementation of Freezable.CloneCore .
///
///
protected override void CloneCore(Freezable sourceFreezable)
{
BitmapEffectGeneralTransform transform = (BitmapEffectGeneralTransform)sourceFreezable;
base.CloneCore(sourceFreezable);
CopyCommon(transform);
}
///
/// Implementation of Freezable.CloneCurrentValueCore .
///
///
protected override void CloneCurrentValueCore(Freezable sourceFreezable)
{
BitmapEffectGeneralTransform transform = (BitmapEffectGeneralTransform)sourceFreezable;
base.CloneCurrentValueCore(sourceFreezable);
CopyCommon(transform);
}
///
/// Implementation of Freezable.GetAsFrozenCore .
///
///
protected override void GetAsFrozenCore(Freezable sourceFreezable)
{
BitmapEffectGeneralTransform transform = (BitmapEffectGeneralTransform)sourceFreezable;
base.GetAsFrozenCore(sourceFreezable);
CopyCommon(transform);
}
///
/// Implementation of Freezable.GetCurrentValueAsFrozenCore .
///
///
protected override void GetCurrentValueAsFrozenCore(Freezable sourceFreezable)
{
BitmapEffectGeneralTransform transform = (BitmapEffectGeneralTransform)sourceFreezable;
base.GetCurrentValueAsFrozenCore(sourceFreezable);
CopyCommon(transform);
}
///
/// Transforms a point
///
/// input point
/// output point
/// false if the point cannot be transformed
public override bool TryTransform(Point inPoint, out Point result)
{
if (BitmapEffect == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect, null));
if (BitmapEffectInput == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect_Input, null));
BitmapEffect.VisualBounds = _visualBounds;
return BitmapEffect.TransformPoint(BitmapEffectInput, inPoint, out result, _fInverse);
}
///
/// Transform the rect bounds into the smallest axis alligned bounding box that
/// contains all the point in the original bounds.
///
///
///
public override Rect TransformBounds(Rect rect)
{
if (BitmapEffect == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect, null));
if (BitmapEffectInput == null)
throw new InvalidOperationException(SR.Get(SRID.Transform_No_Effect_Input, null));
return BitmapEffect.TransformRect(BitmapEffectInput, rect, _fInverse);
}
///
/// Returns the inverse transform if there is one, null otherwise
///
public override GeneralTransform Inverse
{
get
{
ReadPreamble();
if (!BitmapEffect.IsInverseTransform)
return null;
BitmapEffectGeneralTransform inverse = Clone();
inverse.IsInverse = !_fInverse;
return inverse;
}
}
///
/// Returns a best effort affine transform
///
internal override Transform AffineTransform
{
[FriendAccessAllowed] // Built into Core, also used by Framework.
get
{
return null;
}
}
///
/// Clones values that do not have corresponding DPs
///
///
private void CopyCommon(BitmapEffectGeneralTransform transform)
{
_fInverse = transform._fInverse;
_visualBounds = transform._visualBounds;
}
}
}
// 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
- BamlRecordWriter.cs
- DbConnectionHelper.cs
- ToolboxItemSnapLineBehavior.cs
- StringComparer.cs
- TypeForwardedToAttribute.cs
- Boolean.cs
- RSAOAEPKeyExchangeFormatter.cs
- StorageModelBuildProvider.cs
- DescendantQuery.cs
- Trigger.cs
- WebPartDescriptionCollection.cs
- SizeChangedInfo.cs
- EtwTrace.cs
- SelectedDatesCollection.cs
- ApplicationException.cs
- ApplicationException.cs
- GetPageNumberCompletedEventArgs.cs
- DefaultValueAttribute.cs
- QueryConverter.cs
- TrackingRecord.cs
- TextDecorationCollection.cs
- Utility.cs
- PageThemeCodeDomTreeGenerator.cs
- COAUTHINFO.cs
- ParamArrayAttribute.cs
- ProxyGenerator.cs
- TypeDescriptionProvider.cs
- DataTableReaderListener.cs
- HwndProxyElementProvider.cs
- TransformCollection.cs
- ActiveXContainer.cs
- InvokePattern.cs
- ClientSession.cs
- ReferentialConstraint.cs
- EntityDataSourceReferenceGroup.cs
- XmlCharacterData.cs
- C14NUtil.cs
- ReliableChannelFactory.cs
- IPEndPointCollection.cs
- ListViewUpdatedEventArgs.cs
- _AutoWebProxyScriptEngine.cs
- TypeDefinition.cs
- WorkflowDefinitionDispenser.cs
- WebSysDescriptionAttribute.cs
- PersistChildrenAttribute.cs
- DataTemplateKey.cs
- EdmFunctionAttribute.cs
- DataGridViewAccessibleObject.cs
- Size3D.cs
- DataServiceOperationContext.cs
- SmiContextFactory.cs
- ImageButton.cs
- MatrixAnimationUsingPath.cs
- DataGridViewCellEventArgs.cs
- ProviderIncompatibleException.cs
- FileUtil.cs
- VariantWrapper.cs
- DrawingImage.cs
- Request.cs
- ProviderSettings.cs
- DependencyObjectProvider.cs
- SemaphoreSecurity.cs
- DataTableMappingCollection.cs
- LookupBindingPropertiesAttribute.cs
- GorillaCodec.cs
- IPAddress.cs
- NetTcpSecurityElement.cs
- TripleDESCryptoServiceProvider.cs
- WebConfigurationManager.cs
- QilCloneVisitor.cs
- HierarchicalDataTemplate.cs
- UserControlParser.cs
- ToolStripPanelRow.cs
- Attributes.cs
- DetailsViewCommandEventArgs.cs
- SharedDp.cs
- ExpressionBinding.cs
- cache.cs
- EntityWrapperFactory.cs
- StyleCollection.cs
- WorkflowServiceHostFactory.cs
- StatusBar.cs
- LockedHandleGlyph.cs
- GatewayDefinition.cs
- CapabilitiesState.cs
- DataPagerFieldCommandEventArgs.cs
- TypeSystemProvider.cs
- SoapAttributeOverrides.cs
- OdbcRowUpdatingEvent.cs
- FontCollection.cs
- TextServicesHost.cs
- ListViewTableRow.cs
- UIAgentCrashedException.cs
- MissingMemberException.cs
- Compilation.cs
- DataControlFieldsEditor.cs
- MSAAWinEventWrap.cs
- RootProjectionNode.cs
- EventMappingSettings.cs
- UserCancellationException.cs