Cleanup, and fixed a bug in the CloneArea method of the ImageHelper.cs

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2506 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2013-02-22 16:27:55 +00:00
commit ec5840550a
4 changed files with 29 additions and 12 deletions

View file

@ -128,6 +128,14 @@ namespace GreenshotPlugin.Core {
/// <param name="graphics">Graphics</param>
/// <param name="destinationRect">Rectangle with destination</param>
void DrawTo(Graphics graphics, Rectangle destinationRect);
/// <summary>
/// Return true if the coordinates are inside the FastBitmap
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
bool Contains(int x, int y);
}
/// <summary>
@ -416,6 +424,16 @@ namespace GreenshotPlugin.Core {
}
}
/// <summary>
/// returns true if x & y are inside the FastBitmap
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns>true if x & y are inside the FastBitmap</returns>
public bool Contains(int x, int y) {
return x >= 0 && x < Width && y >= 0 && y < Height;
}
public abstract Color GetColorAt(int x, int y);
public abstract void SetColorAt(int x, int y, Color color);
public abstract void GetColorAt(int x, int y, byte[] color);

View file

@ -1197,6 +1197,8 @@ namespace GreenshotPlugin.Core {
// Make sure the source is not Rectangle.Empty
if (Rectangle.Empty.Equals(sourceRect)) {
sourceRect = new Rectangle(0, 0, sourceImage.Width, sourceImage.Height);
} else {
sourceRect.Intersect(bitmapRect);
}
// If no pixelformat is supplied