diff --git a/Greenshot/Drawing/SpeechbubbleContainer.cs b/Greenshot/Drawing/SpeechbubbleContainer.cs index a2e705fba..1286a44bc 100644 --- a/Greenshot/Drawing/SpeechbubbleContainer.cs +++ b/Greenshot/Drawing/SpeechbubbleContainer.cs @@ -84,6 +84,7 @@ namespace Greenshot.Drawing { graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.PixelOffsetMode = PixelOffsetMode.None; + graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR); Color fillColor = GetFieldValueAsColor(FieldType.FILL_COLOR); @@ -174,11 +175,6 @@ namespace Greenshot.Drawing { // Draw the text UpdateFormat(); - graphics.SmoothingMode = SmoothingMode.HighQuality; - graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; - graphics.CompositingQuality = CompositingQuality.HighQuality; - graphics.PixelOffsetMode = PixelOffsetMode.None; - graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; DrawText(graphics, rect, lineThickness, ControlPaint.Dark(lineColor, 0.25f ), false, StringFormat, Text, Font); } diff --git a/Greenshot/Drawing/StepLabelContainer.cs b/Greenshot/Drawing/StepLabelContainer.cs index 074b3c276..704e4c68e 100644 --- a/Greenshot/Drawing/StepLabelContainer.cs +++ b/Greenshot/Drawing/StepLabelContainer.cs @@ -21,11 +21,13 @@ using Greenshot.Drawing.Fields; using Greenshot.Helpers; +using Greenshot.Plugin; using Greenshot.Plugin.Drawing; using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; +using System.Drawing.Text; namespace Greenshot.Drawing { /// @@ -42,7 +44,7 @@ namespace Greenshot.Drawing { private bool drawAsRectangle = false; public StepLabelContainer(Surface parent) : base(parent) { - parent.StepContainers.AddLast(this); + parent.AddStepLabel(this); InitContent(); } @@ -72,27 +74,22 @@ namespace Greenshot.Drawing { /// Make sure this element is no longer referenced from the surface /// public override void Dispose() { - Parent.StepContainers.Remove(this); + Parent.RemoveStepLabel(this); base.Dispose(); } - /// /// Override the parent, calculate the label number, than draw /// /// /// public override void Draw(Graphics graphics, RenderMode rm) { - int number = 1; - foreach (StepLabelContainer possibleThis in Parent.StepContainers) { - if (possibleThis == this) { - break; - } - if (Parent.IsOnSurface(possibleThis)) { - number++; - } - } - string text = number.ToString(); + graphics.SmoothingMode = SmoothingMode.HighQuality; + graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; + graphics.CompositingQuality = CompositingQuality.HighQuality; + graphics.PixelOffsetMode = PixelOffsetMode.None; + graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; + string text = Parent.CountStepLabels(this).ToString(); Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height); Color fillColor = GetFieldValueAsColor(FieldType.FILL_COLOR); Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR); @@ -101,6 +98,7 @@ namespace Greenshot.Drawing { } else { EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false); } + TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, _font); } diff --git a/Greenshot/Drawing/Surface.cs b/Greenshot/Drawing/Surface.cs index ee5040193..10fe8f084 100644 --- a/Greenshot/Drawing/Surface.cs +++ b/Greenshot/Drawing/Surface.cs @@ -210,14 +210,33 @@ namespace Greenshot.Drawing { private Bitmap buffer = null; /// - /// all stepcontainers for the surface, needed with serialization + /// all stepLabels for the surface, needed with serialization /// - private readonly LinkedList _stepContainers = new LinkedList(); + private readonly LinkedList _stepLabels = new LinkedList(); - public LinkedList StepContainers { - get { - return _stepContainers; + public void AddStepLabel(IDrawableContainer stepLabel) { + _stepLabels.AddLast(stepLabel); + } + public void RemoveStepLabel(IDrawableContainer stepLabel) { + _stepLabels.Remove(stepLabel); + } + + /// + /// Count all the steplabels in the surface, up to the supplied one + /// + /// can be null, if not the counting stops here + /// number of steplabels before the supplied container + public int CountStepLabels(IDrawableContainer stopAtContainer) { + int number = 1; + foreach (StepLabelContainer possibleThis in _stepLabels) { + if (possibleThis == stopAtContainer) { + break; + } + if (IsOnSurface(possibleThis)) { + number++; + } } + return number; } /// diff --git a/Greenshot/Drawing/TextContainer.cs b/Greenshot/Drawing/TextContainer.cs index 1363381a7..26bbb5a39 100644 --- a/Greenshot/Drawing/TextContainer.cs +++ b/Greenshot/Drawing/TextContainer.cs @@ -360,7 +360,6 @@ namespace Greenshot.Drawing { if (lineThickness > 0) { drawingRectange.Inflate(-textOffset, -textOffset); } - graphics.SmoothingMode = SmoothingMode.HighQuality; using (Brush fontBrush = new SolidBrush(fontColor)) { if (stringFormat != null) { graphics.DrawString(text, font, fontBrush, drawingRectange, stringFormat); diff --git a/Greenshot/Forms/ImageEditorForm.Designer.cs b/Greenshot/Forms/ImageEditorForm.Designer.cs index 2e3c745c3..313d3e127 100644 --- a/Greenshot/Forms/ImageEditorForm.Designer.cs +++ b/Greenshot/Forms/ImageEditorForm.Designer.cs @@ -24,7 +24,8 @@ namespace Greenshot { /// Designer variable used to keep track of non-visual components. /// private System.ComponentModel.IContainer components = null; - + private System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImageEditorForm)); + /// /// Disposes resources used by the form. /// @@ -46,7 +47,6 @@ namespace Greenshot { /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImageEditorForm)); this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.dimensionsLabel = new System.Windows.Forms.ToolStripStatusLabel(); @@ -406,7 +406,7 @@ namespace Greenshot { // this.btnSpeechBubble.CheckOnClick = true; this.btnSpeechBubble.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.btnSpeechBubble.Image = ((System.Drawing.Image)(resources.GetObject("btnText.Image"))); + this.btnSpeechBubble.Image = ((System.Drawing.Image)(resources.GetObject("btnSpeechBubble.Image"))); this.btnSpeechBubble.ImageTransparentColor = System.Drawing.Color.Magenta; this.btnSpeechBubble.LanguageKey = "editor_drawtextbox"; this.btnSpeechBubble.Name = "btnSpeechBubble"; @@ -417,7 +417,7 @@ namespace Greenshot { // this.btnStepLabel.CheckOnClick = true; this.btnStepLabel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.btnStepLabel.Image = ((System.Drawing.Image)(resources.GetObject("btnText.Image"))); + this.btnStepLabel.Image = ((System.Drawing.Image)(resources.GetObject("btnStepLabel01.Image"))); this.btnStepLabel.ImageTransparentColor = System.Drawing.Color.Magenta; this.btnStepLabel.LanguageKey = "editor_drawtextbox"; this.btnStepLabel.Name = "btnStepLabel"; diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs index bbe86a537..f44be74b7 100644 --- a/Greenshot/Forms/ImageEditorForm.cs +++ b/Greenshot/Forms/ImageEditorForm.cs @@ -996,6 +996,12 @@ namespace Greenshot { /// refreshes all editor controls depending on selected elements and their fields /// private void refreshEditorControls() { + int stepLabels = surface.CountStepLabels(null); + if (stepLabels <= 20) { + this.btnStepLabel.Image = ((System.Drawing.Image)(resources.GetObject(string.Format("btnStepLabel{0:00}.Image", stepLabels)))); + } else { + this.btnStepLabel.Image = ((System.Drawing.Image)(resources.GetObject("btnStepLabel20+.Image"))); + } FieldAggregator props = surface.FieldAggregator; // if a confirmable element is selected, we must disable most of the controls // since we demand confirmation or cancel for confirmable element diff --git a/Greenshot/Forms/ImageEditorForm.resx b/Greenshot/Forms/ImageEditorForm.resx index b12d1ea91..2a5211541 100644 --- a/Greenshot/Forms/ImageEditorForm.resx +++ b/Greenshot/Forms/ImageEditorForm.resx @@ -201,6 +201,18 @@ NSAMYpNkgHn+egWnmh3Vh6+92XAUiEFskBhRhiilrw1UTl+T07TiYvvuiy9W7r78YiWIDRIDyWEYIpe4 wkUheUUriAZJKqQuz7/x9PPxCw8+7Dt2/c0WED5378NekBhIDsMAydiFff///z8DoiVjFpWRgsGGiUTM 8QbiaSCaKD+iKQIAuEYmAAjjsCcAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAFZSURBVDhPY2CgBjAu2+NqVLYrihQM0gO326xqd9Lrj98u + vvz4/RQxGKQWpAdugG31zuwX776f3Hn++Rq3hl31MAwSA2FkMZAakBhID9wAx9pdJa8/fj/nVL+zDCYI + Yj99//04CKOLg9SC9MANcG/YFetav7PGpX6XBUwQZMPT11+OgjCybSA1ILUgPXjD37xqZ8KdF1/2XXv4 + aRuITXJkmZbujj504+XSQ9deLgGxSTbApHRX7OHrb5aBMIhNsgHmlbtSD117vRKEQWySDbCt2lFw+Mbr + NSAMYpNkgHn+egWnmh3Vh6+92XAUiEFskBhRhiilrw1UTl+T07TiYvvuiy9W7r78YiWIDRIDyWEYIpe4 + wkUheUUriAZJKqQuz7/x9PPxCw8+7Dt2/c0WED5378NekBhIDsMAydiFff///z8DoiVjFpWRgsGGiUTM + 8QbiaSCaKD+iKQIAuEYmAAjjsCcAAAAASUVORK5CYII= @@ -927,6 +939,69 @@ igHkZijqZSZyXQAA4IG1TpHFZ2gAAAAASUVORK5CYII= + + ..\icons\notification-counter-01.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-02.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-03.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-04.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-05.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-06.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-07.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-08.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-09.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-10.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-11.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-13.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-14.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-15.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-17.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-18.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-19.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-20-plus.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\notification-counter-20.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + 551, 17 diff --git a/Greenshot/icons/balloon.png b/Greenshot/icons/balloon.png new file mode 100644 index 000000000..6a2640a2c Binary files /dev/null and b/Greenshot/icons/balloon.png differ diff --git a/Greenshot/icons/notification-counter-01.png b/Greenshot/icons/notification-counter-01.png new file mode 100644 index 000000000..b7119e340 Binary files /dev/null and b/Greenshot/icons/notification-counter-01.png differ diff --git a/Greenshot/icons/notification-counter-02.png b/Greenshot/icons/notification-counter-02.png new file mode 100644 index 000000000..d942c80ee Binary files /dev/null and b/Greenshot/icons/notification-counter-02.png differ diff --git a/Greenshot/icons/notification-counter-03.png b/Greenshot/icons/notification-counter-03.png new file mode 100644 index 000000000..9f5973804 Binary files /dev/null and b/Greenshot/icons/notification-counter-03.png differ diff --git a/Greenshot/icons/notification-counter-04.png b/Greenshot/icons/notification-counter-04.png new file mode 100644 index 000000000..4966b37db Binary files /dev/null and b/Greenshot/icons/notification-counter-04.png differ diff --git a/Greenshot/icons/notification-counter-05.png b/Greenshot/icons/notification-counter-05.png new file mode 100644 index 000000000..e566b3f5b Binary files /dev/null and b/Greenshot/icons/notification-counter-05.png differ diff --git a/Greenshot/icons/notification-counter-06.png b/Greenshot/icons/notification-counter-06.png new file mode 100644 index 000000000..04dc250cb Binary files /dev/null and b/Greenshot/icons/notification-counter-06.png differ diff --git a/Greenshot/icons/notification-counter-07.png b/Greenshot/icons/notification-counter-07.png new file mode 100644 index 000000000..19e2a1078 Binary files /dev/null and b/Greenshot/icons/notification-counter-07.png differ diff --git a/Greenshot/icons/notification-counter-08.png b/Greenshot/icons/notification-counter-08.png new file mode 100644 index 000000000..f3a650601 Binary files /dev/null and b/Greenshot/icons/notification-counter-08.png differ diff --git a/Greenshot/icons/notification-counter-09.png b/Greenshot/icons/notification-counter-09.png new file mode 100644 index 000000000..3d52f252a Binary files /dev/null and b/Greenshot/icons/notification-counter-09.png differ diff --git a/Greenshot/icons/notification-counter-10.png b/Greenshot/icons/notification-counter-10.png new file mode 100644 index 000000000..ee8163c33 Binary files /dev/null and b/Greenshot/icons/notification-counter-10.png differ diff --git a/Greenshot/icons/notification-counter-11.png b/Greenshot/icons/notification-counter-11.png new file mode 100644 index 000000000..e565ed25c Binary files /dev/null and b/Greenshot/icons/notification-counter-11.png differ diff --git a/Greenshot/icons/notification-counter-12.png b/Greenshot/icons/notification-counter-12.png new file mode 100644 index 000000000..d361e3cfd Binary files /dev/null and b/Greenshot/icons/notification-counter-12.png differ diff --git a/Greenshot/icons/notification-counter-13.png b/Greenshot/icons/notification-counter-13.png new file mode 100644 index 000000000..a5096597e Binary files /dev/null and b/Greenshot/icons/notification-counter-13.png differ diff --git a/Greenshot/icons/notification-counter-14.png b/Greenshot/icons/notification-counter-14.png new file mode 100644 index 000000000..fef06482d Binary files /dev/null and b/Greenshot/icons/notification-counter-14.png differ diff --git a/Greenshot/icons/notification-counter-15.png b/Greenshot/icons/notification-counter-15.png new file mode 100644 index 000000000..aa06f0e9f Binary files /dev/null and b/Greenshot/icons/notification-counter-15.png differ diff --git a/Greenshot/icons/notification-counter-16.png b/Greenshot/icons/notification-counter-16.png new file mode 100644 index 000000000..f1f1234a1 Binary files /dev/null and b/Greenshot/icons/notification-counter-16.png differ diff --git a/Greenshot/icons/notification-counter-17.png b/Greenshot/icons/notification-counter-17.png new file mode 100644 index 000000000..eeab4ba69 Binary files /dev/null and b/Greenshot/icons/notification-counter-17.png differ diff --git a/Greenshot/icons/notification-counter-18.png b/Greenshot/icons/notification-counter-18.png new file mode 100644 index 000000000..263f736c9 Binary files /dev/null and b/Greenshot/icons/notification-counter-18.png differ diff --git a/Greenshot/icons/notification-counter-19.png b/Greenshot/icons/notification-counter-19.png new file mode 100644 index 000000000..fa671b0c6 Binary files /dev/null and b/Greenshot/icons/notification-counter-19.png differ diff --git a/Greenshot/icons/notification-counter-20-plus.png b/Greenshot/icons/notification-counter-20-plus.png new file mode 100644 index 000000000..123e6a04e Binary files /dev/null and b/Greenshot/icons/notification-counter-20-plus.png differ diff --git a/Greenshot/icons/notification-counter-20.png b/Greenshot/icons/notification-counter-20.png new file mode 100644 index 000000000..3cdab4e22 Binary files /dev/null and b/Greenshot/icons/notification-counter-20.png differ diff --git a/GreenshotPlugin/Core/Effects.cs b/GreenshotPlugin/Core/Effects.cs index ae291c87e..1676af959 100644 --- a/GreenshotPlugin/Core/Effects.cs +++ b/GreenshotPlugin/Core/Effects.cs @@ -72,6 +72,7 @@ namespace Greenshot.Core { ToothHeight = 12; HorizontalToothRange = 20; VerticalToothRange = 20; + Edges = new bool[] {true, false, true, true}; } public int ToothHeight { get; @@ -85,8 +86,12 @@ namespace Greenshot.Core { get; set; } + public bool[] Edges { + get; + set; + } public override Image Apply(Image sourceImage, out Point offsetChange) { - using (Image tmpTornImage = ImageHelper.CreateTornEdge(sourceImage, ToothHeight, HorizontalToothRange, VerticalToothRange)) { + using (Image tmpTornImage = ImageHelper.CreateTornEdge(sourceImage, ToothHeight, HorizontalToothRange, VerticalToothRange, Edges)) { return ImageHelper.CreateShadow(tmpTornImage, Darkness, ShadowSize, ShadowOffset, out offsetChange, PixelFormat.Format32bppArgb); } } diff --git a/GreenshotPlugin/Core/ImageHelper.cs b/GreenshotPlugin/Core/ImageHelper.cs index e558fccac..e92174347 100644 --- a/GreenshotPlugin/Core/ImageHelper.cs +++ b/GreenshotPlugin/Core/ImageHelper.cs @@ -447,8 +447,9 @@ namespace GreenshotPlugin.Core { /// How large (height) is each tooth /// How wide is a horizontal tooth /// How wide is a vertical tooth + /// bool[] with information on if the edge needs torn or not. Order is clockwise: 0=top,1=right,2=bottom,3=left /// Changed bitmap - public static Image CreateTornEdge(Image sourceImage, int toothHeight, int horizontalToothRange, int verticalToothRange) { + public static Image CreateTornEdge(Image sourceImage, int toothHeight, int horizontalToothRange, int verticalToothRange, bool[] edges) { Image returnImage = CreateEmpty(sourceImage.Width, sourceImage.Height, PixelFormat.Format32bppArgb, Color.Empty, sourceImage.HorizontalResolution, sourceImage.VerticalResolution); using (GraphicsPath path = new GraphicsPath()) { Random random = new Random(); @@ -456,43 +457,66 @@ namespace GreenshotPlugin.Core { int VerticalRegions = (int)(sourceImage.Height / verticalToothRange); // Start - Point previousEndingPoint = new Point(horizontalToothRange, random.Next(1, toothHeight)); + Point previousEndingPoint = new Point(0,0); Point newEndingPoint; - // Top - for (int i = 0; i < HorizontalRegions; i++) { - int x = (int)previousEndingPoint.X + horizontalToothRange; - int y = random.Next(1, toothHeight); - newEndingPoint = new Point(x, y); + if (edges[0]) { + previousEndingPoint = new Point(horizontalToothRange, random.Next(1, toothHeight)); + // Top + for (int i = 0; i < HorizontalRegions; i++) { + int x = (int)previousEndingPoint.X + horizontalToothRange; + int y = random.Next(1, toothHeight); + newEndingPoint = new Point(x, y); + path.AddLine(previousEndingPoint, newEndingPoint); + previousEndingPoint = newEndingPoint; + } + } else { + newEndingPoint = new Point(sourceImage.Width, 0); + path.AddLine(previousEndingPoint, newEndingPoint); + previousEndingPoint = newEndingPoint; + } + if (edges[1]) { + // Right + for (int i = 0; i < VerticalRegions; i++) { + int x = sourceImage.Width - random.Next(1, toothHeight); + int y = (int)previousEndingPoint.Y + verticalToothRange; + newEndingPoint = new Point(x, y); + path.AddLine(previousEndingPoint, newEndingPoint); + previousEndingPoint = newEndingPoint; + } + } else { + newEndingPoint = new Point(sourceImage.Width, sourceImage.Height); + path.AddLine(previousEndingPoint, newEndingPoint); + previousEndingPoint = newEndingPoint; + } + if (edges[2]) { + // Bottom + for (int i = 0; i < HorizontalRegions; i++) { + int x = (int)previousEndingPoint.X - horizontalToothRange; + int y = sourceImage.Height - random.Next(1, toothHeight); + newEndingPoint = new Point(x, y); + path.AddLine(previousEndingPoint, newEndingPoint); + previousEndingPoint = newEndingPoint; + } + } else { + newEndingPoint = new Point(0, sourceImage.Height); + path.AddLine(previousEndingPoint, newEndingPoint); + previousEndingPoint = newEndingPoint; + } + if (edges[3]) { + // Left + for (int i = 0; i < VerticalRegions; i++) { + int x = random.Next(1, toothHeight); + int y = (int)previousEndingPoint.Y - verticalToothRange; + newEndingPoint = new Point(x, y); + path.AddLine(previousEndingPoint, newEndingPoint); + previousEndingPoint = newEndingPoint; + } + } else { + newEndingPoint = new Point(0, 0); path.AddLine(previousEndingPoint, newEndingPoint); previousEndingPoint = newEndingPoint; } - // Right - for (int i = 0; i < VerticalRegions; i++) { - int x = sourceImage.Width - random.Next(1, toothHeight); - int y = (int)previousEndingPoint.Y + verticalToothRange; - newEndingPoint = new Point(x, y); - path.AddLine(previousEndingPoint, newEndingPoint); - previousEndingPoint = newEndingPoint; - } - - // Bottom - for (int i = 0; i < HorizontalRegions; i++) { - int x = (int)previousEndingPoint.X - horizontalToothRange; - int y = sourceImage.Height - random.Next(1, toothHeight); - newEndingPoint = new Point(x, y); - path.AddLine(previousEndingPoint, newEndingPoint); - previousEndingPoint = newEndingPoint; - } - - // Left - for (int i = 0; i < VerticalRegions; i++) { - int x = random.Next(1, toothHeight); - int y = (int)previousEndingPoint.Y - verticalToothRange; - newEndingPoint = new Point(x, y); - path.AddLine(previousEndingPoint, newEndingPoint); - previousEndingPoint = newEndingPoint; - } path.CloseFigure(); // Draw the created figure with the original image by using a TextureBrush so we have anti-aliasing diff --git a/GreenshotPlugin/Interfaces/Generic.cs b/GreenshotPlugin/Interfaces/Generic.cs index 5b52aa6d7..fa5110b1b 100644 --- a/GreenshotPlugin/Interfaces/Generic.cs +++ b/GreenshotPlugin/Interfaces/Generic.cs @@ -199,8 +199,8 @@ namespace Greenshot.Plugin { set; } - LinkedList StepContainers { - get; - } + void AddStepLabel(IDrawableContainer stepLabel); + void RemoveStepLabel(IDrawableContainer stepLabel); + int CountStepLabels(IDrawableContainer stopCountingOnStepLabel); } } \ No newline at end of file