mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 21:43:24 -07:00
Overlooked a file, this belongs to the previous commit!
This commit is contained in:
parent
2f20c0820c
commit
3eaaf9a49f
1 changed files with 9 additions and 5 deletions
|
@ -23,6 +23,7 @@ using System.Drawing;
|
||||||
|
|
||||||
using Greenshot.Drawing;
|
using Greenshot.Drawing;
|
||||||
using Greenshot.Configuration;
|
using Greenshot.Configuration;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
namespace Greenshot.Memento {
|
namespace Greenshot.Memento {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -31,12 +32,14 @@ namespace Greenshot.Memento {
|
||||||
public class SurfaceBackgroundChangeMemento : IMemento {
|
public class SurfaceBackgroundChangeMemento : IMemento {
|
||||||
private Image image;
|
private Image image;
|
||||||
private Surface surface;
|
private Surface surface;
|
||||||
private Point offset;
|
private Matrix matrix;
|
||||||
|
|
||||||
public SurfaceBackgroundChangeMemento(Surface surface, Point offset) {
|
public SurfaceBackgroundChangeMemento(Surface surface, Matrix matrix) {
|
||||||
this.surface = surface;
|
this.surface = surface;
|
||||||
image = surface.Image;
|
image = surface.Image;
|
||||||
this.offset = new Point(-offset.X, -offset.Y);
|
this.matrix = (Matrix)matrix.Clone();
|
||||||
|
// Make sure the reverse is applied
|
||||||
|
this.matrix.Invert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
|
@ -66,8 +69,9 @@ namespace Greenshot.Memento {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMemento Restore() {
|
public IMemento Restore() {
|
||||||
SurfaceBackgroundChangeMemento oldState = new SurfaceBackgroundChangeMemento(surface, offset);
|
SurfaceBackgroundChangeMemento oldState = new SurfaceBackgroundChangeMemento(surface, matrix);
|
||||||
surface.UndoBackgroundChange(image, offset);
|
|
||||||
|
surface.UndoBackgroundChange(image, matrix);
|
||||||
surface.Invalidate();
|
surface.Invalidate();
|
||||||
return oldState;
|
return oldState;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue