Changed logic of the DWM capture which tries to keep the window to capture on it's location, so less movement is visible. Also added a BoxBlur which might be a faster replacement of the CreateBlur (which is Gaussian), but the quality needs to be checked. For the BoxBlur the BitmapBuffer is extended with a few new tricks.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2245 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-11-06 15:59:19 +00:00
parent 15d5bb58e4
commit f63d4ca06e
5 changed files with 200 additions and 25 deletions

View file

@ -62,6 +62,12 @@ namespace GreenshotPlugin.Core {
}
}
public PixelFormat PixelFormat {
get {
return bitmap.PixelFormat;
}
}
[NonSerialized]
private BitmapData bmData;
[NonSerialized]
@ -69,6 +75,8 @@ namespace GreenshotPlugin.Core {
[NonSerialized]
private byte* pointer;
[NonSerialized]
private int* intPointer;
[NonSerialized]
private int stride; /* bytes per pixel row */
[NonSerialized]
private int aIndex = -1;
@ -219,7 +227,8 @@ namespace GreenshotPlugin.Core {
bitsLocked = true;
IntPtr Scan0 = bmData.Scan0;
pointer = (byte*)(void*)Scan0;
pointer = (byte*)(void*)Scan0;
intPointer = (int*)(void*)Scan0;
PrepareForPixelFormat();
stride = bmData.Stride;
@ -300,6 +309,28 @@ namespace GreenshotPlugin.Core {
pointer[offset] = color;
}
/// <summary>
/// Use only when 32-bit bitmap!
/// </summary>
/// <param name="x">x</param>
/// <param name="y">y</param>
/// <returns>int with argb value</returns>
public int GetARGB(int x, int y) {
int offset = (y * (stride >> 2)) + x;
return intPointer[offset];
}
/// <summary>
/// Use only when 32-bit bitmap!
/// </summary>
/// <param name="x">x</param>
/// <param name="y">y</param>
/// <param name="argb">argb value</param>
public void SetARGB(int x, int y, int argb) {
int offset = (y * (stride>>2)) + x;
intPointer[offset] = argb;
}
/// <summary>
/// Retrieve the color at location x,y
/// Before the first time this is called the Lock() should be called once!
@ -372,6 +403,18 @@ namespace GreenshotPlugin.Core {
}
}
/**
* Retrieve the color at location x,y to a byte[]
* Before the first time this is called the Lock() should be called once!
*/
public void GetUncheckedColorIn(int x, int y, byte[] color) {
int offset = x * bytesPerPixel + y * stride;
color[0] = (aIndex == -1) ? (byte)255 : (byte)pointer[aIndex + offset];
color[1] = pointer[rIndex + offset];
color[2] = pointer[gIndex + offset];
color[3] = pointer[bIndex + offset];
}
/**
* Retrieve the color at location x,y to a byte[]
* Before the first time this is called the Lock() should be called once!