System.Drawing.Drawing2D.Matrix.Clone C# (CSharp) Method

Clone() public method

public Clone ( ) : Matrix
return Matrix
        public Matrix Clone()
        {
            var copy = new Matrix ();
            copy.transform = transform;

            return copy;
        }

Usage Example

Example #1
0
        public static void SetGraphTransform(Graph graph, Graphics graphics)
        {
            var pen = new Pen(Brushes.Black);

            using (System.Drawing.Drawing2D.Matrix m = graphics.Transform)
            {
                using (System.Drawing.Drawing2D.Matrix saveM = m.Clone())
                {
                    foreach (Microsoft.Msagl.Drawing.Node node in graph.Nodes)
                    {
                        graphics.SetClip(FillTheGraphicsPath(node.GeometryNode.BoundaryCurve));
                        using (var m2 = new System.Drawing.Drawing2D.Matrix(1, 0, 0, -1, 0, 2 * (float)node.GeometryNode.Center.Y))
                            m.Multiply(m2);
                        graphics.DrawLine(pen, PointF(node.GeometryNode.Center),
                                          PointF(new Microsoft.Msagl.Core.Geometry.Point((int)node.GeometryNode.Center.X + 20,
                                                                                         (int)node.GeometryNode.Center.Y + 20)));
                        graphics.Transform = m;
                        graphics.Transform = saveM;
                        graphics.ResetClip();
                    }
                }
            }

            /*
             * //instead of setting transormation for graphics it is possible to transform the geometry graph, just to test that GeometryGraph.Transform() works
             *
             * var planeTransformation=new PlaneTransformation(scale,0,dx, 0, scale, dy);
             * geometryGraph.Transform(planeTransformation);
             */
            // graphics.Transform = new Matrix((float)scale, 0, 0, (float)scale, (float)dx, (float)dy);
        }
All Usage Examples Of System.Drawing.Drawing2D.Matrix::Clone