本文整理汇总了C#中System.Windows.Media.MatrixTransform类的典型用法代码示例。如果您正苦于以下问题:C# MatrixTransform类的具体用法?C# MatrixTransform怎么用?C# MatrixTransform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatrixTransform类属于System.Windows.Media命名空间,在下文中一共展示了MatrixTransform类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Generate
public static List<Point> Generate(int n = 1000, double width = 1.0, double height = 1.0)
{
// Probabilities
double[] p = {0.85, .92, .99, 1.00};
// Transformations
var a1 = new MatrixTransform(new Matrix(0.85, -0.04, 0.04, 0.85, 0, 1.6));
var a2 = new MatrixTransform(new Matrix(0.20, 0.23, -0.26, 0.22, 0, 1.6));
var a3 = new MatrixTransform(new Matrix(-0.15, 0.26, 0.28, 0.24, 0, 0.44));
var a4 = new MatrixTransform(new Matrix(0, 0, 0, 0.16, 0, 0));
var random = new Random();
var point = new Point(0.5, 0.5);
var points = new List<Point>();
// Transformation for [-3,3,0,10] => output coordinates
var T = new MatrixTransform(new Matrix(width/6.0, 0, 0, -height/10.1, width/2.0, height));
for (int i = 0; i < n; i++)
{
var r = random.NextDouble();
if (r < p[0])
point = a1.Transform(point);
else if (r < p[1])
point = a2.Transform(point);
else if (r < p[2])
point = a3.Transform(point);
else
point = a4.Transform(point);
points.Add(T.Transform(point));
}
return points;
}
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:34,代码来源:Fern.cs
示例2: CanvasEx
public CanvasEx()
:base()
{
ClipToBounds = true;
_transform = (MatrixTransform)MatrixTransform.Identity;
_translate = new TranslateTransform(-Offset.X, -Offset.Y);
}
开发者ID:seancyw,项目名称:dev-center,代码行数:7,代码来源:CanvasEx.cs
示例3: Set
public void Set ()
{
MatrixTransform mt = new MatrixTransform ();
mt.Matrix = new Matrix (1, 2, 3, 4, 5, 6);
MatrixTest.CheckMatrix (mt.Matrix, 1, 2, 3, 4, 5, 6, "custom");
Assert.IsFalse (mt.Matrix.IsIdentity, "IsNotIdentity");
}
开发者ID:dfr0,项目名称:moon,代码行数:7,代码来源:MatrixTransformTest.cs
示例4: Value_Matrix
public void Value_Matrix (bool refresh)
{
MatrixTransform mt = new MatrixTransform ();
TransformGroup tg = new TransformGroup ();
tg.Children.Add (mt);
Assert.AreEqual (1, tg.Children.Count, "Children-1");
Assert.IsTrue (tg.Value.IsIdentity, "IsIdentity-1");
mt.Matrix = new Matrix (2.0, 0.0, 0.0, 0.5, 0.0, 0.0);
Assert.AreEqual (1, tg.Children.Count, "Children-2");
// update was made inside TransformGroup...
Assert.IsFalse ((tg.Children [0] as MatrixTransform).Matrix.IsIdentity, "IsIdentity-2");
if (refresh) {
// ... but Value is not refreshed if changed "indirectly" ...
Assert.IsTrue (tg.Value.IsIdentity, "IsIdentity-3");
Assert.IsFalse (mt.Matrix.Equals (tg.Value), "Matrix-3");
}
// ... unless the collection is changed
tg.Children.Add (new MatrixTransform ());
Assert.AreEqual (2, tg.Children.Count, "Children-4");
Assert.IsTrue (mt.Matrix.Equals (tg.Value), "Matrix-4");
}
开发者ID:dfr0,项目名称:moon,代码行数:25,代码来源:TransformGroupTest.cs
示例5: DrawingState
private double _baseGuidelineY; // the Y guideline of the text line.
/// <summary>
/// Construct drawing state for full text
/// </summary>
internal DrawingState(
DrawingContext drawingContext,
Point lineOrigin,
MatrixTransform antiInversion,
TextMetrics.FullTextLine currentLine
)
{
_drawingContext = drawingContext;
_antiInversion = antiInversion;
_currentLine = currentLine;
if (antiInversion == null)
{
_lineOrigin = lineOrigin;
}
else
{
_vectorToLineOrigin = lineOrigin;
}
if (_drawingContext != null)
{
// LineServices draws GlyphRun and TextDecorations in multiple
// callbacks and GlyphRuns may have different baselines. Pushing guideline
// for each DrawGlyphRun are too costly. We optimize for the common case where
// GlyphRuns and TextDecorations in the TextLine share the same baseline.
_baseGuidelineY = lineOrigin.Y + currentLine.Baseline;
_drawingContext.PushGuidelineY1(_baseGuidelineY);
}
}
开发者ID:JianwenSun,项目名称:cc,代码行数:36,代码来源:DrawingState.cs
示例6: AdornerCursorCoordinateDrawer
// ********************************************************************
// Public Methods
// ********************************************************************
#region Public Methods
/// <summary>
/// Constructor. Initializes class fields.
/// </summary>
public AdornerCursorCoordinateDrawer(XYLineChart xyLineChart, UIElement adornedElement, MatrixTransform shapeTransform)
: base(adornedElement)
{
elementTransform = shapeTransform;
IsHitTestVisible = false;
this.xyLineChart = xyLineChart;
}
开发者ID:anddudek,项目名称:anjlab.fx,代码行数:15,代码来源:AdornerCursorCoordinateDrawer.cs
示例7: WpfMultiChart
public WpfMultiChart()
{
InitializeComponent();
LoadImages();
//do not show no data label by default
ShowNoDataLabel(false);
dataSeries = new List<TimeSeriesData>();
plotSeries = new TimeSeriesData();
shapeTransform = new MatrixTransform();
chartClip = new PathGeometry();
optimalGridLineSpacing = new Point(100, 50);
adorner = new AdornerCursor2(ChartInteractiveCanvas, shapeTransform);
adorner.CanvasSize = new Size(ChartInteractiveCanvas.ActualWidth, ChartInteractiveCanvas.ActualHeight);
adorner.PanCursorImage = panCursor;
panZoomCalculator = new PanZoomCalculator();
ChartCanvas.SizeChanged += new SizeChangedEventHandler(ChartCanvas_SizeChanged);
ChartCanvas.IsVisibleChanged += new DependencyPropertyChangedEventHandler(ChartCanvas_IsVisibleChanged);
NoDataLabel.MouseMove += new MouseEventHandler(NoDataLabel_MouseMove);
AttachEventsToCanvas(ChartInteractiveCanvas);
ResizeChart();
}
开发者ID:jamesjrg,项目名称:taipan,代码行数:29,代码来源:WpfMultiChart.xaml.cs
示例8: StreamGeometryFromCurve
public static StreamGeometry StreamGeometryFromCurve(Curve curve, MatrixTransform graphToCanvas)
{
double[] tempX;
double[] tempY;
if (graphToCanvas != null)
{
tempX = curve.xTransformed.MultiplyBy(graphToCanvas.Matrix.M11).SumWith(graphToCanvas.Matrix.OffsetX);
tempY = curve.yTransformed.MultiplyBy(graphToCanvas.Matrix.M22).SumWith(graphToCanvas.Matrix.OffsetY);
}
else
{
tempX = curve.xTransformed; tempY = curve.yTransformed;
}
StreamGeometry streamGeometry = new StreamGeometry();
StreamGeometryContext context = streamGeometry.Open();
int lines = 0;
for (int i = 0; i < curve.x.Count(); ++i)
{
if (i == 0)
{
context.BeginFigure(new Point(tempX[i], tempY[i]), false, false);
}
else
{
if (curve.includeLinePoint[i])
{
context.LineTo(new Point(tempX[i], tempY[i]), true, false);
lines++;
}
}
}
context.Close();
return streamGeometry;
}
开发者ID:irriss,项目名称:IronPlot.net,代码行数:34,代码来源:LineGeometries.cs
示例9: GetTransformedFigureCollection
internal override PathFigureCollection GetTransformedFigureCollection(Transform transform)
{
// Combine the transform argument with the internal transform
Transform combined = new MatrixTransform(GetCombinedMatrix(transform));
PathFigureCollection result = new PathFigureCollection();
GeometryCollection children = Children;
if (children != null)
{
for (int i = 0; i < children.Count; i++)
{
PathFigureCollection pathFigures = children.Internal_GetItem(i).GetTransformedFigureCollection(combined);
if (pathFigures != null)
{
int count = pathFigures.Count;
for (int j = 0; j < count; ++j)
{
result.Add(pathFigures[j]);
}
}
}
}
return result;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:26,代码来源:GeometryGroup.cs
示例10: ResetTransformations
public void ResetTransformations()
{
_ImageTransform = new MatrixTransform();
_ImageControl.RenderTransform = ImageTransform;
CenterImage();
}
开发者ID:aert,项目名称:aert-csharp-extensions,代码行数:7,代码来源:TouchImageHelper.cs
示例11: VisualHost
public VisualHost(MatrixTransform graphToCanvas)
{
this.graphToCanvas = graphToCanvas;
curveList = new List<Curve>();
_children = new VisualCollection(this);
//curveGeometry = curve.ToStreamGeometry();
//_children.Add(drawingVisual);
}
开发者ID:goutkannan,项目名称:ironlab,代码行数:8,代码来源:VisualHost.cs
示例12: GetVideoWithFlipHorizontal
/// <summary>
/// 取得水平翻转的视频捕获
/// </summary>
/// <param name="with"></param>
/// <param name="height"></param>
/// <returns></returns>
public Rectangle GetVideoWithFlipHorizontal(int with, int height)
{
Rectangle rctg = GetVideo(with, height);
MatrixTransform mTransform = new MatrixTransform();
mTransform.Matrix = new Matrix(-1, 0, 0, 1, with, 0);
rctg.RenderTransform = mTransform;
return rctg;
}
开发者ID:hoshealee,项目名称:balabalaDemo,代码行数:14,代码来源:Camera.cs
示例13: PositionGeometry
public static void PositionGeometry(XamlShapes.Shape renderedGeometry, IViewport viewport)
{
CounterScaleLineWidth(renderedGeometry, viewport.Resolution);
var matrixTransform = new XamlMedia.MatrixTransform {Matrix = CreateTransformMatrix1(viewport)};
renderedGeometry.RenderTransform = matrixTransform;
if (renderedGeometry.Fill != null)
renderedGeometry.Fill.Transform = matrixTransform.Inverse as XamlMedia.MatrixTransform;
}
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:9,代码来源:GeometryRenderer.cs
示例14: Create
protected void Create(UIElement element, bool wantsCache, bool wantsTransform)
{
if(wantsTransform)
element.RenderTransform = transform = new SWM.MatrixTransform();
if(wantsCache)
element.CacheMode = new SWM.BitmapCache();
canvas.Children.Add(element);
}
开发者ID:mikairi,项目名称:SoshiLand,代码行数:10,代码来源:Sprite.cs
示例15: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/Invista.Game2;component/Sprite.xaml", System.UriKind.Relative));
this.MatrixElement = ((System.Windows.Media.MatrixTransform)(this.FindName("MatrixElement")));
this.RotationElement = ((System.Windows.Media.RotateTransform)(this.FindName("RotationElement")));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.ContentElement = ((System.Windows.Controls.ContentPresenter)(this.FindName("ContentElement")));
}
开发者ID:felipepimentel,项目名称:Ploc-Ploc,代码行数:11,代码来源:Sprite.g.i.cs
示例16: TechnoControl
public TechnoControl()
{
this.InitializeComponent();
tableTransform = new MatrixTransform(Matrix.Identity);
this.RenderTransform = tableTransform;
this.RenderTransformOrigin = new Point(0.5, 0.5);
Activated = false;
LayoutRoot.IsVisibleChanged += LayoutRootIsVisibleChanged;
}
开发者ID:smalice,项目名称:TechnologyVision,代码行数:11,代码来源:TechnoControl.xaml.cs
示例17: Manipulation
void Manipulation(ManipulationDeltaEventArgs e)
{
var mt = new MatrixTransform(ShapeUtils.GetTransform(e));
var Point1 = mt.Transform(new Point(line.X1, line.Y1));
var Point2 = mt.Transform(new Point(line.X2, line.Y2));
line.X1 = Point1.X;
line.Y1 = Point1.Y;
line.X2 = Point2.X;
line.Y2 = Point2.Y;
}
开发者ID:gdlprj,项目名称:duscusys,代码行数:11,代码来源:VdSegment.cs
示例18: GeometryHitTestParameters
/// <summary>
/// The constructor takes the geometry to hit test with.
/// </summary>
public GeometryHitTestParameters(Geometry geometry) : base()
{
// This ctor guarantees that we are initialized in the following way:
//
// 1. The geometry provided by the user is unmodified
// 2. _hitGeometryInternal is a PathGeometry equivilent to the supplied geometry
// 3. _hitGeometryInternal.Tranform is a MatrixTransform equivilent to the supplied
// geometry.Transform
// 4. _origBounds is the untransformed bounds of the _hitGeometryInternal (inner space).
// 5. _bounds is the transformed bounds of the _hitGeometryInternal (outer space).
// 6. _matrixStack is an empty stack.
if (geometry == null)
{
throw new ArgumentNullException("geometry");
}
// Convert the Geometry to an equivilent PathGeometry up front to prevent
// conversion on every call to DoesContainWithDetail. If the geometry is
// animate this also has the side effect of eliminating animation interplay.
_hitGeometryInternal = geometry.GetAsPathGeometry();
// If GetAsPathGeometry was a no-op, force the copy because we do not
// went to modify the user's Geometry.
if (object.ReferenceEquals(_hitGeometryInternal, geometry))
{
_hitGeometryInternal = _hitGeometryInternal.Clone();
}
// Convert _hitGeometryInternal.Transform to an equivilent MatrixTransform
// so that we can aggregate in PushMatrix/PopMatrix without building a
// TransformCollection.
Transform origTransform = _hitGeometryInternal.Transform;
MatrixTransform newTransform = new MatrixTransform();
_hitGeometryInternal.Transform = newTransform;
// Before we initialize MatrixTransform.Matrix, cache the bounds of this
// geometry without any transforms.
_origBounds = _hitGeometryInternal.Bounds;
// If we had a non-Identity transform, update our MatrixTransform.Matrix
// with its Value. (Note that when GetAsPathGeometry *isn't* a no-op
// it applies the transform to the figures and returns with a Geometry
// with an identity Transform.)
if (origTransform != null && !origTransform.IsIdentity)
{
newTransform.Matrix = origTransform.Value;
}
// Initialize the current transformed bounds of this Geometry
_bounds = _hitGeometryInternal.Bounds;
_matrixStack = new MatrixStack();
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:57,代码来源:GeometryHitTestParameters.cs
示例19: MainWindow
public MainWindow()
{
InitializeComponent();
this.DataContext = dataContainer;
shapeContainer = new CanvasShapeContainer();
transform = new MatrixTransform();
tempForm = new Path();
newShapeIndex = 0;
composite = new ShapeComposite();
}
开发者ID:karinmae,项目名称:Paint,代码行数:12,代码来源:MainWindow.xaml.cs
示例20: DLMatrixAnimation
public DLMatrixAnimation(Matrix fromValue, Matrix toValue, Duration duration, Action<object> frameCallback, IEasingFunction easingFunction = null)
{
FrameCallback = frameCallback;
_matrixTransform = new MatrixTransform();
_matrixAnimation = new MatrixAnimation(fromValue, toValue, duration);
if(easingFunction != null)
{
_matrixAnimation.EasingFunction = easingFunction;
}
_matrixAnimation.Completed += (sender, args) =>
{
FrameCallback(_matrixAnimation.To);
_matrixTransform.BeginAnimation(MatrixTransform.MatrixProperty, null);
};
}
开发者ID:deurell,项目名称:Curla,代码行数:15,代码来源:DLMatrixAnimation.cs
注:本文中的System.Windows.Media.MatrixTransform类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论