示例#1
0
        // Token: 0x06000166 RID: 358 RVA: 0x00008440 File Offset: 0x00006640
        public ScrapDrawForm(ScrapBase scrap)
        {
            InitializeComponent();
            _scrap     = scrap;
            _basepoint = new Point(50, 50);
            var p = new Point(scrap.ClientRectangle.X + scrap.ClientSize.Width / 2, scrap.ClientRectangle.Y + scrap.ClientSize.Height / 2);

            p        = scrap.PointToScreen(p);
            _baseimg = new Bitmap(scrap.Image.Width + 100, scrap.Image.Height + 100, PixelFormat.Format24bppRgb);
            CopyFromScreen(_baseimg, new Point(p.X - scrap.Image.Width / 2 - 50, p.Y - scrap.Image.Height / 2 - 50));
            var colorMatrix = new ColorMatrix();
            var num         = 0.298912f;
            var num2        = 0.586611f;
            var num3        = 0.114478f;

            colorMatrix[0, 0] = (colorMatrix[0, 1] = (colorMatrix[0, 2] = num * 0.5f));
            colorMatrix[1, 0] = (colorMatrix[1, 1] = (colorMatrix[1, 2] = num2 * 0.5f));
            colorMatrix[2, 0] = (colorMatrix[2, 1] = (colorMatrix[2, 2] = num3 * 0.5f));
            colorMatrix[3, 3] = (colorMatrix[4, 4] = 1f);
            var imageAttributes = new ImageAttributes();

            imageAttributes.SetColorMatrix(colorMatrix);
            using (var graphics = Graphics.FromImage(_baseimg))
            {
                var p2 = new Point(scrap.ClientRectangle.Left, scrap.ClientRectangle.Top);
                p2 = scrap.PointToScreen(p2);
                graphics.DrawImageUnscaled(scrap.Image, 50, 50);
                graphics.DrawImage(_baseimg, new Rectangle(0, 0, _baseimg.Width, _baseimg.Height), 0, 0, _baseimg.Width, _baseimg.Height, GraphicsUnit.Pixel, imageAttributes);
            }
            base.Width  = _baseimg.Width;
            base.Height = _baseimg.Height;
            base.Left   = p.X - base.Width / 2;
            base.Top    = p.Y - base.Height / 2;
            _scrap.Hide();
        }
示例#2
0
        public ScrapDrawForm(ScrapBase scrap)
        {
            float num4;
            float num6;
            float num8;

            this.InitializeComponent();
            this._scrap     = scrap;
            this._basepoint = new Point(50, 50);
            Point p = new Point(scrap.ClientRectangle.X + (scrap.ClientSize.Width / 2), scrap.ClientRectangle.Y + (scrap.ClientSize.Height / 2));

            p             = scrap.PointToScreen(p);
            this._baseimg = new Bitmap(scrap.Image.Width + 100, scrap.Image.Height + 100, PixelFormat.Format24bppRgb);
            this.CopyFromScreen(this._baseimg, new Point((p.X - (scrap.Image.Width / 2)) - 50, (p.Y - (scrap.Image.Height / 2)) - 50));
            ColorMatrix newColorMatrix = new ColorMatrix();
            float       num            = 0.298912f;
            float       num2           = 0.586611f;
            float       num3           = 0.114478f;

            newColorMatrix[0, 2] = num4 = num * 0.5f;
            newColorMatrix[0, 0] = newColorMatrix[0, 1] = num4;
            newColorMatrix[1, 2] = num6 = num2 * 0.5f;
            newColorMatrix[1, 0] = newColorMatrix[1, 1] = num6;
            newColorMatrix[2, 2] = num8 = num3 * 0.5f;
            newColorMatrix[2, 0] = newColorMatrix[2, 1] = num8;
            newColorMatrix[3, 3] = newColorMatrix[4, 4] = 1f;
            ImageAttributes imageAttr = new ImageAttributes();

            imageAttr.SetColorMatrix(newColorMatrix);
            using (Graphics graphics = Graphics.FromImage(this._baseimg))
            {
                Point point2 = new Point(scrap.ClientRectangle.Left, scrap.ClientRectangle.Top);
                point2 = scrap.PointToScreen(point2);
                graphics.DrawImageUnscaled(scrap.Image, 50, 50);
                graphics.DrawImage(this._baseimg, new Rectangle(0, 0, this._baseimg.Width, this._baseimg.Height), 0, 0, this._baseimg.Width, this._baseimg.Height, GraphicsUnit.Pixel, imageAttr);
            }
            base.Width  = this._baseimg.Width;
            base.Height = this._baseimg.Height;
            base.Left   = p.X - (base.Width / 2);
            base.Top    = p.Y - (base.Height / 2);
            this._scrap.Hide();
        }