More fixes for the resize code.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1763 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-04-08 19:11:55 +00:00
commit afc9c37ce5
2 changed files with 50 additions and 12 deletions

View file

@ -564,6 +564,26 @@ namespace Greenshot.Drawing {
Invalidate();
SurfaceSizeChanged(this);
}
/// <summary>
/// Resize bitmap
/// </summary>
/// <param name="backgroundColor"></param>
/// <param name="left"></param>
/// <param name="right"></param>
/// <param name="top"></param>
/// <param name="bottom"></param>
public void ResizeBitmap(bool lockAspectRatio, bool canvasUsedNewSize, Color backgroundColor, int newWidth, int newHeight) {
Point offset;
Bitmap newImage = ImageHelper.ResizeBitmap((Bitmap)Image, lockAspectRatio, canvasUsedNewSize, backgroundColor, newWidth, newHeight, out offset);
// Make sure the elements move according to the offset the effect made the bitmap move
elements.MoveBy(offset.X, offset.Y);
// Make undoable
MakeUndoable(new SurfaceBackgroundChangeMemento(this, offset), false);
SetImage(newImage, false);
Invalidate();
SurfaceSizeChanged(this);
}
/// <summary>
/// Apply a bitmap effect to the surface