Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / MS / Internal / Ink / Quad.cs / 1 / Quad.cs
//------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
using System;
using System.Windows;
using System.Windows.Media;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using MS.Utility;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace MS.Internal.Ink
{
///
/// A helper structure used in StrokeNode and StrokeNodeOperation implementations
/// to store endpoints of the quad connecting two nodes of a stroke.
/// The vertices of a quad are supposed to be clockwise with points A and D located
/// on the begin node and B and C on the end one.
///
internal struct Quad
{
#region Statics
private static Quad s_empty = new Quad(new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0));
#endregion
#region API
/// Returns the static object representing an empty (unitialized) quad
internal static Quad Empty { get { return s_empty; } }
/// Constructor
internal Quad(Point a, Point b, Point c, Point d)
{
_A = a; _B = b; _C = c; _D = d;
}
/// The A vertex of the quad
internal Point A { get { return _A; } set { _A = value; } }
/// The B vertex of the quad
internal Point B { get { return _B; } set { _B = value; } }
/// The C vertex of the quad
internal Point C { get { return _C; } set { _C = value; } }
/// The D vertex of the quad
internal Point D { get { return _D; } set { _D = value; } }
// Returns quad's vertex by index where A is of the index 0, B - is 1, etc
internal Point this[int index]
{
get
{
switch (index)
{
case 0: return _A;
case 1: return _B;
case 2: return _C;
case 3: return _D;
default:
throw new IndexOutOfRangeException("index");
}
}
}
/// Tells whether the quad is invalid (empty)
internal bool IsEmpty
{
get { return (_A == _B) && (_C == _D); }
}
internal void GetPoints(List pointBuffer)
{
pointBuffer.Add(_A);
pointBuffer.Add(_B);
pointBuffer.Add(_C);
pointBuffer.Add(_D);
}
/// Returns the bounds of the quad
internal Rect Bounds
{
get { return IsEmpty ? Rect.Empty : Rect.Union(new Rect(_A, _B), new Rect(_C, _D)); }
}
#endregion
#region Fields
private Point _A;
private Point _B;
private Point _C;
private Point _D;
#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;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using MS.Utility;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace MS.Internal.Ink
{
///
/// A helper structure used in StrokeNode and StrokeNodeOperation implementations
/// to store endpoints of the quad connecting two nodes of a stroke.
/// The vertices of a quad are supposed to be clockwise with points A and D located
/// on the begin node and B and C on the end one.
///
internal struct Quad
{
#region Statics
private static Quad s_empty = new Quad(new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0));
#endregion
#region API
/// Returns the static object representing an empty (unitialized) quad
internal static Quad Empty { get { return s_empty; } }
/// Constructor
internal Quad(Point a, Point b, Point c, Point d)
{
_A = a; _B = b; _C = c; _D = d;
}
/// The A vertex of the quad
internal Point A { get { return _A; } set { _A = value; } }
/// The B vertex of the quad
internal Point B { get { return _B; } set { _B = value; } }
/// The C vertex of the quad
internal Point C { get { return _C; } set { _C = value; } }
/// The D vertex of the quad
internal Point D { get { return _D; } set { _D = value; } }
// Returns quad's vertex by index where A is of the index 0, B - is 1, etc
internal Point this[int index]
{
get
{
switch (index)
{
case 0: return _A;
case 1: return _B;
case 2: return _C;
case 3: return _D;
default:
throw new IndexOutOfRangeException("index");
}
}
}
/// Tells whether the quad is invalid (empty)
internal bool IsEmpty
{
get { return (_A == _B) && (_C == _D); }
}
internal void GetPoints(List pointBuffer)
{
pointBuffer.Add(_A);
pointBuffer.Add(_B);
pointBuffer.Add(_C);
pointBuffer.Add(_D);
}
/// Returns the bounds of the quad
internal Rect Bounds
{
get { return IsEmpty ? Rect.Empty : Rect.Union(new Rect(_A, _B), new Rect(_C, _D)); }
}
#endregion
#region Fields
private Point _A;
private Point _B;
private Point _C;
private Point _D;
#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
- State.cs
- BadImageFormatException.cs
- WindowsServiceElement.cs
- DSGeneratorProblem.cs
- SHA256CryptoServiceProvider.cs
- TextTreeRootTextBlock.cs
- DbConnectionStringBuilder.cs
- diagnosticsswitches.cs
- RTTypeWrapper.cs
- MailAddress.cs
- TypeBinaryExpression.cs
- GifBitmapEncoder.cs
- ValueSerializer.cs
- ActivityWithResultConverter.cs
- Propagator.cs
- DesignTimeParseData.cs
- VectorAnimationUsingKeyFrames.cs
- SrgsNameValueTag.cs
- RowCache.cs
- InvalidateEvent.cs
- SystemIPAddressInformation.cs
- FolderBrowserDialog.cs
- DbgCompiler.cs
- RegistryConfigurationProvider.cs
- IndentedWriter.cs
- XPathBuilder.cs
- ExtractorMetadata.cs
- DashStyle.cs
- JsonReaderWriterFactory.cs
- BrowserCapabilitiesCompiler.cs
- ApplicationContext.cs
- QueryExpr.cs
- ScriptIgnoreAttribute.cs
- SecurityPolicySection.cs
- UInt64Converter.cs
- ControlCachePolicy.cs
- CapabilitiesRule.cs
- OracleFactory.cs
- _PooledStream.cs
- NamespaceCollection.cs
- BamlRecordReader.cs
- HttpHeaderCollection.cs
- TimelineClockCollection.cs
- PermissionSet.cs
- ImageListImage.cs
- ParallelTimeline.cs
- FrameworkReadOnlyPropertyMetadata.cs
- EntityDataSourceMemberPath.cs
- SharedUtils.cs
- GeometryModel3D.cs
- CompiledAction.cs
- ErrorWebPart.cs
- QfeChecker.cs
- GroupLabel.cs
- Renderer.cs
- ReadContentAsBinaryHelper.cs
- HostAdapter.cs
- FormsAuthenticationUserCollection.cs
- DropDownButton.cs
- StylusPlugInCollection.cs
- RecommendedAsConfigurableAttribute.cs
- WindowsTreeView.cs
- XmlRawWriter.cs
- ColorContextHelper.cs
- FileResponseElement.cs
- EntityContainerRelationshipSet.cs
- GenericsInstances.cs
- GifBitmapDecoder.cs
- DocumentXPathNavigator.cs
- brushes.cs
- StringAnimationBase.cs
- LongTypeConverter.cs
- Selection.cs
- DoubleUtil.cs
- NetworkInterface.cs
- ContractAdapter.cs
- DbProviderFactoriesConfigurationHandler.cs
- SessionStateUtil.cs
- WebPartsPersonalizationAuthorization.cs
- PassportIdentity.cs
- DataSetSchema.cs
- Byte.cs
- Walker.cs
- DataGridSortCommandEventArgs.cs
- SystemIPInterfaceStatistics.cs
- FunctionQuery.cs
- GridItem.cs
- Rotation3DAnimation.cs
- EmptyQuery.cs
- StylusPointPropertyUnit.cs
- TabletCollection.cs
- ParseHttpDate.cs
- Camera.cs
- SHA256Managed.cs
- ExpressionNode.cs
- OutputCacheSettingsSection.cs
- _UriTypeConverter.cs
- SpAudioStreamWrapper.cs
- CodeArrayCreateExpression.cs
- ToolStripEditorManager.cs