• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Drawing2D.Matrix类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: InitializeMap

        public static SharpMap.Map InitializeMap(float angle)
        {
            using (var ofn = new System.Windows.Forms.OpenFileDialog())
            {
                ofn.Filter = "All files|*.*";
                ofn.FilterIndex = 0;

                if (ofn.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    var m = new SharpMap.Map();
                    var l = new SharpMap.Layers.GdiImageLayer(ofn.FileName);
                    m.Layers.Add(l);

                    m.ZoomToExtents();

                    var mat = new System.Drawing.Drawing2D.Matrix();
                    mat.RotateAt(angle, m.WorldToImage(m.Center));
                    m.MapTransform = mat;
                    m.MaximumExtents = m.GetExtents();
                    m.EnforceMaximumExtents = true;
                    return m;
                }
            }
            return null;

        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:26,代码来源:GdiImageLayerSample.cs


示例2: DrawVerticalScaleGrid

        /// <summary>
        /// Draws grid lines corresponding to a vertical scale</summary>
        /// <param name="g">The Direct2D graphics object</param>
        /// <param name="transform">Graph (world) to window's client (screen) transform</param>
        /// <param name="graphRect">Graph rectangle</param>
        /// <param name="majorSpacing">Scale's major spacing</param>
        /// <param name="lineBrush">Grid line brush</param>
        public static void DrawVerticalScaleGrid(
            this D2dGraphics g,
            Matrix transform,
            RectangleF graphRect,
            int majorSpacing,
            D2dBrush lineBrush)
        {
            double xScale = transform.Elements[0];
            RectangleF clientRect = Transform(transform, graphRect);

            double min = Math.Min(graphRect.Left, graphRect.Right);
            double max = Math.Max(graphRect.Left, graphRect.Right);
            double tickAnchor = CalculateTickAnchor(min, max);
            double step = CalculateStep(min, max, Math.Abs(clientRect.Right - clientRect.Left), majorSpacing, 0.0);
            if (step > 0)
            {
                double offset = tickAnchor - min;
                offset = offset - MathUtil.Remainder(offset, step) + step;
                for (double x = tickAnchor - offset; x <= max; x += step)
                {
                    double cx = (x - graphRect.Left) * xScale + clientRect.Left;
                    g.DrawLine((float)cx, clientRect.Top, (float)cx, clientRect.Bottom, lineBrush);
                }
            }
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:32,代码来源:D2dUtil.cs


示例3: DoPaintRemote

 public void DoPaintRemote(PaintEventArgs e)
 {
     var matrix = new System.Drawing.Drawing2D.Matrix();
     matrix.Translate(this.Left, this.Top);
     e.Graphics.Transform = matrix;
     OnPaint(e);
 }
开发者ID:jackmaynard,项目名称:MissionPlanner,代码行数:7,代码来源:DistanceBar.cs


示例4: ConvertMatrix

 /// <summary>
 /// Converts the matrix.
 /// </summary>
 /// <param name="MediaMatrix">The media matrix.</param>
 /// <returns></returns>
 public static dm ConvertMatrix(mm MediaMatrix)
 {
     var ret = new dm((float) MediaMatrix.M11, (float) MediaMatrix.M12, (float) MediaMatrix.M21,
         (float) MediaMatrix.M22, (float) MediaMatrix.OffsetX,
         (float) MediaMatrix.OffsetY);
     return ret;
 }
开发者ID:andreigec,项目名称:ANDREICSLIB,代码行数:12,代码来源:MathExtras.cs


示例5: Area_Paint

        /// <summary>
        /// Draw all areas of the selected quest and highlight the selected area.
        /// </summary>
        private void Area_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.Clear(Area.BackColor);

            Matrix transformMatrix = new Matrix();
            transformMatrix.Rotate(90);
            transformMatrix.Multiply(new Matrix(-1, 0, 0, 1, 0, 0)); // Flip x-axis

            WoWQuestStep[] steps = ((QuestDisplayData)bsQuests.Current).Steps;

            float maxX = steps.Max(step => step.AreaPoints.Max(ap => ap.X));
            float maxY = steps.Max(step => step.AreaPoints.Max(ap => ap.Y));

            transformMatrix.Translate(-maxX - 5, -maxY - 5);

            e.Graphics.Transform = transformMatrix;

            // Draw all areas
            foreach (WoWQuestStep step in steps)
            {
                PointF[] drawPoints = ConvertToDrawingPoints(step.AreaPoints);
                if (drawPoints.Length < 3)
                {
                    foreach (PointF point in drawPoints)
                    {
                        // Draw a point 5x5 pixels
                        e.Graphics.FillEllipse(AREA_FILL, point.X - 2, point.Y - 2, 5F, 5F);
                        e.Graphics.DrawEllipse(AREA_BORDER, point.X - 2, point.Y - 2, 5F, 5F);
                    }
                }
                else
                {
                    e.Graphics.FillPolygon(AREA_FILL, drawPoints);
                    e.Graphics.DrawPolygon(AREA_BORDER, drawPoints);
                }
            }

            // Highlight selected area
            if (SelectedAreaPoints != null)
            {
                if (SelectedAreaPoints.Length < 3)
                {
                    foreach (PointF point in SelectedAreaPoints)
                    {
                        e.Graphics.FillEllipse(AREA_HIGHLIGHT, point.X - 2, point.Y - 2, 5F, 5F);
                        e.Graphics.DrawEllipse(AREA_BORDER, point.X - 2, point.Y - 2, 5F, 5F);
                    }
                }
                else
                {
                    e.Graphics.FillPolygon(AREA_HIGHLIGHT, this.SelectedAreaPoints);
                    e.Graphics.DrawPolygon(AREA_BORDER, this.SelectedAreaPoints);
                }
            }
        }
开发者ID:Sanjo,项目名称:Honorbuddy-QuestPOI,代码行数:58,代码来源:FormQuestView.cs


示例6: InitializeMap

        public static SharpMap.Map InitializeMap(int angle, string[] filenames)
        {
            var map = new SharpMap.Map();
            for (int i = 0; i < filenames.Length; i++)
                map.Layers.Add(new SharpMap.Layers.GdalRasterLayer(System.IO.Path.GetFileName(filenames[i]), filenames[i]));

            System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix();
            mat.RotateAt(angle, map.WorldToImage(map.Center));
            map.MapTransform = mat;
            map.ZoomToExtents();
            return map;
        }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:12,代码来源:GdalSample.cs


示例7: Map

		/// <summary>
		/// Initializes a new map
		/// </summary>
		/// <param name="size">Size of map in pixels</param>
		public Map(System.Drawing.Size size)
		{
			this.Size = size;
			this.Layers = new List<SharpMap.Layers.ILayer>();
			this.BackColor = System.Drawing.Color.Transparent;
			this._MaximumZoom = double.MaxValue;
			this._MinimumZoom = 0;
			_MapTransform = new System.Drawing.Drawing2D.Matrix();
			MapTransformInverted = new System.Drawing.Drawing2D.Matrix();
			_Center = new SharpMap.Geometries.Point(0, 0);
			_Zoom = 1;
			_PixelAspectRatio = 1.0;
		}		
开发者ID:diegowald,项目名称:intellitrack,代码行数:17,代码来源:Map.cs


示例8: Map

		/// <summary>
		/// Initializes a new map
		/// </summary>
		/// <param name="size">Size of map in pixels</param>
		public Map(System.Drawing.Size size)
		{
			this.Size = size;
            this.Layers = new SharpMap.Layers.LayerCollection();
			this.BackColor = System.Drawing.Color.Transparent;
			this._MaximumZoom = double.MaxValue;
			this._MinimumZoom = 0;
			_MapTransform = new System.Drawing.Drawing2D.Matrix();
			MapTransformInverted = new System.Drawing.Drawing2D.Matrix();
			_Center = SharpMap.Converters.Geometries.GeometryFactory.CreateCoordinate(0, 0);
			_Zoom = 1;
			_PixelAspectRatio = 1.0;
		}		
开发者ID:lishxi,项目名称:_SharpMap,代码行数:17,代码来源:Map.cs


示例9: Save

        internal override void Save(FlowChartModel model)
        {
            float ZoomFactor = 4.0f;

            using (Bitmap bmp = new Bitmap((int)(601*ZoomFactor), (int)(851*ZoomFactor)))
            {
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    System.Drawing.Drawing2D.Matrix mx = new System.Drawing.Drawing2D.Matrix(ZoomFactor, 0, 0, ZoomFactor, 0, 0);                    
                    g.Transform = mx;

                    g.PageUnit = GraphicsUnit.Pixel;
                    g.Clear(Color.White);
                    g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                    g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                    g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
                    
                    model.Items.ForEach(x =>
                    {
                        x.View.Draw(g);
                    });

                    g.Save();

                    ImageFormat fm = ImageFormat.Bmp;
                    if (Path.GetExtension(fileName).ToLower() == ".png")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Png;
                    }
                    else if (Path.GetExtension(fileName).ToLower() == ".jpg")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Jpeg;
                    }
                    else if (Path.GetExtension(fileName).ToLower() == ".jpeg")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Jpeg;
                    }
                    else if (Path.GetExtension(fileName).ToLower() == ".gif")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Gif;
                    }
                    else if (Path.GetExtension(fileName).ToLower() == ".tiff")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Tiff;
                    }
                    bmp.Save(fileName, fm);
                }
            }
        }
开发者ID:JackWangCUMT,项目名称:FlowChart,代码行数:49,代码来源:ImageStorage.cs


示例10: InitializeTransformMatrix

        protected override bool InitializeTransformMatrix()
        {
            if (this.CurveList == null)
             {
            this.IsInitialized = false;
            InvalidSerieException e = new InvalidSerieException("No data to display...");
            StockLog.Write(e);
            throw e;
             }
             if (this.GraphRectangle.Height > 0)
             {
            EventSeries.Clear();

            // Create fake Event Series;
            for (int i = 0; i < 5; i++)
            {
               EventSeries.Add(new BoolSerie(this.EndIndex, "Test" + i, i%2 == 0));
            }

            minValue = 0.0f;
            maxValue = EventSeries.Count + 1;

            if (graphic == null)
            {
               // Initialise graphics
               this.graphic = this.CreateGraphics();
               RectangleF rect = this.graphic.VisibleClipBounds;
               rect.Inflate(new SizeF(-this.XMargin, -this.YMargin));
               this.GraphRectangle = rect;
            }

            float coefX = (this.GraphRectangle.Width * 0.96f) / (EndIndex - StartIndex);
            float coefY = this.GraphRectangle.Height / (maxValue - minValue);

            matrixValueToScreen = new System.Drawing.Drawing2D.Matrix();
            matrixValueToScreen.Translate(this.GraphRectangle.X - (StartIndex - 0.5f) * coefX, maxValue * coefY + this.GraphRectangle.Y);
            matrixValueToScreen.Scale(coefX, -coefY);

            matrixScreenToValue = (System.Drawing.Drawing2D.Matrix)matrixValueToScreen.Clone();
            matrixScreenToValue.Invert();
             }
             else
             {
            this.Deactivate("App too small...", false);
            return false;
             }
             return true;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:48,代码来源:GraphMutiTimeFrameControl.cs


示例11: InitializeTransformMatrix

        protected override bool InitializeTransformMatrix()
        {
            if (this.CurveList == null)
             {
            this.IsInitialized = false;
            InvalidSerieException e = new InvalidSerieException("No data to display...");
            StockLog.Write(e);
            throw e;
             }
             if (this.GraphRectangle.Height > 0)
             {
            minValue = float.MaxValue;
            maxValue = float.MinValue;
            this.CurveList.GetMinMax(StartIndex, EndIndex, ref minValue, ref maxValue, this.ScaleInvisible);

            if (minValue == maxValue || float.IsNaN(minValue) || float.IsInfinity(minValue) || float.IsNaN(maxValue) || float.IsInfinity(maxValue))
            {
               this.Deactivate("No volume for this stock", false);
               return false;
            }
            if (graphic == null)
            {
               // Initialise graphics
               this.graphic = this.CreateGraphics();
               RectangleF rect = this.graphic.VisibleClipBounds;
               rect.Inflate(new SizeF(-this.XMargin, -this.YMargin));
               this.GraphRectangle = rect;
            }

            float coefX = (this.GraphRectangle.Width * 0.96f) / (EndIndex - StartIndex);
            float coefY = this.GraphRectangle.Height / (maxValue - minValue);

            matrixValueToScreen = new System.Drawing.Drawing2D.Matrix();
            matrixValueToScreen.Translate(this.GraphRectangle.X - (StartIndex - 0.5f) * coefX, maxValue * coefY + this.GraphRectangle.Y);
            matrixValueToScreen.Scale(coefX, -coefY);

            matrixScreenToValue = (System.Drawing.Drawing2D.Matrix)matrixValueToScreen.Clone();
            matrixScreenToValue.Invert();
             }
             else
             {
            this.Deactivate("App too small...", false);
            return false;
             }
             return true;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:46,代码来源:GraphVolumeControl.cs


示例12: InitializeTransformMatrix

        protected override bool InitializeTransformMatrix()
        {
            if (float.IsNaN(this.RangeMin) || float.IsNaN(this.RangeMax))
             {
            return base.InitializeTransformMatrix();
             }

             if (this.CurveList == null)
             {
            this.IsInitialized = false;
            InvalidSerieException e = new InvalidSerieException("No data to display...");
            throw e;
             }
             if (this.CurveList.GetNbVisible() == 0)
             {
            this.Deactivate("No data to display...", false);
            return false;
             }
             if (this.StartIndex == this.EndIndex || this.EndIndex > this.dateSerie.Length - 1)
             {
            this.IsInitialized = false;
            InvalidSerieException e = new InvalidSerieException("Invalid input data range...");
            throw e;
             }
             if (this.GraphRectangle.Height > 0)
             {
            float minValue = this.RangeMin, maxValue = this.RangeMax;
            float coefX = (this.GraphRectangle.Width * 0.96f) / (EndIndex - StartIndex);
            float coefY = this.GraphRectangle.Height / (maxValue - minValue);

            matrixValueToScreen = new System.Drawing.Drawing2D.Matrix();
            matrixValueToScreen.Translate(this.GraphRectangle.X - (StartIndex - 0.5f) * coefX, maxValue * coefY + this.GraphRectangle.Y);
            matrixValueToScreen.Scale(coefX, -coefY);

            matrixScreenToValue = (System.Drawing.Drawing2D.Matrix)matrixValueToScreen.Clone();
            matrixScreenToValue.Invert();
            return true;
             }
             return false;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:40,代码来源:GraphRangedControl.cs


示例13: DrawNode

        public bool DrawNode(Node node, object graphics)
        {
            Graphics g = (Graphics)graphics;

            var m = g.Transform;
            var saveM = g.Transform.Clone();
            //      g.SetClip(FillTheGraphicsPath(node.GeometryNode.BoundaryCurve));

            // This is supposed to flip the text around its center

            var c = (float)node.GeometryNode.Center.Y;
            using (var m2 = new System.Drawing.Drawing2D.Matrix(1, 0, 0, -1, 0, 2 * c))
            {
                m.Multiply(m2);
            }

            m.Translate(
                (float)node.GeometryNode.Center.X,
                (float)node.GeometryNode.Center.Y);

            g.Transform = m;

            var styleStack = GetStyleStack();
            var painter = new TextViewPainter(
                Layout, g,
                SystemColors.WindowText,
                SystemColors.Window,
                SystemFonts.DefaultFont, styleStack);
            var ptr = new TextPointer { Character = 0, Span = 0, Line = TextModel.StartPosition };
            painter.SetSelection(ptr, ptr);
            painter.PaintGdiPlus();
            g.Transform = saveM;
            g.ResetClip();

            saveM.Dispose();
       //     m.Dispose();
            return true;//returning false would enable the default rendering
        }
开发者ID:relaxar,项目名称:reko,代码行数:38,代码来源:CfgBlockNode.cs


示例14: DrawNode

        bool DrawNode(DrawingNode node, object graphics) {
            Graphics g = (Graphics)graphics;
            Image image = ImageOfNode(node);

            //flip the image around its center
            using (System.Drawing.Drawing2D.Matrix m = g.Transform)
            {
                using (System.Drawing.Drawing2D.Matrix saveM = m.Clone())
                {

                    g.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);

                    g.Transform = m;
                    g.DrawImage(image, new PointF((float)(node.GeometryNode.Center.X - node.GeometryNode.Width / 2),
                        (float)(node.GeometryNode.Center.Y - node.GeometryNode.Height / 2)));
                    g.Transform = saveM;

                }
            }

            return true;//returning false would enable the default rendering
        }
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:24,代码来源:Form1.cs


示例15: Draw2dTextures

        public void Draw2dTextures(Draw2dData[] todraw, int textureid, float angle)
        {
            GL.PushAttrib(AttribMask.ColorBufferBit);
            GL.BindTexture(TextureTarget.Texture2D, textureid);
            GL.Enable(EnableCap.Texture2D);
            GL.Disable(EnableCap.DepthTest);

            VertexPositionTexture[] vertices;
            ushort[] indices;
            if (todraw.Length >= draw2dtexturesMAX)
            {
                vertices = new VertexPositionTexture[todraw.Length * 4];
                indices = new ushort[todraw.Length * 4];
            }
            else
            {
                if (draw2dtexturesVertices == null)
                {
                    draw2dtexturesVertices = new VertexPositionTexture[draw2dtexturesMAX * 4];
                    draw2dtexturesIndices = new ushort[draw2dtexturesMAX * 4];
                }
                vertices = draw2dtexturesVertices;
                indices = draw2dtexturesIndices;
            }
            ushort i = 0;
            foreach (Draw2dData v in todraw)
            {
                RectangleF rect;
                if (v.inAtlasId == null)
                {
                    rect = new RectangleF(0, 0, 1, 1);
                }
                else
                {
                    rect = TextureAtlas.TextureCoords2d(v.inAtlasId.Value, d_Terrain.texturesPacked);
                }
                float x2 = v.x1 + v.width;
                float y2 = v.y1 + v.height;

                PointF[] pnts = new PointF[4] {
                    new PointF(x2, y2),
                    new PointF(x2,v.y1),
                    new PointF(v.x1,v.y1),
                    new PointF(v.x1,y2)};
                if (angle != 0)
                {
                    System.Drawing.Drawing2D.Matrix mx=new System.Drawing.Drawing2D.Matrix();
                    mx.RotateAt(angle, new PointF(v.x1+v.width/2,v.y1+v.height/2));
                    mx.TransformPoints(pnts);
                }

                vertices[i] = new VertexPositionTexture(pnts[0].X, pnts[0].Y, 0, rect.Right, rect.Bottom, v.color);
                vertices[i + 1] = new VertexPositionTexture(pnts[1].X, pnts[1].Y, 0, rect.Right, rect.Top, v.color);
                vertices[i + 2] = new VertexPositionTexture(pnts[2].X, pnts[2].Y, 0, rect.Left, rect.Top, v.color);
                vertices[i + 3] = new VertexPositionTexture(pnts[3].X, pnts[3].Y, 0, rect.Left, rect.Bottom, v.color);
                indices[i] = i;
                indices[i + 1] = (ushort)(i + 1);
                indices[i + 2] = (ushort)(i + 2);
                indices[i + 3] = (ushort)(i + 3);
                i += 4;
            }
            GL.EnableClientState(ArrayCap.TextureCoordArray);
            GL.EnableClientState(ArrayCap.VertexArray);
            GL.EnableClientState(ArrayCap.ColorArray);
            unsafe
            {
                fixed (VertexPositionTexture* p = vertices)
                {
                    GL.VertexPointer(3, VertexPointerType.Float, StrideOfVertices, (IntPtr)(0 + (byte*)p));
                    GL.TexCoordPointer(2, TexCoordPointerType.Float, StrideOfVertices, (IntPtr)(12 + (byte*)p));
                    GL.ColorPointer(4, ColorPointerType.UnsignedByte, StrideOfVertices, (IntPtr)(20 + (byte*)p));
                    GL.DrawElements(BeginMode.Quads, i, DrawElementsType.UnsignedShort, indices);
                }
            }
            GL.DisableClientState(ArrayCap.TextureCoordArray);
            GL.DisableClientState(ArrayCap.VertexArray);
            GL.DisableClientState(ArrayCap.ColorArray);

            GL.Enable(EnableCap.DepthTest);
            GL.PopAttrib();
        }
开发者ID:henon,项目名称:manic_digger,代码行数:81,代码来源:The3d.cs


示例16: Render

        public bool Render(DisplayInformation dpInfo, LayoutManager lm, bool isDesktopMode)
        {
            if( m_outputPath == string.Empty)
                return false;

            Rectangle wallRect;

            if (isDesktopMode)
            {
                wallRect = dpInfo.DesktopBounds;
            }
            else
            {
                wallRect = dpInfo.Primary.Bounds;
                wallRect.X = 0;
                wallRect.Y = 0;
            }

            //  Create the bitmap representing the wallpaper
            Bitmap bmp = new Bitmap(wallRect.Width, wallRect.Height);

            Graphics e = Graphics.FromImage(bmp);

            e.FillRectangle(Brushes.Black, 0, 0, wallRect.Width, wallRect.Height);

            foreach(KeyValuePair<int, LayoutCanvas> kvp in lm)
            {
                LayoutCanvas canvas = kvp.Value;
                Screen screen = dpInfo.Screens[kvp.Key];

                //  Get X and Y coordinates of screen in IMAGE coordinates (taking into account
                //  the shifts required to display the image properly)
                int x = (screen.X < 0) ? wallRect.Width + screen.X : screen.X;
                int y = (screen.Y < 0) ? -screen.Y : screen.Y;

                Rectangle scrBounds = new Rectangle(x, y, screen.Width, screen.Height);

                //  Fill screen background
                if (screen.Y >= 0)
                {
                    e.FillRectangle(new SolidBrush(canvas.BackgroundColour), scrBounds);
                }
                else
                {
                    Rectangle scrTop = new Rectangle(x, wallRect.Height - y, scrBounds.Width, -wallRect.Y);
                    Rectangle scrBtm = new Rectangle(x, -wallRect.Y - y, scrBounds.Width, scrBounds.Height + wallRect.Y);

                    Brush brush = new SolidBrush(canvas.BackgroundColour);

                    e.FillRectangle(brush, scrTop);
                    e.FillRectangle(brush, scrBtm);
                }

                //  Sort based on ZIndex
                LayoutObject[] clone = new LayoutObject[canvas.Count];
                canvas.CopyTo(clone);
                BubbleSort(clone);

                for( int i = 0; i < clone.Length; i++)
                {
                    LayoutObject lo = clone[i];

                    string trueSource = string.Empty;

                    if (canvas.IsShuffleEnabled)
                    {
                        trueSource = FileRandomizer.GetRandomFile(
                            Path.GetDirectoryName(lo.Source));
                    }
                    else
                    {
                        trueSource = lo.Source;
                    }

                    Rectangle loBounds = new Rectangle(lo.X + x, lo.Y + y, lo.ActualWidth, lo.ActualHeight);

                    if (scrBounds.IntersectsWith(loBounds))
                    {
                        //  Get intersecting region
                        Rectangle intRect = Rectangle.Intersect(scrBounds, loBounds);

                        //  Resized image
                        Bitmap bmpImage;

                        if (lo.IsFlippedX || lo.IsFlippedY)
                        {
                            bmpImage = new Bitmap(loBounds.Width, loBounds.Height);
                            Graphics gb = Graphics.FromImage(bmpImage);

                            System.Drawing.Drawing2D.Matrix m = new System.Drawing.Drawing2D.Matrix();

                            m.Scale((lo.IsFlippedX) ? -1 : 1, (lo.IsFlippedY) ? -1 : 1);

                            if(lo.IsFlippedX)
                                m.Translate((float)-loBounds.Width + 1, 0);

                            if (lo.IsFlippedY)
                                m.Translate(0, (float)-loBounds.Height + 1);

                            gb.Transform = m;
//.........这里部分代码省略.........
开发者ID:philip-d,项目名称:PaperStitcher,代码行数:101,代码来源:Renderer.cs


示例17: CalculateCalloutLocation

		public override bool CalculateCalloutLocation(out PointF location, out CoordinateSystem coordinateSystem)
		{
			if (this.Roi.Points.Count < 3 || string.IsNullOrEmpty(this.Callout.Text))
				base.Callout.Visible = false;
			else
				base.Callout.Visible = true;

			if (!base.Callout.Visible || _userMovedCallout)
				return base.CalculateCalloutLocation(out location, out coordinateSystem);

			SizeF calloutOffsetDestination = GetCalloutOffsetDestination();

			coordinateSystem = CoordinateSystem.Destination;
			base.AnnotationGraphic.CoordinateSystem = coordinateSystem;

			// first, move the callout by the same amount the vertex moved (if it moved at all).
			location = base.Callout.TextLocation + calloutOffsetDestination;

			PointF start = this.Roi.Points[0];
			PointF vertex = this.Roi.Points[1];
			PointF end = this.Roi.Points[2];

			base.AnnotationGraphic.ResetCoordinateSystem();

			double vectorAngle = -Vector.SubtendedAngle(start, vertex, end) / 2 + 180;

			PointF[] points = new PointF[] { start, end };

			using (Matrix rotation = new Matrix())
			{
				rotation.Rotate((float) vectorAngle);
				rotation.Translate(-vertex.X, -vertex.Y);
				rotation.TransformPoints(points);
			}

			float calloutMagnitude = new Vector3D(location.X - vertex.X, location.Y - vertex.Y, 0).Magnitude;

			Vector3D startVector = new Vector3D(points[0].X, points[0].Y, 0);
			if (FloatComparer.AreEqual(startVector.Magnitude, 0F, 0.01F))
				startVector = new Vector3D(-1, 0, 0);

			startVector = startVector / startVector.Magnitude * calloutMagnitude;

			location = new PointF(startVector.X + vertex.X, startVector.Y + vertex.Y);

			return true;
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:47,代码来源:ProtractorRoiCalloutLocationStrategy.cs


示例18: Draw

        /// <summary>
        /// Draw page and its children
        /// </summary>
        /// <param name="gc"></param>
        /// <param name="clipRect"></param>
        public void Draw(Graphics gc, Rectangle clipRect)
        {
            System.Drawing.Drawing2D.Matrix finalMatrix = new System.Drawing.Drawing2D.Matrix();
            finalMatrix = this.drawMatrix.Clone();
            finalMatrix.Multiply(this.ViewMatrix, System.Drawing.Drawing2D.MatrixOrder.Append);

            gc.Transform = finalMatrix;

            // draw fill color
            using (SolidBrush brush = new SolidBrush(fillColor))
            {
                gc.FillRectangle(brush, 0, 0, (float)this.WidthInPixels, (float)this.HeightInPixels);
            }

            // draw background image
            if (pictureForDisplay != null)
            {
                gc.DrawImage(pictureForDisplay, 0, 0, (float)this.WidthInPixels, (float)this.HeightInPixels);
            }

            this.LastDrawMatrix = finalMatrix;

            EditorController.Instance.Grid.Draw(gc);

            foreach(EditorItem item in Children)
            {
                item.Draw(this.ViewMatrix, gc, clipRect);
            }

            // draw item commands
            foreach (EditorItem child in Children)
            {
                child.DrawCommands((float)this.ZoomLevel / 100, gc);
            }
        }
开发者ID:visla,项目名称:PDFReporter,代码行数:40,代码来源:ReportPage.cs


示例19: InitializeMap

        internal static SharpMap.Map InitializeMap(float angle, string[] filenames)
        {
            var map = new SharpMap.Map();

            try
            {
                foreach (var filename in filenames)
                {
                    var connectionString = string.Format("Data Source={0}", filename);
                    foreach (var provider in SharpMap.Data.Providers.SpatiaLite.GetSpatialTables(connectionString))
                    {
                        map.Layers.Add(
                            new SharpMap.Layers.VectorLayer(
                                string.Format("{0} - {1}", provider.Table, provider.GeometryColumn), provider) { Style = LayerTools.GetRandomVectorStyle() });
                    }
                }
                if (map.Layers.Count > 0)
                {
                    map.ZoomToExtents();

                    System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix();
                    mat.RotateAt(angle, map.WorldToImage(map.Center));
                    map.MapTransform = mat;
                    return map;
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }
            return null;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:32,代码来源:SpatiaLiteSample.cs


示例20: TestScale

        public void TestScale(float tx, float ty, float sx, float sy)
        {
            dsxy = sx;
            matrixd = new System.Drawing.Drawing2D.Matrix();//System.Drawing.Drawing2D.Matrix(1, 0, 0, -1, 0, 0);

            matrixd.Scale(sx, sy, System.Drawing.Drawing2D.MatrixOrder.Append);
            matrixd.Translate(tx, ty, System.Drawing.Drawing2D.MatrixOrder.Append);
        }
开发者ID:skipme,项目名称:ComGraMet,代码行数:8,代码来源:CGMImageStructure.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Drawing.Font类代码示例发布时间:2022-05-24
下一篇:
C# Drawing2D.LinearGradientBrush类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap