本文整理汇总了C#中System.Windows.Media.PointCollection.Freeze方法的典型用法代码示例。如果您正苦于以下问题:C# PointCollection.Freeze方法的具体用法?C# PointCollection.Freeze怎么用?C# PointCollection.Freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.PointCollection
的用法示例。
在下文中一共展示了PointCollection.Freeze方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Terrain3D
static Terrain3D()
{
{
SX = new double[17];
SZ = new double[17];
int i = 0;
for (double d = 0; d < 2; d += 0.125)
{
i++;
SX[i] = Math.Cos(Math.PI * d);
SZ[i] = Math.Sin(Math.PI * d);
}
}
{
TEXTURE_COORDINATES = new PointCollection(17);
TEXTURE_COORDINATES.Add(new Point(0, 0));
Point p = new Point(1, 0);
int i = -1;
while (++i < 16) TEXTURE_COORDINATES.Add(p);
TEXTURE_COORDINATES.Freeze();
}
{
TRIANGLE_INDICES = new Int32Collection(48);
for (int i = 1; i < 16; i++)
{
TRIANGLE_INDICES.Add(0);
TRIANGLE_INDICES.Add(i + 1);
TRIANGLE_INDICES.Add(i);
}
TRIANGLE_INDICES.Add(0);
TRIANGLE_INDICES.Add(1);
TRIANGLE_INDICES.Add(16);
TRIANGLE_INDICES.Freeze();
}
}
示例2: Pokemon3D
static Pokemon3D()
{
TEXTURE_COORDINATES = new PointCollection(new Point[]
{ new Point(0, 1), new Point(0, 0), new Point(1, 1), new Point(1, 0) });
TRIANGLE_INDICES = new Int32Collection(new int[] { 0, 2, 1, 3, 1, 2 });
TEXTURE_COORDINATES.Freeze();
TRIANGLE_INDICES.Freeze();
}
示例3: ComputeConnectionPoints
/// <summary>
/// Rebuild connection points.
/// </summary>
private void ComputeConnectionPoints()
{
PointCollection computedPoints = new PointCollection();
computedPoints.Add(this.SourceConnectorHotspot);
double deltaX = Math.Abs(this.DestConnectorHotspot.X - this.SourceConnectorHotspot.X);
double deltaY = Math.Abs(this.DestConnectorHotspot.Y - this.SourceConnectorHotspot.Y);
if (deltaX > deltaY)
{
double midPointX = this.SourceConnectorHotspot.X + ((this.DestConnectorHotspot.X - this.SourceConnectorHotspot.X) / 2);
computedPoints.Add(new Point(midPointX, this.SourceConnectorHotspot.Y));
computedPoints.Add(new Point(midPointX, this.DestConnectorHotspot.Y));
}
else
{
double midPointY = this.SourceConnectorHotspot.Y + ((this.DestConnectorHotspot.Y - this.SourceConnectorHotspot.Y) / 2);
computedPoints.Add(new Point(this.SourceConnectorHotspot.X, midPointY));
computedPoints.Add(new Point(this.DestConnectorHotspot.X, midPointY));
}
computedPoints.Add(this.DestConnectorHotspot);
computedPoints.Freeze();
this.Points = computedPoints;
}
示例4: ConvertToPointCollection
public static PointCollection ConvertToPointCollection(int[] values)
{
PointCollection points = new PointCollection();
if (values == null)
{
points.Freeze();
return points;
}
values = SmoothHistogram(values);
int max = values.Max();
// first point (lower-left corner)
points.Add(new Point(0, max));
// middle points
for (int i = 0; i < values.Length; i++)
{
points.Add(new Point(i, max - values[i]));
}
// last point (lower-right corner)
points.Add(new Point(values.Length - 1, max));
points.Freeze();
return points;
}
示例5: ComputeConnectionPoints
/// <summary>
/// Rebuild connection points.
/// </summary>
private void ComputeConnectionPoints()
{
const double offset = 120.0;
double srcDeltaX = offset;
double destDeltaX = -offset;
if (SourceConnector != null)
{
if (SourceConnector.Type == ConnectorType.Input
|| SourceConnector.Type == ConnectorType.VariableInput)
{
srcDeltaX = -offset;
}
else if (SourceConnector.Type == ConnectorType.Output
|| SourceConnector.Type == ConnectorType.VariableOutput)
{
srcDeltaX = offset;
}
}
if (DestConnector != null)
{
if (DestConnector.Type == ConnectorType.Output
|| DestConnector.Type == ConnectorType.VariableOutput
|| DestConnector.Type == ConnectorType.VariableInputOutput)
{
destDeltaX = offset;
}
}
PointCollection computedPoints = new PointCollection();
computedPoints.Add(SourceConnectorHotspot);
computedPoints.Add(new Point(SourceConnectorHotspot.X + srcDeltaX, SourceConnectorHotspot.Y));
computedPoints.Add(new Point(DestConnectorHotspot.X + destDeltaX, this.DestConnectorHotspot.Y));
computedPoints.Add(DestConnectorHotspot);
computedPoints.Freeze();
this.Points = computedPoints;
}
示例6: ConvertToPointCollection
private PointCollection ConvertToPointCollection(int[] values)
{
values = SmoothHistogram(values);
int max = values.Max();
PointCollection points = new PointCollection();
// first point (lower-left corner)
points.Add(new System.Windows.Point(0, max));
// middle points
for (int i = 0; i < values.Length; i++)
{
points.Add(new System.Windows.Point(i, max - values[i]));
}
// last point (lower-right corner)
points.Add(new System.Windows.Point(values.Length - 1, max));
points.Freeze();
return points;
}
示例7: AddFigureToList
internal unsafe void AddFigureToList(bool isFilled, bool isClosed, MilPoint2F* pPoints, UInt32 pointCount, byte* pSegTypes, UInt32 segmentCount)
{
if (pointCount >=1 && segmentCount >= 1)
{
PathFigure figure = new PathFigure();
figure.IsFilled = isFilled;
figure.StartPoint = new Point(pPoints->X, pPoints->Y);
int pointIndex = 1;
int sameSegCount = 0;
for (int segIndex=0; segIndex<segmentCount; segIndex += sameSegCount)
{
byte segType = (byte)(pSegTypes[segIndex] & (byte)MILCoreSegFlags.SegTypeMask);
sameSegCount = 1;
// Look for a run of same-type segments for a PolyXXXSegment.
while (((segIndex + sameSegCount) < segmentCount) &&
(pSegTypes[segIndex] == pSegTypes[segIndex+sameSegCount]))
{
sameSegCount++;
}
bool fStroked = (pSegTypes[segIndex] & (byte)MILCoreSegFlags.SegIsAGap) == (byte)0;
bool fSmooth = (pSegTypes[segIndex] & (byte)MILCoreSegFlags.SegSmoothJoin) != (byte)0;
if (segType == (byte)MILCoreSegFlags.SegTypeLine)
{
if (pointIndex+sameSegCount > pointCount)
{
throw new System.InvalidOperationException(SR.Get(SRID.PathGeometry_InternalReadBackError));
}
if (sameSegCount>1)
{
PointCollection ptCollection = new PointCollection();
for (int i=0; i<sameSegCount; i++)
{
ptCollection.Add(new Point(pPoints[pointIndex+i].X, pPoints[pointIndex+i].Y));
}
ptCollection.Freeze();
PolyLineSegment polySeg = new PolyLineSegment(ptCollection, fStroked, fSmooth);
polySeg.Freeze();
figure.Segments.Add(polySeg);
}
else
{
Debug.Assert(sameSegCount == 1);
figure.Segments.Add(new LineSegment(new Point(pPoints[pointIndex].X, pPoints[pointIndex].Y), fStroked, fSmooth));
}
pointIndex += sameSegCount;
}
else if (segType == (byte)MILCoreSegFlags.SegTypeBezier)
{
int pointBezierCount = sameSegCount*3;
if (pointIndex+pointBezierCount > pointCount)
{
throw new System.InvalidOperationException(SR.Get(SRID.PathGeometry_InternalReadBackError));
}
if (sameSegCount>1)
{
PointCollection ptCollection = new PointCollection();
for (int i=0; i<pointBezierCount; i++)
{
ptCollection.Add(new Point(pPoints[pointIndex+i].X, pPoints[pointIndex+i].Y));
}
ptCollection.Freeze();
PolyBezierSegment polySeg = new PolyBezierSegment(ptCollection, fStroked, fSmooth);
polySeg.Freeze();
figure.Segments.Add(polySeg);
}
else
{
Debug.Assert(sameSegCount == 1);
figure.Segments.Add(new BezierSegment(
new Point(pPoints[pointIndex].X, pPoints[pointIndex].Y),
new Point(pPoints[pointIndex+1].X, pPoints[pointIndex+1].Y),
new Point(pPoints[pointIndex+2].X, pPoints[pointIndex+2].Y),
fStroked,
fSmooth));
}
pointIndex += pointBezierCount;
}
else
{
throw new System.InvalidOperationException(SR.Get(SRID.PathGeometry_InternalReadBackError));
}
}
//.........这里部分代码省略.........
示例8: ComputeConnectionPoints
/// <summary>
/// Rebuild connection points.
/// </summary>
private void ComputeConnectionPoints()
{
PointCollection computedPoints = new PointCollection();
computedPoints.Add(this.SourceConnectorHotspot);
double midPointX = this.SourceConnectorHotspot.X + ((this.DestConnectorHotspot.X - this.SourceConnectorHotspot.X) / 2);
computedPoints.Add(new Point(midPointX, this.SourceConnectorHotspot.Y));
computedPoints.Add(new Point(midPointX, this.DestConnectorHotspot.Y));
//Add an extra point to the curve that allows the line into the destination look visually pleasing.
const double precedingPoint = 2.5;
if ( (this.DestConnectorHotspot.X - precedingPoint) > midPointX)
computedPoints.Add(new Point(this.DestConnectorHotspot.X - precedingPoint, this.DestConnectorHotspot.Y));
computedPoints.Add(this.DestConnectorHotspot);
computedPoints.Freeze();
this.Points = computedPoints;
}