Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media / ScaleTransform.cs / 1 / ScaleTransform.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2001 // // File: ScaleTransform.cs //----------------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Media; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Reflection; using System.Security; using System.Collections; using MS.Internal; using MS.Internal.PresentationCore; using System.Windows.Media.Animation; using System.Globalization; using System.Text; using System.Runtime.InteropServices; using System.Windows.Media.Composition; using System.Diagnostics; using SR=MS.Internal.PresentationCore.SR; using SRID=MS.Internal.PresentationCore.SRID; namespace System.Windows.Media { ////// Create a scale transformation. /// public sealed partial class ScaleTransform : Transform { ////// Create a scale transformation. /// public ScaleTransform() { } ////// Create a scale transformation. /// public ScaleTransform( double scaleX, double scaleY ) { ScaleX = scaleX; ScaleY = scaleY; } ////// Create a scale transformation. /// public ScaleTransform( double scaleX, double scaleY, double centerX, double centerY ) : this(scaleX, scaleY) { CenterX = centerX; CenterY = centerY; } ////// Return the current transformation value. /// public override Matrix Value { get { ReadPreamble(); Matrix m = new Matrix(); m.ScaleAt(ScaleX, ScaleY, CenterX, CenterY); return m; } } ////// Returns true if transformation matches the identity transform. /// internal override bool IsIdentity { get { return ScaleX == 1 && ScaleY == 1 && CanFreeze; } } internal override void TransformRect(ref Rect rect) { if (rect.IsEmpty) { return; } double scaleX = ScaleX; double scaleY = ScaleY; double centerX = CenterX; double centerY = CenterY; bool translateCenter = centerX != 0 || centerY != 0; if (translateCenter) { rect.X -= centerX; rect.Y -= centerY; } rect.Scale(scaleX, scaleY); if (translateCenter) { rect.X += centerX; rect.Y += centerY; } } ////// MultiplyValueByMatrix - *result is set equal to "this" * matrixToMultiplyBy. /// /// The result is stored here. /// The multiplicand. internal override void MultiplyValueByMatrix(ref Matrix result, ref Matrix matrixToMultiplyBy) { result = Matrix.Identity; result._m11 = ScaleX; result._m22 = ScaleY; double centerX = CenterX; double centerY = CenterY; result._type = MatrixTypes.TRANSFORM_IS_SCALING; if (centerX != 0 || centerY != 0) { result._offsetX = centerX - centerX * result._m11; result._offsetY = centerY - centerY * result._m22; result._type |= MatrixTypes.TRANSFORM_IS_TRANSLATION; } MatrixUtil.MultiplyMatrix(ref result, ref matrixToMultiplyBy); } } } // 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
- StoreContentChangedEventArgs.cs
- GridView.cs
- Point4DConverter.cs
- ConstrainedGroup.cs
- PreloadedPackages.cs
- InstanceLockLostException.cs
- DataSysAttribute.cs
- C14NUtil.cs
- Attribute.cs
- SignerInfo.cs
- BitmapScalingModeValidation.cs
- Crc32Helper.cs
- SerialReceived.cs
- XamlWriter.cs
- ColumnClickEvent.cs
- ClientBuildManagerCallback.cs
- PositiveTimeSpanValidatorAttribute.cs
- StringWriter.cs
- DataViewSetting.cs
- XmlCountingReader.cs
- DPAPIProtectedConfigurationProvider.cs
- StateWorkerRequest.cs
- documentsequencetextview.cs
- UriScheme.cs
- Renderer.cs
- TypeUnloadedException.cs
- ConnectionsZone.cs
- propertytag.cs
- DrawingContextDrawingContextWalker.cs
- UInt32Converter.cs
- VirtualPathUtility.cs
- CachingHintValidation.cs
- EditorPart.cs
- DateTimeOffsetConverter.cs
- CustomErrorCollection.cs
- DbBuffer.cs
- DrawingContext.cs
- DecoderNLS.cs
- CodeGen.cs
- DataRowChangeEvent.cs
- SingleBodyParameterMessageFormatter.cs
- TempEnvironment.cs
- VerificationAttribute.cs
- VerificationAttribute.cs
- counter.cs
- XPathPatternParser.cs
- SuspendDesigner.cs
- keycontainerpermission.cs
- SecurityKeyUsage.cs
- TextTreeRootTextBlock.cs
- WebControlAdapter.cs
- DefaultExpression.cs
- SortDescription.cs
- ScriptHandlerFactory.cs
- ResourceExpressionBuilder.cs
- EditingScopeUndoUnit.cs
- FileDetails.cs
- ObjectStateFormatter.cs
- PreviewPageInfo.cs
- WindowsIPAddress.cs
- DataExpression.cs
- SystemWebSectionGroup.cs
- Command.cs
- BasePropertyDescriptor.cs
- Hyperlink.cs
- PathFigureCollectionConverter.cs
- TableRowGroup.cs
- ExclusiveCanonicalizationTransform.cs
- ComplusEndpointConfigContainer.cs
- MarkupCompilePass2.cs
- SqlCommandBuilder.cs
- IsolatedStorageFile.cs
- safemediahandle.cs
- InvokePatternIdentifiers.cs
- TableItemPatternIdentifiers.cs
- UnsafeNativeMethods.cs
- ConnectionInterfaceCollection.cs
- XmlSchemaSimpleTypeList.cs
- ModelPerspective.cs
- ValidationSettings.cs
- InternalTypeHelper.cs
- InternalReceiveMessage.cs
- xml.cs
- VarInfo.cs
- DataSet.cs
- IisTraceWebEventProvider.cs
- LocatorPartList.cs
- WebUtil.cs
- SerializableAttribute.cs
- UriSectionReader.cs
- AuthorizationRule.cs
- COM2Properties.cs
- SiteMapNodeItemEventArgs.cs
- SelectionRangeConverter.cs
- SimpleBitVector32.cs
- FixedSOMSemanticBox.cs
- HttpClientCertificate.cs
- Evidence.cs
- AnchoredBlock.cs
- TextEvent.cs