Example #1
0
 protected virtual void OnTransfromNeeded(object sender, TransfromNeededEventArg e)
 {
     try
     {
         e.ClipRectangle = this.clipRect;
         e.CurrentTime   = this.CurrentTime;
         if (this.TransfromNeeded != null)
         {
             this.TransfromNeeded(this, e);
         }
         else
         {
             e.UseDefaultMatrix = true;
         }
         if (e.UseDefaultMatrix)
         {
             TransfromHelper.DoScale(e, this.animation);
             TransfromHelper.DoRotate(e, this.animation);
             TransfromHelper.DoSlide(e, this.animation);
         }
     }
     catch
     {
     }
 }
Example #2
0
        public void EndUpdate()
        {
            Bitmap bitmap = this.GetBackground(this.AnimatedControl, true, true);

            if (this.animation.AnimateOnlyDifferences)
            {
                TransfromHelper.CalcDifference(bitmap, this.BgBmp);
            }
            this.ctrlBmp = bitmap;
            this.mode    = AnimateMode.Update;
        }
Example #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);
        }