mirror of
https://github.com/greenshot/greenshot
synced 2025-08-24 15:16:24 -07:00
Implement review hints
This commit is contained in:
parent
3a55822049
commit
2a52e72c24
6 changed files with 194 additions and 204 deletions
|
@ -85,20 +85,15 @@ namespace Greenshot.Editor.Drawing
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
InitCropStyle();
|
CreateDefaultAdorners();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitCropStyle()
|
|
||||||
{
|
|
||||||
CreateDefaultAdorners();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitHorizontalCropOutStyle()
|
private void InitHorizontalCropOutStyle()
|
||||||
{
|
{
|
||||||
var defaultHeight = 25;
|
const int defaultHeight = 25;
|
||||||
|
|
||||||
if (_parent?.Image is { } image)
|
if (_parent?.Image is { } image)
|
||||||
{
|
{
|
||||||
|
@ -109,7 +104,7 @@ namespace Greenshot.Editor.Drawing
|
||||||
|
|
||||||
private void InitVerticalCropOutStyle()
|
private void InitVerticalCropOutStyle()
|
||||||
{
|
{
|
||||||
var defaultWidth = 25;
|
const int defaultWidth = 25;
|
||||||
|
|
||||||
if (_parent?.Image is { } image)
|
if (_parent?.Image is { } image)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1188,8 +1188,8 @@ namespace Greenshot.Editor.Drawing
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool ApplyCrop(Rectangle cropRectangle)
|
public bool ApplyCrop(Rectangle cropRectangle)
|
||||||
{
|
{
|
||||||
if (IsCropPossible(ref cropRectangle))
|
if (!IsCropPossible(ref cropRectangle)) return false;
|
||||||
{
|
|
||||||
Rectangle imageRectangle = new Rectangle(Point.Empty, Image.Size);
|
Rectangle imageRectangle = new Rectangle(Point.Empty, Image.Size);
|
||||||
Bitmap tmpImage;
|
Bitmap tmpImage;
|
||||||
// Make sure we have information, this this fails
|
// Make sure we have information, this this fails
|
||||||
|
@ -1223,9 +1223,6 @@ namespace Greenshot.Editor.Drawing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Crop out the surface
|
/// Crop out the surface
|
||||||
/// Splits the image in 3 parts(top, middle, bottom). Crop out the middle and joins top and bottom.
|
/// Splits the image in 3 parts(top, middle, bottom). Crop out the middle and joins top and bottom.
|
||||||
|
@ -1234,8 +1231,8 @@ namespace Greenshot.Editor.Drawing
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool ApplyHorizontalCrop(Rectangle cropRectangle)
|
public bool ApplyHorizontalCrop(Rectangle cropRectangle)
|
||||||
{
|
{
|
||||||
if (IsCropPossible(ref cropRectangle))
|
if (!IsCropPossible(ref cropRectangle)) return false;
|
||||||
{
|
|
||||||
Rectangle imageRectangle = new Rectangle(Point.Empty, Image.Size);
|
Rectangle imageRectangle = new Rectangle(Point.Empty, Image.Size);
|
||||||
Bitmap tmpNewimage, tmpImageTop, tmpImageBottom;
|
Bitmap tmpNewimage, tmpImageTop, tmpImageBottom;
|
||||||
// Make sure we have information, this this fails
|
// Make sure we have information, this this fails
|
||||||
|
@ -1257,6 +1254,8 @@ namespace Greenshot.Editor.Drawing
|
||||||
g.DrawImage(tmpImageTop, new Point(0, 0));
|
g.DrawImage(tmpImageTop, new Point(0, 0));
|
||||||
g.DrawImage(tmpImageBottom, new Point(0, tmpImageTop.Height));
|
g.DrawImage(tmpImageBottom, new Point(0, tmpImageTop.Height));
|
||||||
|
|
||||||
|
tmpImageTop.Dispose();
|
||||||
|
tmpImageBottom.Dispose();
|
||||||
|
|
||||||
Matrix matrix = new Matrix();
|
Matrix matrix = new Matrix();
|
||||||
matrix.Translate(0, -(cropRectangle.Top + cropRectangle.Height), MatrixOrder.Append);
|
matrix.Translate(0, -(cropRectangle.Top + cropRectangle.Height), MatrixOrder.Append);
|
||||||
|
@ -1276,9 +1275,6 @@ namespace Greenshot.Editor.Drawing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Crop out the surface
|
/// Crop out the surface
|
||||||
/// Splits the image in 3 parts(left, middle, right). Crop out the middle and joins top and bottom.
|
/// Splits the image in 3 parts(left, middle, right). Crop out the middle and joins top and bottom.
|
||||||
|
@ -1287,8 +1283,8 @@ namespace Greenshot.Editor.Drawing
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool ApplyVerticalCrop(Rectangle cropRectangle)
|
public bool ApplyVerticalCrop(Rectangle cropRectangle)
|
||||||
{
|
{
|
||||||
if (IsCropPossible(ref cropRectangle))
|
if (!IsCropPossible(ref cropRectangle)) return false;
|
||||||
{
|
|
||||||
Rectangle imageRectangle = new Rectangle(Point.Empty, Image.Size);
|
Rectangle imageRectangle = new Rectangle(Point.Empty, Image.Size);
|
||||||
Bitmap tmpNewimage, tmpImageLeft, tmpImageRight;
|
Bitmap tmpNewimage, tmpImageLeft, tmpImageRight;
|
||||||
// Make sure we have information, this this fails
|
// Make sure we have information, this this fails
|
||||||
|
@ -1311,6 +1307,9 @@ namespace Greenshot.Editor.Drawing
|
||||||
g.DrawImage(tmpImageLeft, new Point(0, 0));
|
g.DrawImage(tmpImageLeft, new Point(0, 0));
|
||||||
g.DrawImage(tmpImageRight, new Point(tmpImageLeft.Width, 0));
|
g.DrawImage(tmpImageRight, new Point(tmpImageLeft.Width, 0));
|
||||||
|
|
||||||
|
tmpImageLeft.Dispose();
|
||||||
|
tmpImageRight.Dispose();
|
||||||
|
|
||||||
Matrix matrix = new Matrix();
|
Matrix matrix = new Matrix();
|
||||||
matrix.Translate(-cropRectangle.Left - cropRectangle.Width, 0, MatrixOrder.Append);
|
matrix.Translate(-cropRectangle.Left - cropRectangle.Width, 0, MatrixOrder.Append);
|
||||||
// Make undoable
|
// Make undoable
|
||||||
|
@ -1329,9 +1328,6 @@ namespace Greenshot.Editor.Drawing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The background here is the captured image.
|
/// The background here is the captured image.
|
||||||
/// This is called from the SurfaceBackgroundChangeMemento.
|
/// This is called from the SurfaceBackgroundChangeMemento.
|
||||||
|
@ -2103,13 +2099,13 @@ namespace Greenshot.Editor.Drawing
|
||||||
|
|
||||||
public void RemoveCropContainer()
|
public void RemoveCropContainer()
|
||||||
{
|
{
|
||||||
if (_cropContainer != null)
|
if (_cropContainer == null) return;
|
||||||
{
|
|
||||||
RemoveElement(_cropContainer, false);
|
RemoveElement(_cropContainer, false);
|
||||||
_cropContainer.Dispose();
|
_cropContainer.Dispose();
|
||||||
_cropContainer = null;
|
_cropContainer = null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Paste all the elements that are on the clipboard
|
/// Paste all the elements that are on the clipboard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -728,13 +728,12 @@ namespace Greenshot.Editor.Forms
|
||||||
|
|
||||||
private void BtnCropClick(object sender, EventArgs e)
|
private void BtnCropClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_surface.DrawingMode != DrawingModes.Crop)
|
if (_surface.DrawingMode == DrawingModes.Crop) return;
|
||||||
{
|
|
||||||
_surface.DrawingMode = DrawingModes.Crop;
|
_surface.DrawingMode = DrawingModes.Crop;
|
||||||
InitCropMode((CropContainer.CropMode)_surface.FieldAggregator.GetField(FieldType.CROPMODE).Value);
|
InitCropMode((CropContainer.CropMode)_surface.FieldAggregator.GetField(FieldType.CROPMODE).Value);
|
||||||
RefreshFieldControls();
|
RefreshFieldControls();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void BtnHighlightClick(object sender, EventArgs e)
|
private void BtnHighlightClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue