本文整理汇总了C#中System.Windows.Media.Transform.Transform方法的典型用法代码示例。如果您正苦于以下问题:C# Transform.Transform方法的具体用法?C# Transform.Transform怎么用?C# Transform.Transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Transform
的用法示例。
在下文中一共展示了Transform.Transform方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderUnfilledElements
public void RenderUnfilledElements(DrawingContext ctx, Rect chartArea, Transform transform) {
for(int segmentIndex = 0; segmentIndex < _lineColors.Count; ++segmentIndex) {
SolidColorBrush brush = new SolidColorBrush(_lineColors[segmentIndex]);
Pen pen = new Pen(brush, LineThickness);
pen.LineJoin = PenLineJoin.Bevel;
if(IsDashed) {
pen.DashStyle = new DashStyle(new double[] { 2, 2 }, 0);
}
ctx.DrawLine(pen, transform.Transform(Points[segmentIndex*2]), transform.Transform(Points[segmentIndex*2+1]));
}
}
示例2: ResourcesVisual
public ResourcesVisual(MapOctree snapshot, Func<MapOctree, double> getValue, Color color, Transform transform)
{
//const double STANDARDAREA = 1000000;
const double STANDARDAREA = 750000;
//TODO: Use this to get a normalization multiplier
double totalArea = (snapshot.MaxRange.X - snapshot.MinRange.X) * (snapshot.MaxRange.Y - snapshot.MinRange.Y);
double valueMult = totalArea / STANDARDAREA;
_visual = new DrawingVisual();
using (DrawingContext dc = _visual.RenderOpen())
{
foreach (MapOctree node in snapshot.Descendants(o => o.Children))
{
if (node.Items == null)
{
continue;
}
// Get the color
Brush brush = GetBrush(node, getValue, valueMult, color);
if (brush == null)
{
continue;
}
// Define the rectangle
Point min = transform.Transform(new Point(node.MinRange.X, -node.MinRange.Y)); // need to negate Y
Point max = transform.Transform(new Point(node.MaxRange.X, -node.MaxRange.Y));
double x = min.X;
double y = max.Y; // can't use min, because Y is backward
double width = max.X - min.X;
double height = Math.Abs(max.Y - min.Y); // Y is all flipped around
// Fill the box
dc.DrawRectangle(brush, null, new Rect(x, y, width, height));
}
}
}
示例3: Transform
/// <summary>
/// Transforms the specified point and returns the result.
/// </summary>
/// <param name="point">The point.</param>
/// <param name="transform">The transform.</param>
/// <returns></returns>
public static System.Windows.Point Transform(this System.Windows.Point point, Transform transform)
{
return transform.Transform(point);
}
示例4: GetDestinationDimensions
/// <summary>
/// Returns the dimensions of the output image.
/// </summary>
/// <param name="source">The source image.</param>
/// <param name="width">The desired width of the output image.</param>
/// <param name="height">The desired height of the output image.</param>
/// <returns><c>true</c> if the destination image should be created; otherwise <c>false</c>.
/// The <see cref="RotationFilter" /> will only create the destination image
/// if the <see cref="RotationFilter.Angle" /> property is not 0.</returns>
protected override bool GetDestinationDimensions(FastBitmap source, out int width, out int height)
{
if (Angle == 0)
{
width = height = 0;
return false;
}
// get the current rectangle points
Point[] points = new[]
{
new Point(0, 0),
new Point(source.Width, 0),
new Point(0, source.Height),
new Point(source.Width, source.Height)
};
// Transform corner points into rotated position.
_rotateTransform = new RotateTransform(Angle, source.Width / 2.0, source.Height / 2.0);
for (int i = 0; i < points.Length; ++i)
points[i] = _rotateTransform.Transform(points[i]);
// Calculate bounds of new rectangle.
Rect rect = Rect.Empty;
for (int i = 0; i < 4; i++)
rect = Rect.Union(rect, points[i]);
// Reset the points to a 0,0 base
for (int i = 0; i < 4; i++)
{
points[i].X -= rect.Left;
points[i].Y -= rect.Top;
}
width = (int) rect.Width;
height = (int) rect.Height;
return true;
}
示例5: Point
TransformLength
(
Double length,
Transform transform,
Boolean transformAlongX
)
{
Debug.Assert(transform != null);
Point oPoint;
if (transformAlongX)
{
oPoint = new Point(length, 0);
}
else
{
oPoint = new Point(0, length);
}
oPoint = transform.Transform(oPoint);
return (transformAlongX ? oPoint.X : oPoint.Y);
}
示例6: PopMatrix
public void PopMatrix()
{
_CurrentTransform = new MatrixTransform(_Matrixes.Pop());
_Origin = _CurrentTransform.Transform(new Point(0, 0));
}
示例7: AssertValid
TransformPoints
(
Transform oTransform,
Point [] ao4BoundingPoints
)
{
Debug.Assert(oTransform != null);
Debug.Assert(ao4BoundingPoints != null);
Debug.Assert(ao4BoundingPoints.Length == 4);
AssertValid();
for (Int32 i = 0; i < 4; i++)
{
ao4BoundingPoints[i] =
oTransform.Transform( ao4BoundingPoints[i] );
}
}