Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / MS / Internal / Ink / ContourSegment.cs / 1 / ContourSegment.cs
//------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Media; namespace MS.Internal.Ink { ////// A helper structure representing an edge of a contour, where /// the edge is either a straight segment or an arc of a circle. /// ContourSegment are alwais directed clockwise (i.e with the contour /// inner area being on the right side. /// Used in hit-testing a contour vs another contour. /// internal struct ContourSegment { ////// Constructor for linear segments /// /// segment's begin point /// segment's end point internal ContourSegment(Point begin, Point end) { _begin = begin; _vector = DoubleUtil.AreClose(begin, end) ? new Vector(0, 0) : (end - begin); _radius = new Vector(0, 0); } ////// Constructor for arcs /// /// arc's begin point /// arc's end point /// arc's center internal ContourSegment(Point begin, Point end, Point center) { _begin = begin; _vector = end - begin; _radius = center - begin; } ///Tells whether the segment is arc or straight internal bool IsArc { get { return (_radius.X != 0) || (_radius.Y != 0); } } ///Returns the begin point of the segment internal Point Begin { get { return _begin; } } ///Returns the end point of the segment internal Point End { get { return _begin + _vector; } } ///Returns the vector from Begin to End internal Vector Vector { get { return _vector; } } ///Returns the vector from Begin to the center of the circle /// (zero vector for linear segments internal Vector Radius { get { return _radius; } } #region Fields private Point _begin; private Vector _vector; private Vector _radius; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Media; namespace MS.Internal.Ink { ////// A helper structure representing an edge of a contour, where /// the edge is either a straight segment or an arc of a circle. /// ContourSegment are alwais directed clockwise (i.e with the contour /// inner area being on the right side. /// Used in hit-testing a contour vs another contour. /// internal struct ContourSegment { ////// Constructor for linear segments /// /// segment's begin point /// segment's end point internal ContourSegment(Point begin, Point end) { _begin = begin; _vector = DoubleUtil.AreClose(begin, end) ? new Vector(0, 0) : (end - begin); _radius = new Vector(0, 0); } ////// Constructor for arcs /// /// arc's begin point /// arc's end point /// arc's center internal ContourSegment(Point begin, Point end, Point center) { _begin = begin; _vector = end - begin; _radius = center - begin; } ///Tells whether the segment is arc or straight internal bool IsArc { get { return (_radius.X != 0) || (_radius.Y != 0); } } ///Returns the begin point of the segment internal Point Begin { get { return _begin; } } ///Returns the end point of the segment internal Point End { get { return _begin + _vector; } } ///Returns the vector from Begin to End internal Vector Vector { get { return _vector; } } ///Returns the vector from Begin to the center of the circle /// (zero vector for linear segments internal Vector Radius { get { return _radius; } } #region Fields private Point _begin; private Vector _vector; private Vector _radius; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DecoratedNameAttribute.cs
- ConnectionOrientedTransportChannelFactory.cs
- XPathNodePointer.cs
- ZipIOLocalFileDataDescriptor.cs
- CanonicalFontFamilyReference.cs
- EntityDataSourceState.cs
- GridViewSortEventArgs.cs
- SecurityState.cs
- ConfigXmlAttribute.cs
- _NegoState.cs
- StyleCollectionEditor.cs
- ReferenceService.cs
- SmiGettersStream.cs
- Accessible.cs
- BasePattern.cs
- SetterBase.cs
- QueuePathEditor.cs
- IdnElement.cs
- FilterQuery.cs
- XmlILTrace.cs
- HttpContextWrapper.cs
- KeyedHashAlgorithm.cs
- PageParserFilter.cs
- InboundActivityHelper.cs
- IconBitmapDecoder.cs
- ObjectManager.cs
- HiddenFieldPageStatePersister.cs
- ParameterBuilder.cs
- BitmapEffectDrawingContextState.cs
- GlyphManager.cs
- XmlSerializableWriter.cs
- WebResourceUtil.cs
- BeginEvent.cs
- PageThemeCodeDomTreeGenerator.cs
- TransformerTypeCollection.cs
- StrongNamePublicKeyBlob.cs
- SQlBooleanStorage.cs
- FieldToken.cs
- SystemThemeKey.cs
- IpcChannel.cs
- ObjectDataSourceMethodEditor.cs
- ActivityValidator.cs
- RepeatEnumerable.cs
- MsmqInputChannel.cs
- DrawingGroup.cs
- DCSafeHandle.cs
- ContentPlaceHolder.cs
- DescriptionAttribute.cs
- SimpleBitVector32.cs
- RowsCopiedEventArgs.cs
- VersionedStream.cs
- SimpleRecyclingCache.cs
- RegexParser.cs
- FixedTextView.cs
- RecipientServiceModelSecurityTokenRequirement.cs
- CryptoApi.cs
- DSASignatureDeformatter.cs
- SoapReflectionImporter.cs
- CompilerTypeWithParams.cs
- MetadataCacheItem.cs
- ExtendedProperty.cs
- HostingEnvironment.cs
- X509CertificateValidator.cs
- Guid.cs
- CategoryNameCollection.cs
- ExceptionUtility.cs
- ClientFormsIdentity.cs
- TypeUtil.cs
- HijriCalendar.cs
- DateTime.cs
- WebException.cs
- ModuleBuilderData.cs
- _NestedMultipleAsyncResult.cs
- StringFormat.cs
- QilCloneVisitor.cs
- EmbeddedMailObject.cs
- RecognizerInfo.cs
- XmlSchemaSubstitutionGroup.cs
- DataSvcMapFile.cs
- DataGridViewDataConnection.cs
- Int32CollectionConverter.cs
- XamlHostingConfiguration.cs
- XComponentModel.cs
- AccessViolationException.cs
- BooleanConverter.cs
- HttpStreamMessage.cs
- ClipboardData.cs
- WeakEventTable.cs
- SkinIDTypeConverter.cs
- RowParagraph.cs
- ValueCollectionParameterReader.cs
- BooleanKeyFrameCollection.cs
- ComponentChangingEvent.cs
- ContractTypeNameCollection.cs
- RoutedCommand.cs
- DataGridViewRowStateChangedEventArgs.cs
- CodeSubDirectoriesCollection.cs
- TreeNodeBindingDepthConverter.cs
- PermissionListSet.cs
- shaperfactoryquerycacheentry.cs