public void nextFrame(ref AnimationFrameArgs e) { if (currentFrame >= startFrame) { var bck = e.Background; var frg = e.Forerground; // Draw Background e.graphics.DrawImageUnscaled(bck, Point.Empty); // // Determine center if (middleX.Equals(float.NaN) || middleY.Equals(float.NaN)) { if (rotateAtCenter) { middleX = (e.ScreenerSize.Width / 2); middleY = (e.ScreenerSize.Height / 2); middlePt = new PointF(middleX, middleY); } else { middlePt = PointF.Empty; middleX = 0; middleY = 0; deltaAngle = 10; angle = 200; } } if (mat == null) { mat = new Matrix(); } mat.Reset(); mat.RotateAt(angle, middlePt); angle += deltaAngle; if (_invert) { mat.Invert(); } e.graphics.Transform = mat; e.graphics.DrawImage(frg, e.Location); } currentFrame += 1; if (angle >= 360) { _completed = true; } }
public void nextFrame(ref AnimationFrameArgs e) { var fr = e.Forerground; // Inti Variables. if (this.currentFrame == 0) { mat = new Matrix(); switch (this.Position) { case Direction.Left: mat.Translate(-_hostSize.Width, 0); break; case Direction.Top: mat.Translate(0, -_hostSize.Height); break; case Direction.Right: mat.Translate(_hostSize.Width, 0); _angle = 270; break; case Direction.Bottom: mat.Dispose(); mat = null; this._angle = 90F; break; default: break; } imgrectangle = new Rectangle(0, 0, _hostSize.Width, _hostSize.Height); lbrush = new LinearGradientBrush(imgrectangle, _color, Color.FromArgb(255 - this.Opacity, _color), this._angle); } this.currentFrame += 1; switch (this.Position) { case Direction.Left: case Direction.Top: case Direction.Right: e.graphics.Transform = mat; e.graphics.DrawImage(fr, Point.Empty); break; case Direction.Bottom: e.graphics.ScaleTransform(1F, -1F); e.graphics.TranslateTransform(0, -(e.ScreenerSize.Height + _distance)); e.graphics.DrawImage(fr, e.Location); break; } e.graphics.FillRectangle(lbrush, imgrectangle); fr.Dispose(); fr = null; }
public void leaveScreen() { _screen.leaveScreen(); if (e != null) { e.Dispose(); } e = null; }
public void nextFrame(ref AnimationFrameArgs e) { _start = true; e.graphics.Clear(Color.Yellow); var bck = e.Background; var fr = e.Forerground; e.graphics.DrawImage(bck, Point.Empty); e.graphics.DrawImage(fr, e.Location); e.graphics.DrawString(currentFrame.ToString(), Form.DefaultFont, SystemBrushes.ActiveBorder, Point.Empty); currentFrame += 1; }
public void nextFrame(ref AnimationFrameArgs e) { if (currentFrame >= startFrame ) { var bck = e.Background; var frg = e.Forerground; // Draw Background e.graphics.DrawImageUnscaled(bck, Point.Empty); // // Determine center if (middleX.Equals(float.NaN) || middleY.Equals(float.NaN)) { if (rotateAtCenter) { middleX = (e.ScreenerSize.Width / 2); middleY = (e.ScreenerSize.Height / 2); middlePt = new PointF(middleX, middleY); } else { middlePt = PointF.Empty; middleX = 0; middleY = 0; deltaAngle = 10; angle = 200; } } if (mat == null ) { mat = new Matrix(); } mat.Reset(); mat.RotateAt(angle, middlePt); angle += deltaAngle; if (_invert) mat.Invert(); e.graphics .Transform = mat; e.graphics .DrawImage(frg , e.Location); } currentFrame += 1; if (angle >= 360) _completed = true; }
public void nextFrame(ref AnimationFrameArgs e) { if (currentFrame >= startFrame) { Started = true; var bck = e.Background; var frg = e.Forerground; e.graphics.DrawImageUnscaled(bck, Point.Empty); if (this.Distance <= this.EaseIn) { this.DeltaSpeed = 0; this.Speed = 10; } mat = new Matrix(); switch (this.From) { case Direction.Left: mat.Translate(-this.Distance, 0); break; case Direction.Top: mat.Translate(0, -this.Distance); break; case Direction.Right: mat.Translate(this.Distance, 0); break; case Direction.Bottom: mat.Translate(0, this.Distance); break; } e.graphics.Transform = mat; this.Distance -= this.Speed; this.Speed += this.DeltaSpeed; e.graphics.DrawImage(frg, e.Location); mat.Dispose(); } if (this.Distance <= 0) { this.Completed = true; } this.currentFrame += 1; }
public void NextFrame() { // check if animation is completed then // ask IScreener to leave screen. // //else // // if screener is not in position then ask to do it. // now compute nextframe with animation and pass // it to screen and ask to draw again. if (_animation.Completed) { return; } if (_animation.Started) { _screen.coverTheHost(); } if (true) { Bitmap nxtfrm; Size sz = _screen.getSize(); nxtfrm = new Bitmap(sz.Width, sz.Height); Graphics g = Graphics.FromImage(nxtfrm); if (e == null) { e = new AnimationFrameArgs(ref _screen); } e.graphics = g; _animation.nextFrame(ref e); _screen.DrawAgain(); g.Dispose(); g = null; sz = Size.Empty; // Check if disposing nxtfrm dispose imagetoPaint also or not. // if (_screen.imageToPaint != null) _screen.imageToPaint.Dispose(); _screen.imageToPaint = nxtfrm; } }
public void CleanMemoryFootprints() { if (_screen != null) { _screen.cleanMemoryFootprint(); _screen = null; } if (_animation != null) { _animation.cleanMemoryFootprint(); _animation = null; } if (_wait != null) { _wait = null; } if (e != null) { e.Dispose(); e = null; } }
public void nextFrame(ref AnimationFrameArgs e) { if (currentFrame >= startFrame) { Started = true; var bck = e.Background; var frg = e.Forerground; e.graphics.DrawImageUnscaled(bck, Point.Empty); if (this.Distance <= this.EaseIn) { this.DeltaSpeed = 0; this.Speed = 10; } mat = new Matrix(); switch (this.From) { case Direction.Left: mat.Translate(-this.Distance, 0); break; case Direction.Top: mat.Translate(0, -this.Distance); break; case Direction.Right: mat.Translate(this.Distance, 0); break; case Direction.Bottom: mat.Translate(0, this.Distance); break; } e.graphics .Transform = mat; this.Distance -= this.Speed; this.Speed += this.DeltaSpeed; e.graphics .DrawImage(frg , e.Location); mat.Dispose(); } if (this.Distance <= 0) this.Completed = true; this.currentFrame += 1; }
public void NextFrame() { // check if animation is completed then // ask IScreener to leave screen. // //else // // if screener is not in position then ask to do it. // now compute nextframe with animation and pass // it to screen and ask to draw again. if (_animation.Completed) return; if ( _animation.Started ) { _screen.coverTheHost(); } if (true) { Bitmap nxtfrm; Size sz = _screen.getSize(); nxtfrm = new Bitmap(sz.Width, sz.Height); Graphics g = Graphics.FromImage(nxtfrm); if (e == null) { e = new AnimationFrameArgs(ref _screen); } e.graphics = g; _animation.nextFrame(ref e); _screen.DrawAgain(); g.Dispose(); g = null; sz = Size.Empty; // Check if disposing nxtfrm dispose imagetoPaint also or not. // if (_screen.imageToPaint != null) _screen.imageToPaint.Dispose(); _screen.imageToPaint = nxtfrm ; } }
public void leaveScreen() { _screen.leaveScreen(); if(e != null) e.Dispose(); e = null; }
public void nextFrame(ref AnimationFrameArgs e) { var fr = e.Forerground; // Inti Variables. if (this.currentFrame == 0) { mat = new Matrix(); switch (this.Position) { case Direction.Left: mat.Translate(-_hostSize.Width, 0); break; case Direction.Top: mat.Translate(0, -_hostSize.Height); break; case Direction.Right: mat.Translate(_hostSize.Width, 0); _angle = 270; break; case Direction.Bottom: mat.Dispose(); mat = null; this._angle = 90F; break; default: break; } imgrectangle = new Rectangle(0, 0, _hostSize.Width, _hostSize.Height); lbrush = new LinearGradientBrush(imgrectangle, _color, Color.FromArgb(255 - this.Opacity, _color), this._angle); } this.currentFrame += 1; switch (this.Position) { case Direction.Left: case Direction.Top: case Direction.Right: e.graphics.Transform = mat; e.graphics.DrawImage(fr , Point.Empty); break; case Direction.Bottom: e.graphics.ScaleTransform(1F, -1F); e.graphics.TranslateTransform(0, -(e.ScreenerSize.Height + _distance)); e.graphics.DrawImage(fr, e.Location); break; } e.graphics.FillRectangle(lbrush, imgrectangle); fr.Dispose(); fr = null; }