Added key handling for the effects and added a clear operation. Also some code cleanup.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2360 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-12-06 17:06:26 +00:00
parent 82eddefe4e
commit e148f2103c
3 changed files with 70 additions and 38 deletions

View file

@ -753,11 +753,17 @@ namespace Greenshot.Drawing {
}
}
/// <summary>
/// Handle the drag/drop
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnDragDrop(object sender, DragEventArgs e) {
List<string> filenames = GetFilenames(e);
Point mouse = this.PointToClient(new Point(e.X, e.Y));
if (e.Data.GetDataPresent("Text")) {
string possibleUrl = (string)e.Data.GetData("Text");
// Test if it's an url and try to download the image so we have it in the original form
if (possibleUrl != null && possibleUrl.StartsWith("http")) {
using (Bitmap image = NetworkHelper.DownloadImage(possibleUrl)) {
if (image != null) {
@ -867,6 +873,21 @@ namespace Greenshot.Drawing {
}
}
/// <summary>
/// A simple clear
/// </summary>
/// <param name="newColor">The color for the background</param>
public void Clear(Color newColor) {
//create a blank bitmap the same size as original
Bitmap newBitmap = ImageHelper.CreateEmptyLike((Bitmap)Image, Color.Empty);
if (newBitmap != null) {
// Make undoable
MakeUndoable(new SurfaceBackgroundChangeMemento(this, Point.Empty), false);
SetImage(newBitmap, false);
Invalidate();
}
}
/// <summary>
/// Apply a bitmap effect to the surface
/// </summary>