mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 05:23:24 -07:00
Made some changes which make the switch from region to window more interesting, for this I had to change some code so the "fade in/out" animations are running until finished.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2352 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
010e43704d
commit
4800bedde2
2 changed files with 140 additions and 80 deletions
|
@ -70,8 +70,7 @@ namespace Greenshot.Forms {
|
||||||
private bool isZooming = true;
|
private bool isZooming = true;
|
||||||
private Point previousMousePos = Point.Empty;
|
private Point previousMousePos = Point.Empty;
|
||||||
private FixMode fixMode = FixMode.None;
|
private FixMode fixMode = FixMode.None;
|
||||||
private RectangleAnimator windowAnimator = new RectangleAnimator(Rectangle.Empty, Rectangle.Empty, 0, EasingType.Quadratic);
|
private RectangleAnimator windowAnimator = null;
|
||||||
|
|
||||||
private RectangleAnimator zoomAnimator = null;
|
private RectangleAnimator zoomAnimator = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -175,10 +174,14 @@ namespace Greenshot.Forms {
|
||||||
|
|
||||||
// set cursor location
|
// set cursor location
|
||||||
cursorPos = WindowCapture.GetCursorLocationRelativeToScreenBounds();
|
cursorPos = WindowCapture.GetCursorLocationRelativeToScreenBounds();
|
||||||
// Initialize with a invalid position
|
|
||||||
|
// Initialize the animations, the window capture zooms out from the cursor to the window under the cursor
|
||||||
|
if (captureMode == CaptureMode.Window) {
|
||||||
|
windowAnimator = new RectangleAnimator(new Rectangle(cursorPos, Size.Empty), captureRect, 10, EasingType.Quintic, EasingMode.EaseOut);
|
||||||
|
}
|
||||||
|
// Initialize the zoom with a invalid position
|
||||||
zoomAnimator = new RectangleAnimator(Rectangle.Empty, new Rectangle(int.MaxValue, int.MaxValue, 0, 0), 20, EasingType.Quintic, EasingMode.EaseOut);
|
zoomAnimator = new RectangleAnimator(Rectangle.Empty, new Rectangle(int.MaxValue, int.MaxValue, 0, 0), 20, EasingType.Quintic, EasingMode.EaseOut);
|
||||||
VerifyZoomAnimation(cursorPos, false);
|
VerifyZoomAnimation(cursorPos, false);
|
||||||
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
this.Bounds = capture.ScreenBounds;
|
this.Bounds = capture.ScreenBounds;
|
||||||
this.ResumeLayout();
|
this.ResumeLayout();
|
||||||
|
@ -253,13 +256,23 @@ namespace Greenshot.Forms {
|
||||||
// Toggle capture mode
|
// Toggle capture mode
|
||||||
switch (captureMode) {
|
switch (captureMode) {
|
||||||
case CaptureMode.Region:
|
case CaptureMode.Region:
|
||||||
|
// Set the window capture mode
|
||||||
captureMode = CaptureMode.Window;
|
captureMode = CaptureMode.Window;
|
||||||
|
// "Fade out" Zoom
|
||||||
|
zoomAnimator.ChangeDestination(new Rectangle(Point.Empty, Size.Empty), 20);
|
||||||
|
// "Fade in" window
|
||||||
|
windowAnimator = new RectangleAnimator(new Rectangle(cursorPos, Size.Empty), captureRect, 10, EasingType.Quintic, EasingMode.EaseOut);
|
||||||
break;
|
break;
|
||||||
case CaptureMode.Window:
|
case CaptureMode.Window:
|
||||||
|
// Set the region capture mode
|
||||||
captureMode = CaptureMode.Region;
|
captureMode = CaptureMode.Region;
|
||||||
|
// "Fade out" window
|
||||||
|
windowAnimator.ChangeDestination(new Rectangle(cursorPos, Size.Empty));
|
||||||
|
// Fade in zoom
|
||||||
|
zoomAnimator = new RectangleAnimator(Rectangle.Empty, new Rectangle(int.MaxValue, int.MaxValue, 0, 0), 20, EasingType.Quintic, EasingMode.EaseOut);
|
||||||
|
VerifyZoomAnimation(cursorPos, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Invalidate();
|
|
||||||
selectedCaptureWindow = null;
|
selectedCaptureWindow = null;
|
||||||
OnMouseMove(this, new MouseEventArgs(MouseButtons.None, 0, Cursor.Position.X, Cursor.Position.Y, 0));
|
OnMouseMove(this, new MouseEventArgs(MouseButtons.None, 0, Cursor.Position.X, Cursor.Position.Y, 0));
|
||||||
break;
|
break;
|
||||||
|
@ -363,13 +376,26 @@ namespace Greenshot.Forms {
|
||||||
updateFrame();
|
updateFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method to simplify check
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="animator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool isAnimating(IAnimator animator) {
|
||||||
|
if (animator == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return animator.hasNext;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// update the frame, this only invalidates
|
/// update the frame, this only invalidates
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void updateFrame() {
|
void updateFrame() {
|
||||||
Point lastPos = cursorPos.Clone();
|
Point lastPos = cursorPos.Clone();
|
||||||
cursorPos = mouseMovePos.Clone();
|
cursorPos = mouseMovePos.Clone();
|
||||||
if (selectedCaptureWindow != null && lastPos.Equals(cursorPos) && !zoomAnimator.hasNext && !windowAnimator.hasNext) {
|
|
||||||
|
if (selectedCaptureWindow != null && lastPos.Equals(cursorPos) && !isAnimating(zoomAnimator) && !isAnimating(windowAnimator)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +441,9 @@ namespace Greenshot.Forms {
|
||||||
captureRect.Offset(-capture.ScreenBounds.Location.X, -capture.ScreenBounds.Location.Y);
|
captureRect.Offset(-capture.ScreenBounds.Location.X, -capture.ScreenBounds.Location.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mouseDown && (CaptureMode.Window != captureMode)) {
|
|
||||||
|
Rectangle invalidateRectangle = Rectangle.Empty;
|
||||||
|
if (mouseDown && (captureMode != CaptureMode.Window)) {
|
||||||
int x1 = Math.Min(mX, lastPos.X);
|
int x1 = Math.Min(mX, lastPos.X);
|
||||||
int x2 = Math.Max(mX, lastPos.X);
|
int x2 = Math.Max(mX, lastPos.X);
|
||||||
int y1 = Math.Min(mY, lastPos.Y);
|
int y1 = Math.Min(mY, lastPos.Y);
|
||||||
|
@ -442,62 +470,70 @@ namespace Greenshot.Forms {
|
||||||
Size measureHeight = TextRenderer.MeasureText(textForHeight.ToString(), rulerFont);
|
Size measureHeight = TextRenderer.MeasureText(textForHeight.ToString(), rulerFont);
|
||||||
y1 -= measureWidth.Height + 10;
|
y1 -= measureWidth.Height + 10;
|
||||||
}
|
}
|
||||||
Rectangle invalidateRectangle = new Rectangle(x1,y1, x2-x1, y2-y1);
|
invalidateRectangle = new Rectangle(x1,y1, x2-x1, y2-y1);
|
||||||
Invalidate(invalidateRectangle);
|
Invalidate(invalidateRectangle);
|
||||||
|
} else if (captureMode != CaptureMode.Window) {
|
||||||
|
if (!conf.OptimizeForRDP) {
|
||||||
|
Rectangle allScreenBounds = WindowCapture.GetScreenBounds();
|
||||||
|
allScreenBounds.Location = WindowCapture.GetLocationRelativeToScreenBounds(allScreenBounds.Location);
|
||||||
|
if (verticalMove) {
|
||||||
|
// Before
|
||||||
|
invalidateRectangle = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, lastPos.Y - 2, this.Width + 2, 45);
|
||||||
|
Invalidate(invalidateRectangle);
|
||||||
|
// After
|
||||||
|
invalidateRectangle = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, cursorPos.Y - 2, this.Width + 2, 45);
|
||||||
|
Invalidate(invalidateRectangle);
|
||||||
|
}
|
||||||
|
if (horizontalMove) {
|
||||||
|
// Before
|
||||||
|
invalidateRectangle = GuiRectangle.GetGuiRectangle(lastPos.X - 2, allScreenBounds.Top, 75, this.Height + 2);
|
||||||
|
Invalidate(invalidateRectangle);
|
||||||
|
// After
|
||||||
|
invalidateRectangle = GuiRectangle.GetGuiRectangle(cursorPos.X - 2, allScreenBounds.Top, 75, this.Height + 2);
|
||||||
|
Invalidate(invalidateRectangle);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (captureMode == CaptureMode.Window) {
|
if (selectedCaptureWindow != null && !selectedCaptureWindow.Equals(lastWindow)) {
|
||||||
// Using a 50 Pixel offset to the left, top, to make sure the text is invalidated too
|
// Window changes, make new animation from current to target
|
||||||
const int SAFETY_SIZE = 25;
|
windowAnimator.ChangeDestination(captureRect, 10);
|
||||||
if (windowAnimator != null && windowAnimator.hasNext) {
|
}
|
||||||
Rectangle invalidateRectangle = windowAnimator.Current;
|
}
|
||||||
|
// always animate the Window area through to the last frame, so we see the fade-in/out untill the end
|
||||||
|
// Using a safety "offset" to make sure the text is invalidated too
|
||||||
|
const int SAFETY_SIZE = 30;
|
||||||
|
// Check if the
|
||||||
|
if (isAnimating(windowAnimator)) {
|
||||||
|
invalidateRectangle = windowAnimator.Current;
|
||||||
invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE);
|
invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE);
|
||||||
Invalidate(invalidateRectangle);
|
Invalidate(invalidateRectangle);
|
||||||
invalidateRectangle = windowAnimator.Next();
|
invalidateRectangle = windowAnimator.Next();
|
||||||
invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE);
|
invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE);
|
||||||
Invalidate(invalidateRectangle);
|
Invalidate(invalidateRectangle);
|
||||||
|
// Check if this was the last of the windows animations in the normal region capture.
|
||||||
|
if (captureMode != CaptureMode.Window && !isAnimating(windowAnimator)) {
|
||||||
|
Invalidate();
|
||||||
}
|
}
|
||||||
if (selectedCaptureWindow != null && !selectedCaptureWindow.Equals(lastWindow)) {
|
|
||||||
// Window changes, make new animation from current to target
|
|
||||||
if (windowAnimator.Last.Size == Size.Empty) {
|
|
||||||
windowAnimator = new RectangleAnimator(new Rectangle(cursorPos, Size.Empty), captureRect, 10, EasingType.Quintic, EasingMode.EaseOut);
|
|
||||||
} else {
|
|
||||||
windowAnimator.ChangeDestination(captureRect, 10);
|
|
||||||
}
|
|
||||||
Rectangle invalidateRectangle = new Rectangle(lastCaptureRect.Location, lastCaptureRect.Size);
|
|
||||||
invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE);
|
|
||||||
Invalidate(invalidateRectangle);
|
|
||||||
invalidateRectangle = new Rectangle(captureRect.Location, captureRect.Size);
|
|
||||||
invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE);
|
|
||||||
Invalidate(invalidateRectangle);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!conf.OptimizeForRDP) {
|
|
||||||
Rectangle allScreenBounds = WindowCapture.GetScreenBounds();
|
|
||||||
allScreenBounds.Location = WindowCapture.GetLocationRelativeToScreenBounds(allScreenBounds.Location);
|
|
||||||
if (verticalMove) {
|
|
||||||
Rectangle before = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, lastPos.Y - 2, this.Width+2, 45);
|
|
||||||
Rectangle after = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, cursorPos.Y - 2, this.Width+2, 45);
|
|
||||||
Invalidate(before);
|
|
||||||
Invalidate(after);
|
|
||||||
}
|
|
||||||
if (horizontalMove) {
|
|
||||||
Rectangle before = GuiRectangle.GetGuiRectangle(lastPos.X - 2, allScreenBounds.Top, 75, this.Height+2);
|
|
||||||
Rectangle after = GuiRectangle.GetGuiRectangle(cursorPos.X -2, allScreenBounds.Top, 75, this.Height+2);
|
|
||||||
Invalidate(before);
|
|
||||||
Invalidate(after);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (isAnimating(zoomAnimator) || captureMode != CaptureMode.Window) {
|
||||||
}
|
// Make sure we invalidate the old zoom area
|
||||||
}
|
invalidateRectangle = zoomAnimator.Current;
|
||||||
|
invalidateRectangle.Offset(lastPos);
|
||||||
|
Invalidate(invalidateRectangle);
|
||||||
|
// Only verify if we are really showing the zoom, not the outgoing animation
|
||||||
if (isZooming && captureMode != CaptureMode.Window) {
|
if (isZooming && captureMode != CaptureMode.Window) {
|
||||||
Rectangle zoomArea = zoomAnimator.Current;
|
|
||||||
zoomArea.Offset(lastPos);
|
|
||||||
Invalidate(zoomArea);
|
|
||||||
VerifyZoomAnimation(cursorPos, false);
|
VerifyZoomAnimation(cursorPos, false);
|
||||||
zoomArea = zoomAnimator.Next();
|
}
|
||||||
zoomArea.Offset(cursorPos);
|
// The following logic is not needed, next always returns the current if there are no frames left
|
||||||
Invalidate(zoomArea);
|
// but it makes more sense if we want to change something in the logic
|
||||||
|
if (isAnimating(zoomAnimator)) {
|
||||||
|
invalidateRectangle = zoomAnimator.Next();
|
||||||
|
} else {
|
||||||
|
invalidateRectangle = zoomAnimator.Current;
|
||||||
|
}
|
||||||
|
invalidateRectangle.Offset(cursorPos);
|
||||||
|
Invalidate(invalidateRectangle);
|
||||||
}
|
}
|
||||||
// Force update "now"
|
// Force update "now"
|
||||||
Update();
|
Update();
|
||||||
|
@ -545,9 +581,6 @@ namespace Greenshot.Forms {
|
||||||
if (destinationLocation == Point.Empty && !allowZoomOverCaptureRect) {
|
if (destinationLocation == Point.Empty && !allowZoomOverCaptureRect) {
|
||||||
VerifyZoomAnimation(pos, true);
|
VerifyZoomAnimation(pos, true);
|
||||||
} else {
|
} else {
|
||||||
// Change animation to destination "small with the mouse-cursor at the center"
|
|
||||||
//zoomAnimator.ChangeDestination(new Rectangle(new Point(-10, -10), new Size(20, 20)));
|
|
||||||
//zoomAnimator.QueueDestinationLeg(new Rectangle(destinationLocation, zoomSize));
|
|
||||||
zoomAnimator.ChangeDestination(new Rectangle(destinationLocation, zoomSize));
|
zoomAnimator.ChangeDestination(new Rectangle(destinationLocation, zoomSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -560,7 +593,7 @@ namespace Greenshot.Forms {
|
||||||
/// <param name="sourceRectangle"></param>
|
/// <param name="sourceRectangle"></param>
|
||||||
/// <param name="destinationRectangle"></param>
|
/// <param name="destinationRectangle"></param>
|
||||||
private void DrawZoom(Graphics graphics, Rectangle sourceRectangle, Rectangle destinationRectangle) {
|
private void DrawZoom(Graphics graphics, Rectangle sourceRectangle, Rectangle destinationRectangle) {
|
||||||
if (capturedImage == null || !isZooming) {
|
if (capturedImage == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,11 +677,12 @@ namespace Greenshot.Forms {
|
||||||
graphics.DrawIcon(capture.Cursor, capture.CursorLocation.X, capture.CursorLocation.Y);
|
graphics.DrawIcon(capture.Cursor, capture.CursorLocation.X, capture.CursorLocation.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouseDown || captureMode == CaptureMode.Window) {
|
if (mouseDown || captureMode == CaptureMode.Window || isAnimating(windowAnimator)) {
|
||||||
captureRect.Intersect(new Rectangle(Point.Empty, capture.ScreenBounds.Size)); // crop what is outside the screen
|
captureRect.Intersect(new Rectangle(Point.Empty, capture.ScreenBounds.Size)); // crop what is outside the screen
|
||||||
|
|
||||||
Rectangle fixedRect;
|
Rectangle fixedRect;
|
||||||
if (captureMode == CaptureMode.Window) {
|
//if (captureMode == CaptureMode.Window) {
|
||||||
|
if (isAnimating(windowAnimator)) {
|
||||||
// Use the animator
|
// Use the animator
|
||||||
fixedRect = windowAnimator.Current;
|
fixedRect = windowAnimator.Current;
|
||||||
} else {
|
} else {
|
||||||
|
@ -780,7 +814,8 @@ namespace Greenshot.Forms {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (captureMode != CaptureMode.Window) {
|
// Zoom
|
||||||
|
if (isAnimating(zoomAnimator) || captureMode != CaptureMode.Window) {
|
||||||
const int zoomSourceWidth = 25;
|
const int zoomSourceWidth = 25;
|
||||||
const int zoomSourceHeight = 25;
|
const int zoomSourceHeight = 25;
|
||||||
|
|
||||||
|
@ -789,7 +824,6 @@ namespace Greenshot.Forms {
|
||||||
Rectangle destinationRectangle = zoomAnimator.Current;
|
Rectangle destinationRectangle = zoomAnimator.Current;
|
||||||
destinationRectangle.Offset(cursorPos);
|
destinationRectangle.Offset(cursorPos);
|
||||||
DrawZoom(graphics, sourceRectangle, destinationRectangle);
|
DrawZoom(graphics, sourceRectangle, destinationRectangle);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -24,18 +24,44 @@ using System.Drawing.Drawing2D;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Greenshot.Helpers {
|
namespace Greenshot.Helpers {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper interface for passing base type
|
||||||
|
/// </summary>
|
||||||
|
public interface IAnimator {
|
||||||
|
/// <summary>
|
||||||
|
/// Is there a next frame?
|
||||||
|
/// </summary>
|
||||||
|
bool hasNext {
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// The amount of frames
|
||||||
|
/// </summary>
|
||||||
|
int Frames {
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current frame number
|
||||||
|
/// </summary>
|
||||||
|
int CurrentFrameNr {
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base class for the animation logic, this only implements Properties and a constructor
|
/// Base class for the animation logic, this only implements Properties and a constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">Type for the animation, like Point/Rectangle/Size</typeparam>
|
/// <typeparam name="T">Type for the animation, like Point/Rectangle/Size</typeparam>
|
||||||
public abstract class AnimatorBase<T> {
|
public abstract class AnimatorBase<T> : IAnimator {
|
||||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(AnimatorBase<T>));
|
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(AnimatorBase<T>));
|
||||||
protected T first;
|
protected T first;
|
||||||
protected T last;
|
protected T last;
|
||||||
protected T current;
|
protected T current;
|
||||||
protected Queue<T> queue = new Queue<T>();
|
protected Queue<T> queue = new Queue<T>();
|
||||||
protected double frames;
|
protected int frames;
|
||||||
protected double currentFrame = 0;
|
protected int currentFrameNr = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
@ -57,15 +83,15 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of frames
|
/// The amount of frames
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Frames {
|
public int Frames {
|
||||||
get { return frames; }
|
get { return frames; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current frame number
|
/// Current frame number
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double CurrentFrame {
|
public int CurrentFrameNr {
|
||||||
get { return currentFrame; }
|
get { return currentFrameNr; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -107,12 +133,12 @@ namespace Greenshot.Helpers {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newDestination"></param>
|
/// <param name="newDestination"></param>
|
||||||
/// <param name="frames"></param>
|
/// <param name="frames"></param>
|
||||||
public void ChangeDestination(T newDestination, double frames) {
|
public void ChangeDestination(T newDestination, int frames) {
|
||||||
|
queue.Clear();
|
||||||
this.first = current;
|
this.first = current;
|
||||||
this.currentFrame = 0;
|
this.currentFrameNr = 0;
|
||||||
this.frames = frames;
|
this.frames = frames;
|
||||||
this.last = newDestination;
|
this.last = newDestination;
|
||||||
queue.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -146,12 +172,12 @@ namespace Greenshot.Helpers {
|
||||||
get {
|
get {
|
||||||
switch (EasingMode) {
|
switch (EasingMode) {
|
||||||
case EasingMode.EaseOut:
|
case EasingMode.EaseOut:
|
||||||
return Easing.EaseOut(currentFrame / frames, EasingType);
|
return Easing.EaseOut((double)currentFrameNr / (double)frames, EasingType);
|
||||||
case EasingMode.EaseInOut:
|
case EasingMode.EaseInOut:
|
||||||
return Easing.EaseInOut(currentFrame / frames, EasingType);
|
return Easing.EaseInOut((double)currentFrameNr / (double)frames, EasingType);
|
||||||
case EasingMode.EaseIn:
|
case EasingMode.EaseIn:
|
||||||
default:
|
default:
|
||||||
return Easing.EaseIn(currentFrame / frames, EasingType);
|
return Easing.EaseIn((double)currentFrameNr / (double)frames, EasingType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,14 +196,14 @@ namespace Greenshot.Helpers {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool NextFrame {
|
public virtual bool NextFrame {
|
||||||
get {
|
get {
|
||||||
if (currentFrame < frames) {
|
if (currentFrameNr < frames) {
|
||||||
currentFrame++;
|
currentFrameNr++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (queue.Count > 0) {
|
if (queue.Count > 0) {
|
||||||
this.first = current;
|
this.first = current;
|
||||||
this.last = queue.Dequeue();
|
this.last = queue.Dequeue();
|
||||||
this.currentFrame = 0;
|
this.currentFrameNr = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -189,7 +215,7 @@ namespace Greenshot.Helpers {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool hasNext {
|
public virtual bool hasNext {
|
||||||
get {
|
get {
|
||||||
if (currentFrame < frames) {
|
if (currentFrameNr < frames) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return queue.Count > 0;
|
return queue.Count > 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue