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 { } }
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; }
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); }
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); }