Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / MS / Internal / Ink / ContourSegment.cs / 1305600 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RawAppCommandInputReport.cs
- PolyLineSegment.cs
- Bitmap.cs
- SqlReferenceCollection.cs
- GridViewSelectEventArgs.cs
- SecondaryIndex.cs
- EventWaitHandleSecurity.cs
- Accessors.cs
- ServiceNameCollection.cs
- DataGridViewRow.cs
- StorageEndPropertyMapping.cs
- HatchBrush.cs
- UserPreferenceChangedEventArgs.cs
- Encoding.cs
- DataGridViewIntLinkedList.cs
- ScriptBehaviorDescriptor.cs
- WebHostedComPlusServiceHost.cs
- ObjectSelectorEditor.cs
- StylusSystemGestureEventArgs.cs
- ExecutionContext.cs
- BevelBitmapEffect.cs
- CheckedPointers.cs
- XmlDictionary.cs
- ActiveDocumentEvent.cs
- InputBinding.cs
- ListViewTableRow.cs
- HttpRequest.cs
- UndoEngine.cs
- MetadataConversionError.cs
- LogStore.cs
- GeneralTransformGroup.cs
- WebPartsPersonalization.cs
- AmbientProperties.cs
- DataRow.cs
- AttributeUsageAttribute.cs
- LinearGradientBrush.cs
- XmlRawWriterWrapper.cs
- StateBag.cs
- DataListItem.cs
- DataControlField.cs
- RichTextBox.cs
- webbrowsersite.cs
- TableLayoutColumnStyleCollection.cs
- SqlServices.cs
- TimeoutConverter.cs
- XPSSignatureDefinition.cs
- GetCardDetailsRequest.cs
- MarkupWriter.cs
- FixUpCollection.cs
- MessagePropertyVariants.cs
- PerfService.cs
- ValidatedControlConverter.cs
- CrossSiteScriptingValidation.cs
- Module.cs
- SqlDataAdapter.cs
- MethodSet.cs
- SoapAttributeAttribute.cs
- HostedElements.cs
- WindowsRebar.cs
- DatatypeImplementation.cs
- CallContext.cs
- InvalidMessageContractException.cs
- MetadataUtilsSmi.cs
- LinqDataSourceHelper.cs
- ImmutableObjectAttribute.cs
- NodeLabelEditEvent.cs
- InputElement.cs
- AutomationIdentifierGuids.cs
- StatusStrip.cs
- SourceFileInfo.cs
- EncryptedType.cs
- DisplayMemberTemplateSelector.cs
- AssemblyUtil.cs
- EditingCoordinator.cs
- BindingManagerDataErrorEventArgs.cs
- _ShellExpression.cs
- DecoderNLS.cs
- Rect.cs
- MobileRedirect.cs
- TreeNodeStyle.cs
- EntityDataSourceChangingEventArgs.cs
- AssemblyAttributes.cs
- PropertySourceInfo.cs
- LayoutEvent.cs
- DataBindEngine.cs
- LostFocusEventManager.cs
- ProtocolElementCollection.cs
- AdRotator.cs
- KeysConverter.cs
- altserialization.cs
- SmiGettersStream.cs
- SmiContextFactory.cs
- AnimationClockResource.cs
- RoleService.cs
- GlyphRunDrawing.cs
- SqlDependency.cs
- ALinqExpressionVisitor.cs
- Exception.cs
- WindowsScrollBarBits.cs
- bindurihelper.cs