mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
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:
parent
652ca64e9f
commit
ec5840550a
4 changed files with 29 additions and 12 deletions
|
@ -165,7 +165,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
return (IntPtr)FIELD_INFO_NATIVE_IMAGEATTRIBUTES.GetValue(imageAttributes);
|
||||
}
|
||||
|
||||
private static bool canApply(int radius) {
|
||||
private static bool isBlurPossible(int radius) {
|
||||
if (Environment.OSVersion.Version.Major < 6) {
|
||||
return false;
|
||||
} else if ((Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 2) && radius < 20) {
|
||||
|
@ -183,8 +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 (!canApply(radius))
|
||||
{
|
||||
if (!isBlurPossible(radius)) {
|
||||
return false;
|
||||
}
|
||||
IntPtr hBlurParams = IntPtr.Zero;
|
||||
|
@ -238,8 +237,7 @@ 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 (!canApply(radius))
|
||||
{
|
||||
if (!isBlurPossible(radius)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -279,7 +277,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
// Everything worked, return true
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
LOG.Error("Problem using GdipBitmapApplyEffect: ", ex);
|
||||
LOG.Error("Problem using GdipDrawImageFX: ", ex);
|
||||
return false;
|
||||
} finally {
|
||||
if (hEffect != null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue