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


C# System.Drawing.Drawing2D.Matrix.Invert方法代码示例

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


在下文中一共展示了System.Drawing.Drawing2D.Matrix.Invert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCursor

        /// <summary>
        /// Return cursor for command
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="zoomLevel"></param>
        /// <returns>null if coordinates are not fine</returns>
        public Cursor GetCursor(float x, float y, System.Drawing.Drawing2D.Matrix viewMatrix)
        {
            // transform x,y back to object coordinates to check for selection
            System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix();
            mat.Multiply(this.TransformationMatrix, System.Drawing.Drawing2D.MatrixOrder.Append);
            mat.Multiply(this.Owner.DrawMatrix, System.Drawing.Drawing2D.MatrixOrder.Append);
            mat.Multiply(viewMatrix, System.Drawing.Drawing2D.MatrixOrder.Append);
            mat.Invert();

            PointF tmpPoint = new PointF(x, y);
            PointF[] points = new PointF[1];
            points[0] = tmpPoint;
            mat.TransformPoints(points);

            tmpPoint = points[0];
            // check if this item should be selected

            float w = (float)this.WidthInPixels / this.Owner.ViewMatrix.Elements[0];
            float h = (float)this.HeightInPixels / this.Owner.ViewMatrix.Elements[3];

            // if starting coordinate fall inside this component rect
            if (tmpPoint.X >= 0 && tmpPoint.X <= w && tmpPoint.Y >= 0 && tmpPoint.Y <= h)
            {
                return this.cursor;
            }
            else
            {
                return null;
            }
        }
开发者ID:visla,项目名称:PDFReporter,代码行数:37,代码来源:CommandItem.cs

示例2: CanBeSelected

        /// <summary>
        /// Check if this command can be selected and return true in case it can
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public bool CanBeSelected(float x, float y, System.Drawing.Drawing2D.Matrix viewMatrix)
        {
            // transform x,y back to object coordinates to check for selection
            System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix();
            mat.Multiply(this.TransformationMatrix, System.Drawing.Drawing2D.MatrixOrder.Append);
            mat.Multiply(this.Owner.DrawMatrix, System.Drawing.Drawing2D.MatrixOrder.Append);
            mat.Multiply(viewMatrix, System.Drawing.Drawing2D.MatrixOrder.Append);
            mat.Invert();

            PointF tmpPoint = new PointF(x, y);
            PointF[] points = new PointF[1];
            points[0] = tmpPoint;
            mat.TransformPoints(points);

            tmpPoint = points[0];
            // check if this item should be selected
            //float tmpX = LocationInPixelsX * zoomLevel;
            //float tmpY = LocationInPixelsY * zoomLevel;
            //float w = widthInPixels; //** zoomLevel;
            //float h = heightInPixels; //* zoomLevel;
            float w = (float)this.WidthInPixels / this.Owner.ViewMatrix.Elements[0];
            float h = (float)this.HeightInPixels / this.Owner.ViewMatrix.Elements[3];

            // if starting coordinate fall inside this component rect
            if (tmpPoint.X >= 0 && tmpPoint.X <= w && tmpPoint.Y >= 0 && tmpPoint.Y <= h)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:visla,项目名称:PDFReporter,代码行数:39,代码来源:CommandItem.cs

示例3: walk

        public virtual void walk(PathWalker walker, System.Drawing.Drawing2D.Matrix errorMatrix, double error)
        {
            //UPGRADE_TODO: Interface 'java.awt.geom.PathIterator' was converted to 'System.Drawing.Drawing2D.GraphicsPathIterator' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_3"'
            //UPGRADE_TODO: Method 'java.awt.Shape.getPathIterator' was converted to 'System.Drawing.Drawing2D.GraphicsPathIterator.GraphicsPathIterator' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtShapegetPathIterator_javaawtgeomAffineTransform_double_3"'
            System.Drawing.Drawing2D.GraphicsPathIterator itr = new System.Drawing.Drawing2D.GraphicsPathIterator(shape);
            double[] point = new double[6];
            int i = 0;
            System.Drawing.Drawing2D.Matrix inv;
            double m00, m01, m10, m11, dx, dy;

            try
            {
                System.Drawing.Drawing2D.Matrix temp_Matrix;
                temp_Matrix = new System.Drawing.Drawing2D.Matrix();
                temp_Matrix = errorMatrix.Clone();
                temp_Matrix.Invert();
                inv = temp_Matrix;
            }
            catch (System.Exception e)
            {
                return ;
            }

            m00 = (float) inv.Elements.GetValue(0);
            m01 = (float) inv.Elements.GetValue(2);
            m10 = (float) inv.Elements.GetValue(1);
            m11 = (float) inv.Elements.GetValue(3);
            dx = (System.Single) inv.OffsetX;
            dy = (System.Single) inv.OffsetY;

            //UPGRADE_ISSUE: Method 'java.awt.geom.PathIterator.isDone' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomPathIteratorisDone_3"'
            while (!itr.isDone())
            {
                //UPGRADE_ISSUE: Method 'java.awt.geom.PathIterator.currentSegment' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomPathIteratorcurrentSegment_double[]_3"'
                int type = itr.currentSegment(point);

                //UPGRADE_ISSUE: Method 'java.awt.geom.PathIterator.next' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomPathIteratornext_3"'
                itr.next();
                //UPGRADE_ISSUE: Field 'java.awt.geom.PathIterator.SEG_MOVETO' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomPathIteratorSEG_MOVETO_f_3"'
                if (type == PathIterator.SEG_MOVETO)
                {
                    if (i > 0)
                    {
                        walk(walker, points, i, false);
                        i = 0;
                    }
                    points[i++] = m00 * point[0] + m01 * point[1] + dx;
                    points[i++] = m10 * point[0] + m11 * point[1] + dy;
                }
                else
                {
                    //UPGRADE_ISSUE: Field 'java.awt.geom.PathIterator.SEG_LINETO' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomPathIteratorSEG_LINETO_f_3"'
                    if (type == PathIterator.SEG_LINETO)
                    {
                        points[i++] = m00 * point[0] + m01 * point[1] + dx;
                        points[i++] = m10 * point[0] + m11 * point[1] + dy;
                    }
                    else
                    {
                        //UPGRADE_ISSUE: Field 'java.awt.geom.PathIterator.SEG_CLOSE' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomPathIteratorSEG_CLOSE_f_3"'
                        if (type == PathIterator.SEG_CLOSE)
                        {
                            if (i > 0)
                            {
                                walk(walker, points, i, true);
                                i = 0;
                            }
                        }
                    }
                }
            }
            if (i > 0)
            {
                walk(walker, points, i, false);
                i = 0;
            }
        }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:77,代码来源:AWTShapePath.cs

示例4: TransformPoints

 /// <summary>
 /// use matrix to transform point
 /// </summary>
 /// <param name="pts">contain the points to be transformed</param>
 private void TransformPoints(Point[] pts)
 {
     System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix(
         1, 0, 0, 1, m_sizePictureBox.Width / 2, m_sizePictureBox.Height / 2);
     matrix.Invert();
     matrix.TransformPoints(pts);
 }
开发者ID:AMEE,项目名称:revit,代码行数:11,代码来源:Profile.cs

示例5: GraphicsView_MouseMove

        private void GraphicsView_MouseMove(object sender, MouseEventArgs e)
        {
            if (movestart == null) return;
            if (!TranslateFocus)
                return;
            System.Drawing.Drawing2D.Matrix m = new System.Drawing.Drawing2D.Matrix();
            //m.Translate(Translate.X, Translate.Y, System.Drawing.Drawing2D.MatrixOrder.Append);
            m.Scale(ZoomScale, ZoomScale, System.Drawing.Drawing2D.MatrixOrder.Append);
            m.Invert();

            Point movement = new Point(movestart.X - e.X, movestart.Y - e.Y);
            movement.X = -movement.X;
            movement.Y = -movement.Y;
            Point[] t = new Point[] { movement };
            m.TransformPoints(t);
            movement = t[0];

            Translate.X -= movestart.X - e.X;
            Translate.Y -= movestart.Y - e.Y;

            movestart = e.Location;

            HighPrecisionDraw = false;
            this.Refresh();
        }
开发者ID:skipme,项目名称:ComGraMet,代码行数:25,代码来源:GraphicsView.cs


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