mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 14:03:23 -07:00
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:
parent
72d3de218b
commit
afc9c37ce5
2 changed files with 50 additions and 12 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue