Added icons for the new tools, also changed some of the logic so it is possible to show the number of the next "label" in the tool button.
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
/// <summary>
|
||||
|
@ -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
|
||||
/// </summary>
|
||||
public override void Dispose() {
|
||||
Parent.StepContainers.Remove(this);
|
||||
Parent.RemoveStepLabel(this);
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Override the parent, calculate the label number, than draw
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="rm"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -210,14 +210,33 @@ namespace Greenshot.Drawing {
|
|||
private Bitmap buffer = null;
|
||||
|
||||
/// <summary>
|
||||
/// all stepcontainers for the surface, needed with serialization
|
||||
/// all stepLabels for the surface, needed with serialization
|
||||
/// </summary>
|
||||
private readonly LinkedList<IDrawableContainer> _stepContainers = new LinkedList<IDrawableContainer>();
|
||||
private readonly LinkedList<IDrawableContainer> _stepLabels = new LinkedList<IDrawableContainer>();
|
||||
|
||||
public LinkedList<IDrawableContainer> StepContainers {
|
||||
get {
|
||||
return _stepContainers;
|
||||
public void AddStepLabel(IDrawableContainer stepLabel) {
|
||||
_stepLabels.AddLast(stepLabel);
|
||||
}
|
||||
public void RemoveStepLabel(IDrawableContainer stepLabel) {
|
||||
_stepLabels.Remove(stepLabel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Count all the steplabels in the surface, up to the supplied one
|
||||
/// </summary>
|
||||
/// <param name="stopAtContainer">can be null, if not the counting stops here</param>
|
||||
/// <returns>number of steplabels before the supplied container</returns>
|
||||
public int CountStepLabels(IDrawableContainer stopAtContainer) {
|
||||
int number = 1;
|
||||
foreach (StepLabelContainer possibleThis in _stepLabels) {
|
||||
if (possibleThis == stopAtContainer) {
|
||||
break;
|
||||
}
|
||||
if (IsOnSurface(possibleThis)) {
|
||||
number++;
|
||||
}
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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);
|
||||
|
|
8
Greenshot/Forms/ImageEditorForm.Designer.cs
generated
|
@ -24,7 +24,8 @@ namespace Greenshot {
|
|||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
private System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImageEditorForm));
|
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the form.
|
||||
/// </summary>
|
||||
|
@ -46,7 +47,6 @@ namespace Greenshot {
|
|||
/// </summary>
|
||||
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";
|
||||
|
|
|
@ -996,6 +996,12 @@ namespace Greenshot {
|
|||
/// refreshes all editor controls depending on selected elements and their fields
|
||||
/// </summary>
|
||||
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
|
||||
|
|
|
@ -201,6 +201,18 @@
|
|||
NSAMYpNkgHn+egWnmh3Vh6+92XAUiEFskBhRhiilrw1UTl+T07TiYvvuiy9W7r78YiWIDRIDyWEYIpe4
|
||||
wkUheUUriAZJKqQuz7/x9PPxCw8+7Dt2/c0WED5378NekBhIDsMAydiFff///z8DoiVjFpWRgsGGiUTM
|
||||
8QbiaSCaKD+iKQIAuEYmAAjjsCcAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnStepLabel.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
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=
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnHighlight.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
|
@ -927,6 +939,69 @@
|
|||
igHkZijqZSZyXQAA4IG1TpHFZ2gAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnStepLabel01.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-01.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel02.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-02.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel03.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-03.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel04.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-04.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel05.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-05.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel06.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-06.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel07.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-07.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel08.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-08.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel09.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-09.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel10.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-10.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel11.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-11.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel12.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel13.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-13.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel14.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-14.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel15.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-15.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel16.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel17.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-17.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel18.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-18.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel19.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-19.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel20+.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-20-plus.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="btnStepLabel20.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\icons\notification-counter-20.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>551, 17</value>
|
||||
</metadata>
|
||||
|
|
BIN
Greenshot/icons/balloon.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
Greenshot/icons/notification-counter-01.png
Normal file
After Width: | Height: | Size: 407 B |
BIN
Greenshot/icons/notification-counter-02.png
Normal file
After Width: | Height: | Size: 424 B |
BIN
Greenshot/icons/notification-counter-03.png
Normal file
After Width: | Height: | Size: 429 B |
BIN
Greenshot/icons/notification-counter-04.png
Normal file
After Width: | Height: | Size: 421 B |
BIN
Greenshot/icons/notification-counter-05.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
Greenshot/icons/notification-counter-06.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
Greenshot/icons/notification-counter-07.png
Normal file
After Width: | Height: | Size: 416 B |
BIN
Greenshot/icons/notification-counter-08.png
Normal file
After Width: | Height: | Size: 434 B |
BIN
Greenshot/icons/notification-counter-09.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
Greenshot/icons/notification-counter-10.png
Normal file
After Width: | Height: | Size: 449 B |
BIN
Greenshot/icons/notification-counter-11.png
Normal file
After Width: | Height: | Size: 447 B |
BIN
Greenshot/icons/notification-counter-12.png
Normal file
After Width: | Height: | Size: 466 B |
BIN
Greenshot/icons/notification-counter-13.png
Normal file
After Width: | Height: | Size: 469 B |
BIN
Greenshot/icons/notification-counter-14.png
Normal file
After Width: | Height: | Size: 466 B |
BIN
Greenshot/icons/notification-counter-15.png
Normal file
After Width: | Height: | Size: 453 B |
BIN
Greenshot/icons/notification-counter-16.png
Normal file
After Width: | Height: | Size: 465 B |
BIN
Greenshot/icons/notification-counter-17.png
Normal file
After Width: | Height: | Size: 462 B |
BIN
Greenshot/icons/notification-counter-18.png
Normal file
After Width: | Height: | Size: 472 B |
BIN
Greenshot/icons/notification-counter-19.png
Normal file
After Width: | Height: | Size: 463 B |
BIN
Greenshot/icons/notification-counter-20-plus.png
Normal file
After Width: | Height: | Size: 545 B |
BIN
Greenshot/icons/notification-counter-20.png
Normal file
After Width: | Height: | Size: 480 B |
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -447,8 +447,9 @@ namespace GreenshotPlugin.Core {
|
|||
/// <param name="toothHeight">How large (height) is each tooth</param>
|
||||
/// <param name="horizontalToothRange">How wide is a horizontal tooth</param>
|
||||
/// <param name="verticalToothRange">How wide is a vertical tooth</param>
|
||||
/// <param name="edges">bool[] with information on if the edge needs torn or not. Order is clockwise: 0=top,1=right,2=bottom,3=left</param>
|
||||
/// <returns>Changed bitmap</returns>
|
||||
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
|
||||
|
|
|
@ -199,8 +199,8 @@ namespace Greenshot.Plugin {
|
|||
set;
|
||||
}
|
||||
|
||||
LinkedList<IDrawableContainer> StepContainers {
|
||||
get;
|
||||
}
|
||||
void AddStepLabel(IDrawableContainer stepLabel);
|
||||
void RemoveStepLabel(IDrawableContainer stepLabel);
|
||||
int CountStepLabels(IDrawableContainer stopCountingOnStepLabel);
|
||||
}
|
||||
}
|