mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 14:24:43 -07:00
Did some performance improvements for the CreateShadow, without using our Gaussian (is still available) this saves a temporarily additional bitmap copy. On Vista/Windows 7 GDI+ is used, on other systems a fall-back with BoxBlur is used.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2496 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
9d1b0e5dc4
commit
0989012a37
3 changed files with 268 additions and 119 deletions
|
@ -164,7 +164,16 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
}
|
||||
return (IntPtr)FIELD_INFO_NATIVE_IMAGEATTRIBUTES.GetValue(imageAttributes);
|
||||
}
|
||||
|
||||
|
||||
private static bool canApply() {
|
||||
if (Environment.OSVersion.Version.Major < 6) {
|
||||
return false;
|
||||
} else if ((Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 2) && radius < 20) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the GDI+ blur effect on the bitmap
|
||||
/// </summary>
|
||||
|
@ -174,7 +183,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
/// <param name="expandEdges">bool true if the edges are expanded with the radius</param>
|
||||
/// <returns>false if there is no GDI+ available or an exception occured</returns>
|
||||
public static bool ApplyBlur(Bitmap destinationBitmap, Rectangle area, int radius, bool expandEdges) {
|
||||
if (Environment.OSVersion.Version.Major < 6) {
|
||||
if (!canApply()) {
|
||||
return false;
|
||||
}
|
||||
IntPtr hBlurParams = IntPtr.Zero;
|
||||
|
@ -228,11 +237,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
/// </summary>
|
||||
/// <returns>false if there is no GDI+ available or an exception occured</returns>
|
||||
public static bool DrawWithBlur(Graphics graphics, Bitmap image, Rectangle source, Matrix transform, ImageAttributes imageAttributes, int radius, bool expandEdges) {
|
||||
if (Environment.OSVersion.Version.Major < 6) {
|
||||
return false;
|
||||
} else if ((Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 2) && radius < 20) {
|
||||
if (!canApply()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IntPtr hBlurParams = IntPtr.Zero;
|
||||
IntPtr hEffect = IntPtr.Zero;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue