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


C# Matrix.Dispose方法代码示例

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


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

示例1: DrawEffectImage

        public override void DrawEffectImage(Bitmap current, Bitmap next, EffectingPanel effecingPanel)
        {
            int step = 1;
            Graphics bg;
            Bitmap doubleBufferingBitmap;
            SolidBrush solidBrush;
            Rectangle rectangle;
            Matrix matrix = null;

            try
            {
                doubleBufferingBitmap = new Bitmap(current);        // ダブルバッファリング用画面
                bg = Graphics.FromImage(doubleBufferingBitmap);     // ダブルバッファリング用画面描画用Graphics

                solidBrush = new SolidBrush(System.Drawing.Color.Black);
                rectangle = new Rectangle(0, 0, current.Width, current.Height);
                matrix = new Matrix();

                step = doubleBufferingBitmap.Width / 50;
                if (step < 1)
                {
                    step = 1;
                }

                ResetInterval();

                for (int x = 0; x < doubleBufferingBitmap.Width; x += step)
                {
                    bg.ResetTransform();                        // リセット座標変換
                    bg.FillRectangle(solidBrush, rectangle);

                    // current画像
                    matrix.Reset();
                    matrix.Translate(x, 0, MatrixOrder.Append);    // 原点移動
                    bg.Transform = matrix;                         // 座標設定
                    bg.DrawImage(current, 0, 0);

                    // next画像
                    matrix.Reset();
                    matrix.Translate(x - doubleBufferingBitmap.Width, 0, MatrixOrder.Append);
                    bg.Transform = matrix;
                    bg.DrawImage(next, 0, 0);

                    effecingPanel.pictureBox.Image = doubleBufferingBitmap;
                    effecingPanel.pictureBox.Refresh();

                    DoEventAtIntervals();
                }

                matrix.Dispose();
                bg.Dispose();
                doubleBufferingBitmap.Dispose();

                effecingPanel.pictureBox.Image = next;
            }
            catch (SystemException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
开发者ID:chanpi,项目名称:FormSample,代码行数:60,代码来源:EPL2RSlidingEffect.cs

示例2: Rotate

		public void Rotate(float degrees)
		{
			Matrix translateMatrix = new Matrix();
			RectangleF rectF = mPath.GetBounds();
			
			translateMatrix.RotateAt(degrees, new PointF(rectF.Width / 2, rectF.Height /2));
			mPath.Transform(translateMatrix);
			translateMatrix.Dispose();
		}
开发者ID:savagemat,项目名称:arcgis-diagrammer,代码行数:9,代码来源:Definition.cs

示例3: DrawEffectImage

        public override void DrawEffectImage(Bitmap current, Bitmap next, EffectingPanel effecingPanel)
        {
            Bitmap doubleBufferingBitmap = null;    // ダブルバッファリング用画面
            Graphics bg = null;                     // ダブルバッファリング用画面描画用Graphics

            SolidBrush solidBrush = null;
            Rectangle rectangle;
            Matrix matrix = null;

            try
            {
                int deltaDegree = 10;

                doubleBufferingBitmap = new Bitmap(current);
                bg = Graphics.FromImage(doubleBufferingBitmap);

                solidBrush = new SolidBrush(System.Drawing.Color.Black);
                rectangle = new Rectangle(0, 0, current.Width, current.Height);
                matrix = new Matrix();

                ResetInterval();
                for (int angle = 0; angle <= 360; angle += deltaDegree)
                {
                    bg.ResetTransform();                             // リセット座標変換
                    bg.FillRectangle(solidBrush, rectangle);

                    matrix.Reset();
                    matrix.Translate(doubleBufferingBitmap.Width / 2, doubleBufferingBitmap.Height / 2, MatrixOrder.Append);   // 原点移動
                    matrix.Rotate((float)angle);
                    bg.Transform = matrix;                           // 座標設定

                    bg.DrawImage(current, -doubleBufferingBitmap.Width / 2, -doubleBufferingBitmap.Height / 2);  // 画像の中心が(0, 0)になるように描画
                    effecingPanel.pictureBox.Image = doubleBufferingBitmap;
                    effecingPanel.pictureBox.Refresh();

                    Thread.Sleep(20);
                    DoEventAtIntervals();
                }

                matrix.Dispose();
                bg.Dispose();
                doubleBufferingBitmap.Dispose();
            }
            catch(SystemException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
开发者ID:chanpi,项目名称:FormSample,代码行数:48,代码来源:EPRotatingEffect.cs

示例4: DrawBwShape

        protected void DrawBwShape(Graphics g, GraphicsPath gpPass, float flOpacity, float flOutlineWidth, Color clBackground, Color clForecolour) {
            if (flOpacity > 0.0F) {
                GraphicsPath gp = (GraphicsPath)gpPass.Clone();

                Matrix m = new Matrix();
                m.Translate(this.m_pntDrawOffset.X, this.m_pntDrawOffset.Y);
                gp.Transform(m);

                Pen pen = new Pen(Color.FromArgb((int)(255.0F * flOpacity), clBackground), flOutlineWidth);
                pen.LineJoin = LineJoin.Round;
                g.DrawPath(pen, gp);
                SolidBrush brush = new SolidBrush(Color.FromArgb((int)(255.0F * flOpacity), clForecolour));
                g.FillPath(brush, gp);

                brush.Dispose();
                pen.Dispose();
                m.Dispose();
                gp.Dispose();
            }
        }
开发者ID:EBassie,项目名称:Procon-1,代码行数:20,代码来源:MapObject.cs

示例5: GenerateMappedBitmaps

        /// <summary>
        /// Generates a dictionary of Symbol id and rendered bitmap.
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public Dictionary<uint, Bitmap> GenerateMappedBitmaps(VexObject v, bool includeImages)
        {
            Dictionary<uint, Bitmap> result = new Dictionary<uint, Bitmap>();

            foreach (uint key in v.Definitions.Keys)
            {
                IDefinition def = v.Definitions[key];
                if (def is Symbol)
                {
                    Symbol symbol = (Symbol)def;
                    Bitmap myBitmap = new Bitmap(
                        (int)symbol.StrokeBounds.Size.Width + 1,
                        (int)symbol.StrokeBounds.Size.Height + 1);
                    myBitmap.SetResolution(96, 96);

                    translateMatrix = new System.Drawing.Drawing2D.Matrix(
                        1, 0, 0, 1, -symbol.StrokeBounds.Point.X, -symbol.StrokeBounds.Point.Y);
                    g = Graphics.FromImage(myBitmap);
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.CompositingMode = CompositingMode.SourceOver;
                    g.CompositingQuality = CompositingQuality.AssumeLinear;

                    DrawSymbol(symbol);

                    result.Add(symbol.Id, myBitmap);
                    translateMatrix.Dispose();
                }
                else if (includeImages && def is Vex.Image)
                {
                    Bitmap bmp = new Bitmap(def.Path);
                    result.Add(def.Id, bmp);
                }
            }
            return result;
        }
开发者ID:galaxyyao,项目名称:TouhouGrave,代码行数:41,代码来源:GdiRenderer.cs

示例6: RotateImage

        /// <summary>
        /// Return an image that is the rotated version of the given image. Rotation is
        /// at 'angle' via 'center'. New image is the same size as the rotated image
        /// </summary>
        /// <param name="angle"></param>
        /// <param name="center"></param>
        /// <returns></returns>
        public static Image RotateImage(Image source, float angle, PointF center)
        {
            // create new image

            Image newImage = CreateImage(source.Width, source.Height, PixelFormat.Format32bppPArgb, Color.Transparent);

            // get graphics surface

            Graphics g = Graphics.FromImage(newImage);

            // use high quality resampling

            g.SmoothingMode = SmoothingMode.HighQuality;

            g.InterpolationMode = InterpolationMode.HighQualityBicubic;

            g.PixelOffsetMode = PixelOffsetMode.HighQuality;

            // setup transform matrix

            Matrix rm = new Matrix();

            rm.RotateAt(angle, center, MatrixOrder.Append);

            // insert transform into graphics

            g.Transform = rm;

            // draw image

            g.DrawImage(source, center.X - (float)source.Width / 2.0f, center.Y - (float)source.Height / 2);

            // dispose locals

            g.Dispose();

            rm.Dispose();

            // return new image

            return newImage;
        }
开发者ID:duncanmeech,项目名称:RedEye,代码行数:49,代码来源:ImageUtility.cs

示例7: GenerateFilteredBitmaps

        public void GenerateFilteredBitmaps(VexObject v, Dictionary<string, IDefinition> usedImages, Dictionary<string, List<Bitmap>> genImages)
        {
            foreach (string s in usedImages.Keys)
            {
                uint key = usedImages[s].Id;
                IDefinition def = v.Definitions[key];
                if (def is Timeline)
                {
                    Timeline tl = (Timeline)def;
                    Timeline namedSymbol = GetNamedSymbol(v, tl);
                    if (namedSymbol != null && HasSymbols(v, namedSymbol))
                    {
                        List<Bitmap> bmpFrames = new List<Bitmap>();

                        for (int i = 0; i < tl.FrameCount; i++)
                        {
                            Bitmap myBitmap = new Bitmap(
                                (int)namedSymbol.StrokeBounds.Size.Width + 1,
                                (int)namedSymbol.StrokeBounds.Size.Height + 1);

                            myBitmap.SetResolution(96, 96);
                            translateMatrix = new System.Drawing.Drawing2D.Matrix(
                                1, 0, 0, 1, -namedSymbol.StrokeBounds.Point.X, -namedSymbol.StrokeBounds.Point.Y);
                            g = Graphics.FromImage(myBitmap);
                            g.SmoothingMode = SmoothingMode.AntiAlias;
                            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                            g.CompositingMode = CompositingMode.SourceOver;
                            g.CompositingQuality = CompositingQuality.AssumeLinear;

                            DrawFilteredTimeline(v, namedSymbol);
                            translateMatrix.Dispose();
                            bmpFrames.Add(myBitmap);
                        }

                        string name = s + "#" + namedSymbol.Id;
                        genImages.Add(name, bmpFrames);
                    }
                }
                else if (def is Symbol)
                {
                    Symbol sy = (Symbol)def;
                    List<Bitmap> bmpFrames = new List<Bitmap>();

                    Bitmap myBitmap = new Bitmap(
                        (int)sy.StrokeBounds.Size.Width + 1,
                        (int)sy.StrokeBounds.Size.Height + 1);

                    myBitmap.SetResolution(96, 96);
                    translateMatrix = new System.Drawing.Drawing2D.Matrix(
                        1, 0, 0, 1, -sy.StrokeBounds.Point.X, -sy.StrokeBounds.Point.Y);
                    g = Graphics.FromImage(myBitmap);
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.CompositingMode = CompositingMode.SourceOver;
                    g.CompositingQuality = CompositingQuality.AssumeLinear;

                    DrawFilteredSymbol(sy);
                    translateMatrix.Dispose();
                    bmpFrames.Add(myBitmap);

                    string name = s + "#" + sy.Id;
                    genImages.Add(name, bmpFrames);
                }
                else if (def is Text)
                {
                    Text tx = (Text)def;

                    if (tx.TextRuns.Count > 0 && !tx.TextRuns[0].isEditable)
                    {
                        List<Bitmap> bmpFrames = new List<Bitmap>();

                        Bitmap myBitmap = new Bitmap(
                            (int)tx.StrokeBounds.Size.Width + 1,
                            (int)tx.StrokeBounds.Size.Height + 1);

                        //translateMatrix = new System.Drawing.Drawing2D.Matrix(
                        //    1, 0, 0, 1, -tx.StrokeBounds.Point.X, -tx.StrokeBounds.Point.Y);

                        //myBitmap.SetResolution(72, 72);
                        myBitmap.SetResolution(96, 96);
                        g = Graphics.FromImage(myBitmap);

                        DrawText(tx, new DDW.Vex.Matrix(1, 0, 0, 1, -tx.StrokeBounds.Point.X, -tx.StrokeBounds.Point.Y));
                        //translateMatrix.Dispose();
                        bmpFrames.Add(myBitmap);

                        string name = s + "#" + tx.Id;
                        genImages.Add(name, bmpFrames);
                    }
                }
            }
        }
开发者ID:nyxojaele,项目名称:Swf2XNA,代码行数:92,代码来源:GdiRenderer.cs

示例8: Render

 public void Render(Symbol symbol, Graphics g)
 {
     this.g = g;
     translateMatrix = new System.Drawing.Drawing2D.Matrix();
     DrawSymbol(symbol);
     translateMatrix.Dispose();
 }
开发者ID:nyxojaele,项目名称:Swf2XNA,代码行数:7,代码来源:GdiRenderer.cs

示例9: DrawPushedState

        //Draws the button when it's clicked down
        private void DrawPushedState(Graphics g)
        {
            GraphicsPath outerRegion = RoundedRect(this.Width - 1, this.Height - 1, 3);
            GraphicsPath innerRegion = RoundedRect(this.Width - 3, this.Height - 3, 2);
            //----Shift the inner region inwards
            Matrix translate = new Matrix();
            translate.Translate(1, 1);
            innerRegion.Transform(translate);
            translate.Dispose();
            //-----
            Rectangle backgroundRect = new Rectangle(1, 1, this.Width - 3, this.Height - 3);

            Pen outlinePen = new Pen(Color.FromArgb(167, 167, 167)); //Outline is darker than normal
            Pen inlinePen = new Pen(Color.FromArgb(227, 227, 227)); //Darker white
            SolidBrush backBrush = new SolidBrush(Color.FromArgb(234, 234, 234)); //SystemColors.ControlLight

            g.SmoothingMode = SmoothingMode.AntiAlias;

            g.FillRectangle(backBrush, backgroundRect);
            g.DrawPath(inlinePen, innerRegion);
            g.DrawPath(outlinePen, outerRegion);

            //Text/Image
            offset = 1; //moves image inwards 1 pixel (x and y) to create the illusion that the button was pushed
            DrawForeground(g);

            //Clean up
            outlinePen.Dispose();
            inlinePen.Dispose();
            outerRegion.Dispose();
            innerRegion.Dispose();
        }
开发者ID:Ricordanza,项目名称:Ricordanza.kernel,代码行数:33,代码来源:CommandLink.cs

示例10: ClientPointToGame

        private Point ClientPointToGame(Point pntClient) {
            Point[] pntReturn = new Point[] { this.ClientPointToZoom(pntClient) };
            
            if (this.LoadedMapImagePack != null) {
                Matrix m = new Matrix();
                
                pntReturn[0].X = (int)((float)pntReturn[0].X - this.LoadedMapImagePack.MapOrigin.X);
                pntReturn[0].Y = (int)((float)pntReturn[0].Y - this.LoadedMapImagePack.MapOrigin.Y);

                pntReturn[0].X = (int)((float)pntReturn[0].X / this.LoadedMapImagePack.MapScale.X);
                pntReturn[0].Y = (int)((float)pntReturn[0].Y / this.LoadedMapImagePack.MapScale.Y);

                m.Rotate(360.0F - this.LoadedMapImagePack.MapRotation);

                m.TransformPoints(pntReturn);
                m.Dispose();
            }
            else {
                pntReturn[0].X = 0;
                pntReturn[0].Y = 0;
            }

            return pntReturn[0];
        }
开发者ID:EBassie,项目名称:Procon-1,代码行数:24,代码来源:BattlemapView.cs

示例11: rotatePointsAt

		internal static void rotatePointsAt(PointF[] points, PointF pivot, float angle)
		{
			Matrix rotation = new Matrix();
			rotation.RotateAt(angle, pivot);
			rotation.TransformPoints(points);
			rotation.Dispose();
		}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:7,代码来源:Utilities.cs

示例12: rotateRectAt

		internal static GraphicsPath rotateRectAt(RectangleF rc, PointF pivot, float angle)
		{
			GraphicsPath path = new GraphicsPath();
			path.AddRectangle(rc);
			Matrix rotation = new Matrix();
			rotation.RotateAt(angle, pivot);
			path.Transform(rotation);
			rotation.Dispose();
			return path;
		}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:10,代码来源:Utilities.cs

示例13: ScaleAt

        public static void ScaleAt(this Matrix result, float scaleX, float scaleY, PointF center)
        {
            Matrix mReg = new Matrix(result.Elements[0], result.Elements[1], result.Elements[2], result.Elements[3], 0, 0);
            Matrix mInv = result.Clone();
            mInv.Invert();
            float offsetX = result.OffsetX;
            float offsetY = result.OffsetY;

            // move to orgin and scale
            result.Reset();
            result.Scale(scaleX, scaleY, MatrixOrder.Append);
            result.Multiply(mReg, MatrixOrder.Append);

            // find new orgin
            PointF dif = new PointF(center.X - offsetX, center.Y - offsetY);
            PointF[] pts1 = new PointF[] { dif };
            mInv.TransformVectors(pts1);
            result.TransformVectors(pts1);
            PointF finalOffset = new PointF(center.X - pts1[0].X, center.Y - pts1[0].Y);

            result.Translate(finalOffset.X, finalOffset.Y, MatrixOrder.Append);

            mReg.Dispose();
            mInv.Dispose();
        }
开发者ID:galaxyyao,项目名称:TouhouGrave,代码行数:25,代码来源:VexExtensions.cs

示例14: ApplyBitmapEffect

 /// <summary>
 /// Apply a bitmap effect to the surface
 /// </summary>
 /// <param name="effect"></param>
 public void ApplyBitmapEffect(IEffect effect)
 {
     BackgroundForm backgroundForm = new BackgroundForm("Effect", "Please wait");
     backgroundForm.Show();
     Application.DoEvents();
     try
     {
         Rectangle imageRectangle = new Rectangle(Point.Empty, Image.Size);
         Matrix matrix = new Matrix();
         Image newImage = ImageHelper.ApplyEffect(Image, effect, matrix);
         if (newImage != null)
         {
             // Make sure the elements move according to the offset the effect made the bitmap move
             _elements.Transform(matrix);
             // Make undoable
             MakeUndoable(new SurfaceBackgroundChangeMemento(this, matrix), false);
             SetImage(newImage, false);
             Invalidate();
             if (_surfaceSizeChanged != null && !imageRectangle.Equals(new Rectangle(Point.Empty, newImage.Size)))
             {
                 _surfaceSizeChanged(this, null);
             }
         }
         else
         {
             // clean up matrix, as it hasn't been used in the undo stack.
             matrix.Dispose();
         }
     }
     finally
     {
         // Always close the background form
         backgroundForm.CloseDialog();
     }
 }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:39,代码来源:Surface.cs

示例15: Paint

        /// <summary>
        /// Paint all drawables
        /// </summary>
        /// <param name="drawables">List of drawable elements</param>
        public void Paint(List<IDrawable> drawables)
        {
            Graphics graphics = Graphics.FromImage(_bitmap);

            // transform coordinate system
            Matrix m = new Matrix(1, 0, 0, -1, 0, 0);
            m.Translate(0, HEIGHT, MatrixOrder.Append);
            graphics.Transform = m;

            // set smoothing mode to antialiasing
            graphics.SmoothingMode = SmoothingMode.AntiAlias;

            foreach (IDrawable item in drawables)
            {
                item.Paint(graphics);
            }

            m.Dispose();
            graphics.Dispose();

            _valid = false; // force revalidation for preview
        }
开发者ID:blacker-cz,项目名称:LSystems,代码行数:26,代码来源:Renderer.cs


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