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
- Brushes.cs
- SmtpReplyReader.cs
- PropertyEntry.cs
- ProxyHwnd.cs
- FileStream.cs
- FtpRequestCacheValidator.cs
- ContextActivityUtils.cs
- GroupItem.cs
- VisualStyleInformation.cs
- Number.cs
- SymmetricAlgorithm.cs
- SQLConvert.cs
- ProviderIncompatibleException.cs
- SessionStateUtil.cs
- ValidationSummary.cs
- LambdaCompiler.Address.cs
- ChannelManagerHelpers.cs
- SqlParameterizer.cs
- TabItemAutomationPeer.cs
- ReferencedType.cs
- AutomationElementIdentifiers.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- LabelExpression.cs
- StylusTip.cs
- DataBindingCollection.cs
- SafeNativeMethodsMilCoreApi.cs
- ThumbButtonInfo.cs
- PropertySet.cs
- Screen.cs
- VisualStyleInformation.cs
- LocatorPart.cs
- TraceUtils.cs
- ConfigurationStrings.cs
- InternalRelationshipCollection.cs
- BaseTemplateCodeDomTreeGenerator.cs
- SmiTypedGetterSetter.cs
- TdsParserStaticMethods.cs
- TdsParserHelperClasses.cs
- SspiNegotiationTokenAuthenticatorState.cs
- OdbcConnectionPoolProviderInfo.cs
- AssemblyBuilder.cs
- DataGridViewLayoutData.cs
- PropertiesTab.cs
- HasCopySemanticsAttribute.cs
- EntityUtil.cs
- SystemKeyConverter.cs
- ISCIIEncoding.cs
- DataBinder.cs
- CacheHelper.cs
- MessageDroppedTraceRecord.cs
- MailDefinition.cs
- CheckBoxBaseAdapter.cs
- ContentType.cs
- ZipIOExtraField.cs
- ReferencedType.cs
- DirectoryNotFoundException.cs
- OrderedEnumerableRowCollection.cs
- XmlILConstructAnalyzer.cs
- BlurBitmapEffect.cs
- ProcessHostServerConfig.cs
- CheckBoxField.cs
- ValueUnavailableException.cs
- CodeAttributeArgumentCollection.cs
- AsyncSerializedWorker.cs
- DoubleCollection.cs
- EventManager.cs
- LOSFormatter.cs
- RequestQueue.cs
- InstanceOwnerQueryResult.cs
- InstanceDescriptor.cs
- MatrixAnimationUsingKeyFrames.cs
- VerbConverter.cs
- ProtectedConfigurationProviderCollection.cs
- ChildTable.cs
- ScriptResourceAttribute.cs
- WindowsPen.cs
- SegmentInfo.cs
- ConsoleKeyInfo.cs
- JumpPath.cs
- DataGridViewSelectedRowCollection.cs
- GeneralTransform3DTo2D.cs
- ExpandSegment.cs
- Condition.cs
- SyntaxCheck.cs
- User.cs
- DataGridCellItemAutomationPeer.cs
- TiffBitmapEncoder.cs
- MonthCalendar.cs
- ToolstripProfessionalRenderer.cs
- newinstructionaction.cs
- Pen.cs
- WmlTextBoxAdapter.cs
- ReturnType.cs
- DataRecordObjectView.cs
- ExcCanonicalXml.cs
- SafeNativeMethods.cs
- MatchSingleFxEngineOpcode.cs
- SamlDelegatingWriter.cs
- SqlAliaser.cs
- FixedPage.cs