mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 05:53:27 -07:00
Merge remote-tracking branch 'remotes/origin/master' into release/1.2.9
This commit is contained in:
commit
0323705513
276 changed files with 5382 additions and 3666 deletions
|
@ -41,7 +41,7 @@ namespace Greenshot.Drawing.Filters {
|
|||
remove{ propertyChanged -= value; }
|
||||
}
|
||||
|
||||
private bool invert = false;
|
||||
private bool invert;
|
||||
public bool Invert {
|
||||
get {
|
||||
return invert;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Greenshot.Drawing.Fields;
|
||||
|
@ -25,13 +26,10 @@ using Greenshot.Plugin.Drawing;
|
|||
using GreenshotPlugin.Core;
|
||||
using GreenshotPlugin.UnmanagedHelpers;
|
||||
using System.Drawing.Drawing2D;
|
||||
using log4net;
|
||||
|
||||
namespace Greenshot.Drawing.Filters {
|
||||
[Serializable()]
|
||||
public class BlurFilter : AbstractFilter {
|
||||
private static ILog LOG = LogManager.GetLogger(typeof(BlurFilter));
|
||||
|
||||
public double previewQuality;
|
||||
public double PreviewQuality {
|
||||
get { return previewQuality; }
|
||||
|
@ -43,7 +41,7 @@ namespace Greenshot.Drawing.Filters {
|
|||
AddField(GetType(), FieldType.PREVIEW_QUALITY, 1.0d);
|
||||
}
|
||||
|
||||
public unsafe override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) {
|
||||
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) {
|
||||
int blurRadius = GetFieldValueAsInt(FieldType.BLUR_RADIUS);
|
||||
Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);
|
||||
if (applyRect.Width == 0 || applyRect.Height == 0) {
|
||||
|
@ -54,7 +52,7 @@ namespace Greenshot.Drawing.Filters {
|
|||
graphics.SetClip(applyRect);
|
||||
graphics.ExcludeClip(rect);
|
||||
}
|
||||
if (GDIplus.isBlurPossible(blurRadius)) {
|
||||
if (GDIplus.IsBlurPossible(blurRadius)) {
|
||||
GDIplus.DrawWithBlur(graphics, applyBitmap, applyRect, null, null, blurRadius, false);
|
||||
} else {
|
||||
using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect)) {
|
||||
|
@ -63,7 +61,6 @@ namespace Greenshot.Drawing.Filters {
|
|||
}
|
||||
}
|
||||
graphics.Restore(state);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
using Greenshot.Drawing.Fields;
|
||||
using Greenshot.Plugin.Drawing;
|
||||
using GreenshotPlugin.Interfaces.Drawing;
|
||||
|
||||
namespace Greenshot.Drawing.Filters {
|
||||
namespace Greenshot.Drawing.Filters
|
||||
{
|
||||
public interface IFilter : INotifyPropertyChanged, IFieldHolder {
|
||||
DrawableContainer Parent {get; set; }
|
||||
void Apply(Graphics graphics, Bitmap bmp, Rectangle rect, RenderMode renderMode);
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace Greenshot.Drawing.Filters {
|
|||
int halfHeight = rect.Height / 2;
|
||||
int newWidth = rect.Width / magnificationFactor;
|
||||
int newHeight = rect.Height / magnificationFactor;
|
||||
Rectangle source = new Rectangle(rect.X + halfWidth - (newWidth / 2), rect.Y + halfHeight - (newHeight / 2), newWidth, newHeight);
|
||||
Rectangle source = new Rectangle(rect.X + halfWidth - newWidth / 2, rect.Y + halfHeight - newHeight / 2, newWidth, newHeight);
|
||||
graphics.DrawImage(applyBitmap, rect, source, GraphicsUnit.Pixel);
|
||||
graphics.Restore(state);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Greenshot.Drawing.Filters {
|
|||
|
||||
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) {
|
||||
int pixelSize = GetFieldValueAsInt(FieldType.PIXEL_SIZE);
|
||||
Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);
|
||||
ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);
|
||||
if (pixelSize <= 1 || rect.Width == 0 || rect.Height == 0) {
|
||||
// Nothing to do
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue