Пример #1
0
 protected virtual void OnNonLinearTransfromNeeded(object sender, NonLinearTransfromNeededEventArg e)
 {
     if (this.NonLinearTransfromNeeded != null)
     {
         this.NonLinearTransfromNeeded(this, e);
     }
     else
     {
         e.UseDefaultTransform = true;
     }
 }
Пример #2
0
        protected virtual Bitmap OnNonLinearTransfromNeeded()
        {
            Bitmap bitmap = null;

            if (this.CtrlBmp == null)
            {
                return(null);
            }
            try
            {
                bitmap = new Bitmap(base.Width, base.Height);
                Rectangle  rect        = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
                BitmapData bitmapdata  = bitmap.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
                IntPtr     source      = bitmapdata.Scan0;
                int        length      = (bitmap.Width * bitmap.Height) * 4;
                byte[]     destination = new byte[length];
                Marshal.Copy(source, destination, 0, length);
                NonLinearTransfromNeededEventArg e = new NonLinearTransfromNeededEventArg
                {
                    CurrentTime           = this.CurrentTime,
                    ClientRectangle       = base.ClientRectangle,
                    Pixels                = destination,
                    Stride                = bitmapdata.Stride,
                    SourcePixels          = this.CtrlPixels,
                    SourceClientRectangle = new Rectangle(this.Padding.Left, this.Padding.Top, this.DecoratedControl.Width, this.DecoratedControl.Height),
                    SourceStride          = this.CtrlStride
                };
                try
                {
                    if (this.NonLinearTransfromNeeded != null)
                    {
                        this.NonLinearTransfromNeeded(this, e);
                    }
                    else
                    {
                        e.UseDefaultTransform = true;
                    }
                    if (e.UseDefaultTransform && (this.DecorationType == DecorationType.BottomMirror))
                    {
                        TransfromHelper.DoBottomMirror(e);
                    }
                }
                catch
                {
                }
                Marshal.Copy(destination, 0, source, length);
                bitmap.UnlockBits(bitmapdata);
            }
            catch
            {
            }
            return(bitmap);
        }
Пример #3
0
        protected virtual Bitmap OnNonLinearTransfromNeeded()
        {
            Bitmap bitmap = null;

            if (this.ctrlBmp == null)
            {
                return(null);
            }
            try
            {
                bitmap = (Bitmap)this.ctrlBmp.Clone();
                Rectangle  rect        = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
                BitmapData bitmapdata  = bitmap.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
                IntPtr     source      = bitmapdata.Scan0;
                int        length      = (bitmap.Width * bitmap.Height) * 4;
                byte[]     destination = new byte[length];
                Marshal.Copy(source, destination, 0, length);
                NonLinearTransfromNeededEventArg e = new NonLinearTransfromNeededEventArg
                {
                    CurrentTime     = this.CurrentTime,
                    ClientRectangle = this.DoubleBitmap.ClientRectangle,
                    Pixels          = destination,
                    Stride          = bitmapdata.Stride
                };
                if (this.NonLinearTransfromNeeded != null)
                {
                    this.NonLinearTransfromNeeded(this, e);
                }
                else
                {
                    e.UseDefaultTransform = true;
                }
                if (e.UseDefaultTransform)
                {
                    TransfromHelper.DoBlind(e, this.animation);
                    TransfromHelper.DoMosaic(e, this.animation, ref this.buffer, ref this.pixelsBuffer);
                    TransfromHelper.DoTransparent(e, this.animation);
                    TransfromHelper.DoLeaf(e, this.animation);
                }
                Marshal.Copy(destination, 0, source, length);
                bitmap.UnlockBits(bitmapdata);
            }
            catch
            {
            }
            return(bitmap);
        }