⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 impoverlaytranform.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Utils
{
    using System;
    using System.Drawing;

    public class ImpOverlayTranform : IImageTransform
    {
        private int _height;
        private Image _overlapImage;
        private int _width;
        private int _x;
        private int _y;

        public ImpOverlayTranform(Image overlapImage, Rectangle destRectangle) : this(overlapImage, destRectangle.X, destRectangle.Y, destRectangle.Size)
        {
        }

        public ImpOverlayTranform(Image overlapImage, Point postion, Size size) : this(overlapImage, postion, size.Width, size.Height)
        {
        }

        public ImpOverlayTranform(Image overlapImage, Point postion, int width, int height) : this(overlapImage, postion.X, postion.Y, width, height)
        {
        }

        public ImpOverlayTranform(Image overlapImage, int x, int y, Size size) : this(overlapImage, x, y, size.Width, size.Height)
        {
        }

        public ImpOverlayTranform(Image overlapImage, int x, int y, int width, int height)
        {
            this._overlapImage = overlapImage;
            this._x = x;
            this._y = y;
            this._width = width;
            this._height = height;
        }

        public virtual IImage Transform(IImage image)
        {
            IImage image4;
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }
            IImage image2 = null;
            RectangleF rect = new RectangleF((float) this._x, (float) this._y, (float) this._width, (float) this._height);
            try
            {
                image2 = (IImage) image.Clone();
                Image image3 = (Bitmap) image.Image.Clone();
                using (Graphics graphics = Graphics.FromImage(image3))
                {
                    graphics.DrawImage(this.OverlapImage, rect);
                    image2.Image = image3;
                }
                image4 = image2;
            }
            catch (Exception exception)
            {
                if (image2 != null)
                {
                    image2.Dispose();
                }
                throw exception;
            }
            return image4;
        }

        public int Height
        {
            get
            {
                return this._height;
            }
            set
            {
                this._height = value;
            }
        }

        public Image OverlapImage
        {
            get
            {
                return this._overlapImage;
            }
            set
            {
                this._overlapImage = value;
            }
        }

        public int Width
        {
            get
            {
                return this._width;
            }
            set
            {
                this._width = value;
            }
        }

        public int X
        {
            get
            {
                return this._x;
            }
            set
            {
                this._x = value;
            }
        }

        public int Y
        {
            get
            {
                return this._y;
            }
            set
            {
                this._y = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -