当前位置: 首页>>代码示例>>C#>>正文


C# MatrixTransform.Transform方法代码示例

本文整理汇总了C#中System.Windows.Media.MatrixTransform.Transform方法的典型用法代码示例。如果您正苦于以下问题:C# MatrixTransform.Transform方法的具体用法?C# MatrixTransform.Transform怎么用?C# MatrixTransform.Transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.MatrixTransform的用法示例。


在下文中一共展示了MatrixTransform.Transform方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: Reset

        public void Reset()
        {
            mPoints = new List<Point>(defaultPoints);
            //randomize center
            double x = Util.Rand(0, Config.WindowWidth);
            double y = Util.Rand(0, Config.WindowHeight);
            mCenter = new Point(x,y);
            Util.BaitWithinWindow(ref mCenter);

            double angle = Util.Rand((int)0, (int)180);

            Matrix m = new Matrix(1, 0, 0, 1, 0, 0);
            m.Scale(mScale, mScale); 	//scale at (0,0)
            m.Rotate(angle); 			//rotate at (0,0)
            m.Translate(mCenter.X, mCenter.Y);

            MatrixTransform mt = new MatrixTransform(m);
            for (int i = 0; i < mPoints.Capacity; i++)
                mPoints[i] = mt.Transform(mPoints[i]);

            mPolygon.Points = new PointCollection(mPoints);
        }
开发者ID:kylchien,项目名称:Smart-Fish,代码行数:22,代码来源:Bait.cs

示例4: GetResolution

        /// <summary>
        /// Gets the resolution in DPI of the target device of a visual.
        /// </summary>
        public static Point GetResolution(Visual visual)
        {
            Point dpi = new Point(120, 120);

            PresentationSource source = PresentationSource.FromVisual(visual);
            if (source == null)
                return dpi;

            CompositionTarget target = source.CompositionTarget;

            Matrix m = target.TransformToDevice;
            MatrixTransform t = new MatrixTransform(m);

            Point pt1 = new Point(0, 0);
            pt1 = t.Transform(pt1);

            Point pt2 = new Point(96, 96);
            pt2 = t.Transform(pt2);

            dpi.X = pt2.X - pt1.X;
            dpi.Y = pt2.Y - pt1.Y;
            return dpi;
        }
开发者ID:wolfoerster,项目名称:WFTools3D,代码行数:26,代码来源:Utils.cs

示例5: OnRender

        protected override void OnRender(DrawingContext dc)
        {
            // Draw background
            dc.DrawRectangle(Brushes.White, null, new Rect(RenderSize));

            Transform t = new MatrixTransform(TheModel.GetTikzToScreenTransform().ToWpfMatrix());
            t.Freeze();

            Pen pen = new Pen(Brushes.WhiteSmoke, 1);
            pen.Freeze();

            TheModel.DrawRaster(
                (p1, p2) => dc.DrawLine(pen, t.Transform(p1), t.Transform(p2)),
                (r1, r2) =>
                {
                    EllipseGeometry eg = new EllipseGeometry(new Point(0, 0), r1, r2);
                    eg.Transform = t;
                    eg.Freeze();
                    dc.DrawGeometry(null, pen, eg);
                });

        }
开发者ID:JoeyEremondi,项目名称:tikzedt,代码行数:22,代码来源:RasterControl.xaml.cs

示例6: Manipulation

 void Manipulation(ManipulationDeltaEventArgs e)
 {
     var mt = new MatrixTransform(ShapeUtils.GetTransform(e));
     var newTopLeft = mt.Transform(getBadgePos());
     setBadgePos(newTopLeft.X, newTopLeft.Y);                 
 }
开发者ID:gdlprj,项目名称:duscusys,代码行数:6,代码来源:VdBadge.cs


注:本文中的System.Windows.Media.MatrixTransform.Transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。