mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 18:57:28 -07:00
This fixes a bug in the resize logic, the colors of the edges were not calculated correctly by GDI. Also added some additional dispose calls.
This commit is contained in:
parent
823d85ecdd
commit
089eec769e
5 changed files with 22 additions and 12 deletions
|
@ -45,7 +45,6 @@ namespace Greenshot.Drawing.Filters {
|
|||
|
||||
public unsafe override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) {
|
||||
int blurRadius = GetFieldValueAsInt(FieldType.BLUR_RADIUS);
|
||||
double previewQuality = GetFieldValueAsDouble(FieldType.PREVIEW_QUALITY);
|
||||
Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);
|
||||
if (applyRect.Width == 0 || applyRect.Height == 0) {
|
||||
return;
|
||||
|
|
|
@ -55,8 +55,9 @@ namespace Greenshot.Drawing.Filters {
|
|||
graphics.ExcludeClip(rect);
|
||||
}
|
||||
float brightness = GetFieldValueAsFloat(FieldType.BRIGHTNESS);
|
||||
ImageAttributes ia = ImageHelper.CreateAdjustAttributes(brightness, 1f, 1f);
|
||||
graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia);
|
||||
using (ImageAttributes ia = ImageHelper.CreateAdjustAttributes(brightness, 1f, 1f)) {
|
||||
graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia);
|
||||
}
|
||||
graphics.Restore(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,10 @@ namespace Greenshot.Drawing.Filters {
|
|||
new float[] {0, 0, 0, 1, 0},
|
||||
new float[] {0, 0, 0, 0, 1}
|
||||
});
|
||||
ImageAttributes ia = new ImageAttributes();
|
||||
ia.SetColorMatrix(grayscaleMatrix);
|
||||
graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia);
|
||||
using (ImageAttributes ia = new ImageAttributes()) {
|
||||
ia.SetColorMatrix(grayscaleMatrix);
|
||||
graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia);
|
||||
}
|
||||
graphics.Restore(state);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue