diff --git a/Greenshot/Forms/AnimatingBaseForm.cs b/Greenshot/Forms/AnimatingBaseForm.cs
index f2cd6fc66..6ffc31a8f 100644
--- a/Greenshot/Forms/AnimatingBaseForm.cs
+++ b/Greenshot/Forms/AnimatingBaseForm.cs
@@ -22,6 +22,9 @@ using System;
using GreenshotPlugin.Controls;
namespace Greenshot {
+ ///
+ /// This class is only here to help in the Designer mode, so it's clear where the language files are
+ ///
public class AnimatingBaseForm : AnimatingForm {
}
}
diff --git a/Greenshot/Forms/BaseForm.cs b/Greenshot/Forms/BaseForm.cs
index 741145f2f..603584442 100644
--- a/Greenshot/Forms/BaseForm.cs
+++ b/Greenshot/Forms/BaseForm.cs
@@ -22,6 +22,9 @@ using System;
using GreenshotPlugin.Controls;
namespace Greenshot {
+ ///
+ /// This class is only here to help in the Designer mode, so it's clear where the language files are
+ ///
public class BaseForm : GreenshotForm {
}
}
diff --git a/Greenshot/Forms/DropShadowSettingsForm.Designer.cs b/Greenshot/Forms/DropShadowSettingsForm.Designer.cs
new file mode 100644
index 000000000..b1489eb02
--- /dev/null
+++ b/Greenshot/Forms/DropShadowSettingsForm.Designer.cs
@@ -0,0 +1,226 @@
+namespace Greenshot.Forms {
+ partial class DropShadowSettingsForm {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.thickness = new System.Windows.Forms.NumericUpDown();
+ this.offsetX = new System.Windows.Forms.NumericUpDown();
+ this.label3 = new System.Windows.Forms.Label();
+ this.offsetY = new System.Windows.Forms.NumericUpDown();
+ this.trackBar1 = new System.Windows.Forms.TrackBar();
+ this.buttonOK = new GreenshotPlugin.Controls.GreenshotButton();
+ this.buttonCancel = new GreenshotPlugin.Controls.GreenshotButton();
+ this.labelDarkness = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.labelOffset = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.labelThickness = new GreenshotPlugin.Controls.GreenshotLabel();
+ ((System.ComponentModel.ISupportInitialize)(this.thickness)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.offsetX)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.offsetY)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // thickness
+ //
+ this.thickness.Location = new System.Drawing.Point(173, 7);
+ this.thickness.Maximum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ 0});
+ this.thickness.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.thickness.Name = "thickness";
+ this.thickness.Size = new System.Drawing.Size(45, 20);
+ this.thickness.TabIndex = 0;
+ this.thickness.Value = new decimal(new int[] {
+ 9,
+ 0,
+ 0,
+ 0});
+ //
+ // offsetX
+ //
+ this.offsetX.Location = new System.Drawing.Point(102, 33);
+ this.offsetX.Maximum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ 0});
+ this.offsetX.Minimum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ -2147483648});
+ this.offsetX.Name = "offsetX";
+ this.offsetX.Size = new System.Drawing.Size(45, 20);
+ this.offsetX.TabIndex = 4;
+ this.offsetX.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ -2147483648});
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(153, 35);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(14, 13);
+ this.label3.TabIndex = 5;
+ this.label3.Text = "X";
+ //
+ // offsetY
+ //
+ this.offsetY.Location = new System.Drawing.Point(173, 33);
+ this.offsetY.Maximum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ 0});
+ this.offsetY.Minimum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ -2147483648});
+ this.offsetY.Name = "offsetY";
+ this.offsetY.Size = new System.Drawing.Size(45, 20);
+ this.offsetY.TabIndex = 6;
+ this.offsetY.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ -2147483648});
+ //
+ // trackBar1
+ //
+ this.trackBar1.Location = new System.Drawing.Point(102, 59);
+ this.trackBar1.Maximum = 40;
+ this.trackBar1.Minimum = 1;
+ this.trackBar1.Name = "trackBar1";
+ this.trackBar1.Size = new System.Drawing.Size(116, 45);
+ this.trackBar1.TabIndex = 7;
+ this.trackBar1.Value = 40;
+ //
+ // buttonOK
+ //
+ this.buttonOK.LanguageKey = "OK";
+ this.buttonOK.Location = new System.Drawing.Point(62, 110);
+ this.buttonOK.Name = "buttonOK";
+ this.buttonOK.Size = new System.Drawing.Size(75, 23);
+ this.buttonOK.TabIndex = 11;
+ this.buttonOK.Text = "Ok";
+ this.buttonOK.UseVisualStyleBackColor = true;
+ this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.buttonCancel.LanguageKey = "CANCEL";
+ this.buttonCancel.Location = new System.Drawing.Point(143, 110);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(75, 23);
+ this.buttonCancel.TabIndex = 12;
+ this.buttonCancel.Text = "Cancel";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ //
+ // labelDarkness
+ //
+ this.labelDarkness.AutoSize = true;
+ this.labelDarkness.LanguageKey = "editor_dropshadow_darkness";
+ this.labelDarkness.Location = new System.Drawing.Point(12, 73);
+ this.labelDarkness.Name = "labelDarkness";
+ this.labelDarkness.Size = new System.Drawing.Size(52, 13);
+ this.labelDarkness.TabIndex = 13;
+ this.labelDarkness.Text = "Darkness";
+ //
+ // labelOffset
+ //
+ this.labelOffset.AutoSize = true;
+ this.labelOffset.LanguageKey = "editor_dropshadow_offset";
+ this.labelOffset.Location = new System.Drawing.Point(12, 40);
+ this.labelOffset.Name = "labelOffset";
+ this.labelOffset.Size = new System.Drawing.Size(35, 13);
+ this.labelOffset.TabIndex = 14;
+ this.labelOffset.Text = "Offset";
+ //
+ // labelThickness
+ //
+ this.labelThickness.AutoSize = true;
+ this.labelThickness.LanguageKey = "editor_dropshadow_thickness";
+ this.labelThickness.Location = new System.Drawing.Point(12, 14);
+ this.labelThickness.Name = "labelThickness";
+ this.labelThickness.Size = new System.Drawing.Size(56, 13);
+ this.labelThickness.TabIndex = 15;
+ this.labelThickness.Text = "Thickness";
+ //
+ // CreateShadowForm
+ //
+ this.AcceptButton = this.buttonOK;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.buttonCancel;
+ this.ClientSize = new System.Drawing.Size(230, 154);
+ this.ControlBox = false;
+ this.Controls.Add(this.labelThickness);
+ this.Controls.Add(this.labelOffset);
+ this.Controls.Add(this.labelDarkness);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.buttonOK);
+ this.Controls.Add(this.trackBar1);
+ this.Controls.Add(this.offsetY);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.offsetX);
+ this.Controls.Add(this.thickness);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.LanguageKey = "editor_dropshadow_settings";
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "CreateShadowForm";
+ this.ShowIcon = false;
+ this.Text = "CreateShadowForm";
+ ((System.ComponentModel.ISupportInitialize)(this.thickness)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.offsetX)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.offsetY)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.NumericUpDown thickness;
+ private System.Windows.Forms.NumericUpDown offsetX;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.NumericUpDown offsetY;
+ private System.Windows.Forms.TrackBar trackBar1;
+ private GreenshotPlugin.Controls.GreenshotButton buttonOK;
+ private GreenshotPlugin.Controls.GreenshotButton buttonCancel;
+ private GreenshotPlugin.Controls.GreenshotLabel labelDarkness;
+ private GreenshotPlugin.Controls.GreenshotLabel labelOffset;
+ private GreenshotPlugin.Controls.GreenshotLabel labelThickness;
+ }
+}
\ No newline at end of file
diff --git a/Greenshot/Forms/DropShadowSettingsForm.cs b/Greenshot/Forms/DropShadowSettingsForm.cs
new file mode 100644
index 000000000..d351715b7
--- /dev/null
+++ b/Greenshot/Forms/DropShadowSettingsForm.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using Greenshot.Core;
+using GreenshotPlugin.Core;
+
+namespace Greenshot.Forms {
+ public partial class DropShadowSettingsForm : BaseForm {
+ private DropShadowEffect effect;
+ public DropShadowSettingsForm(DropShadowEffect effect) {
+ this.effect = effect;
+ InitializeComponent();
+ this.Icon = GreenshotResources.getGreenshotIcon();
+ trackBar1.Value = (int)(effect.Darkness * 40);
+ offsetX.Value = effect.ShadowOffset.X;
+ offsetY.Value = effect.ShadowOffset.Y;
+ }
+
+ private void buttonOK_Click(object sender, EventArgs e) {
+ effect.Darkness = (float)trackBar1.Value / (float)40;
+ effect.ShadowOffset = new Point((int)offsetX.Value, (int)offsetY.Value);
+ effect.ShadowSize = (int)thickness.Value;
+ DialogResult = DialogResult.OK;
+ }
+ }
+}
diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs
index 0f0d09d74..ae125e2df 100644
--- a/Greenshot/Forms/ImageEditorForm.cs
+++ b/Greenshot/Forms/ImageEditorForm.cs
@@ -1204,13 +1204,21 @@ namespace Greenshot {
}
void AddDropshadowToolStripMenuItemClick(object sender, EventArgs e) {
- surface.ApplyBitmapEffect(new DropShadowEffect());
- updateUndoRedoSurfaceDependencies();
+ DropShadowEffect dropShadowEffect= new DropShadowEffect();
+ DialogResult result = new DropShadowSettingsForm(dropShadowEffect).ShowDialog(this);
+ if (result == DialogResult.OK) {
+ surface.ApplyBitmapEffect(dropShadowEffect);
+ updateUndoRedoSurfaceDependencies();
+ }
}
void TornEdgesToolStripMenuItemClick(object sender, EventArgs e) {
- surface.ApplyBitmapEffect(new TornEdgeEffect());
- updateUndoRedoSurfaceDependencies();
+ TornEdgeEffect tornEdgeEffect = new TornEdgeEffect();
+ DialogResult result = new TornEdgeSettingsForm(tornEdgeEffect).ShowDialog(this);
+ if (result == DialogResult.OK) {
+ surface.ApplyBitmapEffect(tornEdgeEffect);
+ updateUndoRedoSurfaceDependencies();
+ }
}
void GrayscaleToolStripMenuItemClick(object sender, EventArgs e) {
diff --git a/Greenshot/Forms/TornEdgeSettingsForm.Designer.cs b/Greenshot/Forms/TornEdgeSettingsForm.Designer.cs
new file mode 100644
index 000000000..aeb116a18
--- /dev/null
+++ b/Greenshot/Forms/TornEdgeSettingsForm.Designer.cs
@@ -0,0 +1,346 @@
+namespace Greenshot.Forms {
+ partial class TornEdgeSettingsForm {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.thickness = new System.Windows.Forms.NumericUpDown();
+ this.offsetX = new System.Windows.Forms.NumericUpDown();
+ this.label3 = new System.Windows.Forms.Label();
+ this.offsetY = new System.Windows.Forms.NumericUpDown();
+ this.trackBar1 = new System.Windows.Forms.TrackBar();
+ this.buttonOK = new GreenshotPlugin.Controls.GreenshotButton();
+ this.buttonCancel = new GreenshotPlugin.Controls.GreenshotButton();
+ this.labelDarkness = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.labelOffset = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.labelThickness = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.toothsize = new System.Windows.Forms.NumericUpDown();
+ this.label_toothsize = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.label_horizontaltoothrange = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.horizontaltoothrange = new System.Windows.Forms.NumericUpDown();
+ this.labelVerticaltoothrange = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.verticaltoothrange = new System.Windows.Forms.NumericUpDown();
+ ((System.ComponentModel.ISupportInitialize)(this.thickness)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.offsetX)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.offsetY)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.toothsize)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.horizontaltoothrange)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.verticaltoothrange)).BeginInit();
+ this.SuspendLayout();
+ //
+ // thickness
+ //
+ this.thickness.Location = new System.Drawing.Point(173, 7);
+ this.thickness.Maximum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ 0});
+ this.thickness.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.thickness.Name = "thickness";
+ this.thickness.Size = new System.Drawing.Size(45, 20);
+ this.thickness.TabIndex = 0;
+ this.thickness.Value = new decimal(new int[] {
+ 9,
+ 0,
+ 0,
+ 0});
+ //
+ // offsetX
+ //
+ this.offsetX.Location = new System.Drawing.Point(102, 33);
+ this.offsetX.Maximum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ 0});
+ this.offsetX.Minimum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ -2147483648});
+ this.offsetX.Name = "offsetX";
+ this.offsetX.Size = new System.Drawing.Size(45, 20);
+ this.offsetX.TabIndex = 4;
+ this.offsetX.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ -2147483648});
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(153, 35);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(14, 13);
+ this.label3.TabIndex = 5;
+ this.label3.Text = "X";
+ //
+ // offsetY
+ //
+ this.offsetY.Location = new System.Drawing.Point(173, 33);
+ this.offsetY.Maximum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ 0});
+ this.offsetY.Minimum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ -2147483648});
+ this.offsetY.Name = "offsetY";
+ this.offsetY.Size = new System.Drawing.Size(45, 20);
+ this.offsetY.TabIndex = 6;
+ this.offsetY.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ -2147483648});
+ //
+ // trackBar1
+ //
+ this.trackBar1.Location = new System.Drawing.Point(102, 59);
+ this.trackBar1.Maximum = 40;
+ this.trackBar1.Minimum = 1;
+ this.trackBar1.Name = "trackBar1";
+ this.trackBar1.Size = new System.Drawing.Size(116, 45);
+ this.trackBar1.TabIndex = 7;
+ this.trackBar1.Value = 40;
+ //
+ // buttonOK
+ //
+ this.buttonOK.LanguageKey = "OK";
+ this.buttonOK.Location = new System.Drawing.Point(62, 206);
+ this.buttonOK.Name = "buttonOK";
+ this.buttonOK.Size = new System.Drawing.Size(75, 23);
+ this.buttonOK.TabIndex = 11;
+ this.buttonOK.Text = "Ok";
+ this.buttonOK.UseVisualStyleBackColor = true;
+ this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.buttonCancel.LanguageKey = "CANCEL";
+ this.buttonCancel.Location = new System.Drawing.Point(143, 206);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(75, 23);
+ this.buttonCancel.TabIndex = 12;
+ this.buttonCancel.Text = "Cancel";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ //
+ // labelDarkness
+ //
+ this.labelDarkness.AutoSize = true;
+ this.labelDarkness.LanguageKey = "editor_dropshadow_darkness";
+ this.labelDarkness.Location = new System.Drawing.Point(12, 73);
+ this.labelDarkness.Name = "labelDarkness";
+ this.labelDarkness.Size = new System.Drawing.Size(52, 13);
+ this.labelDarkness.TabIndex = 13;
+ this.labelDarkness.Text = "Darkness";
+ //
+ // labelOffset
+ //
+ this.labelOffset.AutoSize = true;
+ this.labelOffset.LanguageKey = "editor_dropshadow_offset";
+ this.labelOffset.Location = new System.Drawing.Point(12, 40);
+ this.labelOffset.Name = "labelOffset";
+ this.labelOffset.Size = new System.Drawing.Size(35, 13);
+ this.labelOffset.TabIndex = 14;
+ this.labelOffset.Text = "Offset";
+ //
+ // labelThickness
+ //
+ this.labelThickness.AutoSize = true;
+ this.labelThickness.LanguageKey = "editor_dropshadow_thickness";
+ this.labelThickness.Location = new System.Drawing.Point(12, 14);
+ this.labelThickness.Name = "labelThickness";
+ this.labelThickness.Size = new System.Drawing.Size(56, 13);
+ this.labelThickness.TabIndex = 15;
+ this.labelThickness.Text = "Thickness";
+ //
+ // toothsize
+ //
+ this.toothsize.Location = new System.Drawing.Point(173, 110);
+ this.toothsize.Maximum = new decimal(new int[] {
+ 40,
+ 0,
+ 0,
+ 0});
+ this.toothsize.Minimum = new decimal(new int[] {
+ 2,
+ 0,
+ 0,
+ 0});
+ this.toothsize.Name = "toothsize";
+ this.toothsize.Size = new System.Drawing.Size(45, 20);
+ this.toothsize.TabIndex = 16;
+ this.toothsize.Value = new decimal(new int[] {
+ 12,
+ 0,
+ 0,
+ 0});
+ //
+ // label_toothsize
+ //
+ this.label_toothsize.AutoSize = true;
+ this.label_toothsize.LanguageKey = "editor_tornedge_toothsize";
+ this.label_toothsize.Location = new System.Drawing.Point(12, 112);
+ this.label_toothsize.Name = "label_toothsize";
+ this.label_toothsize.Size = new System.Drawing.Size(56, 13);
+ this.label_toothsize.TabIndex = 17;
+ this.label_toothsize.Text = "Tooth size";
+ //
+ // label_horizontaltoothrange
+ //
+ this.label_horizontaltoothrange.AutoSize = true;
+ this.label_horizontaltoothrange.LanguageKey = "editor_tornedge_horizontaltoothrange";
+ this.label_horizontaltoothrange.Location = new System.Drawing.Point(12, 138);
+ this.label_horizontaltoothrange.Name = "label_horizontaltoothrange";
+ this.label_horizontaltoothrange.Size = new System.Drawing.Size(111, 13);
+ this.label_horizontaltoothrange.TabIndex = 19;
+ this.label_horizontaltoothrange.Text = "Horizontal tooth range";
+ //
+ // horizontaltoothrange
+ //
+ this.horizontaltoothrange.Location = new System.Drawing.Point(173, 136);
+ this.horizontaltoothrange.Maximum = new decimal(new int[] {
+ 40,
+ 0,
+ 0,
+ 0});
+ this.horizontaltoothrange.Minimum = new decimal(new int[] {
+ 2,
+ 0,
+ 0,
+ 0});
+ this.horizontaltoothrange.Name = "horizontaltoothrange";
+ this.horizontaltoothrange.Size = new System.Drawing.Size(45, 20);
+ this.horizontaltoothrange.TabIndex = 18;
+ this.horizontaltoothrange.Value = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ 0});
+ //
+ // labelVerticaltoothrange
+ //
+ this.labelVerticaltoothrange.AutoSize = true;
+ this.labelVerticaltoothrange.LanguageKey = "editor_tornedge_verticaltoothrange";
+ this.labelVerticaltoothrange.Location = new System.Drawing.Point(12, 164);
+ this.labelVerticaltoothrange.Name = "labelVerticaltoothrange";
+ this.labelVerticaltoothrange.Size = new System.Drawing.Size(99, 13);
+ this.labelVerticaltoothrange.TabIndex = 21;
+ this.labelVerticaltoothrange.Text = "Vertical tooth range";
+ //
+ // verticaltoothrange
+ //
+ this.verticaltoothrange.Location = new System.Drawing.Point(173, 162);
+ this.verticaltoothrange.Maximum = new decimal(new int[] {
+ 40,
+ 0,
+ 0,
+ 0});
+ this.verticaltoothrange.Minimum = new decimal(new int[] {
+ 2,
+ 0,
+ 0,
+ 0});
+ this.verticaltoothrange.Name = "verticaltoothrange";
+ this.verticaltoothrange.Size = new System.Drawing.Size(45, 20);
+ this.verticaltoothrange.TabIndex = 20;
+ this.verticaltoothrange.Value = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ 0});
+ //
+ // TornEdgeSettingsForm
+ //
+ this.AcceptButton = this.buttonOK;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.buttonCancel;
+ this.ClientSize = new System.Drawing.Size(230, 241);
+ this.ControlBox = false;
+ this.Controls.Add(this.labelVerticaltoothrange);
+ this.Controls.Add(this.verticaltoothrange);
+ this.Controls.Add(this.label_horizontaltoothrange);
+ this.Controls.Add(this.horizontaltoothrange);
+ this.Controls.Add(this.label_toothsize);
+ this.Controls.Add(this.toothsize);
+ this.Controls.Add(this.labelThickness);
+ this.Controls.Add(this.labelOffset);
+ this.Controls.Add(this.labelDarkness);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.buttonOK);
+ this.Controls.Add(this.trackBar1);
+ this.Controls.Add(this.offsetY);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.offsetX);
+ this.Controls.Add(this.thickness);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.LanguageKey = "editor_tornedge_settings";
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "TornEdgeSettingsForm";
+ this.ShowIcon = false;
+ this.Text = "CreateShadowForm";
+ ((System.ComponentModel.ISupportInitialize)(this.thickness)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.offsetX)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.offsetY)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.toothsize)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.horizontaltoothrange)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.verticaltoothrange)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.NumericUpDown thickness;
+ private System.Windows.Forms.NumericUpDown offsetX;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.NumericUpDown offsetY;
+ private System.Windows.Forms.TrackBar trackBar1;
+ private GreenshotPlugin.Controls.GreenshotButton buttonOK;
+ private GreenshotPlugin.Controls.GreenshotButton buttonCancel;
+ private GreenshotPlugin.Controls.GreenshotLabel labelDarkness;
+ private GreenshotPlugin.Controls.GreenshotLabel labelOffset;
+ private GreenshotPlugin.Controls.GreenshotLabel labelThickness;
+ private System.Windows.Forms.NumericUpDown toothsize;
+ private GreenshotPlugin.Controls.GreenshotLabel label_toothsize;
+ private GreenshotPlugin.Controls.GreenshotLabel label_horizontaltoothrange;
+ private System.Windows.Forms.NumericUpDown horizontaltoothrange;
+ private GreenshotPlugin.Controls.GreenshotLabel labelVerticaltoothrange;
+ private System.Windows.Forms.NumericUpDown verticaltoothrange;
+ }
+}
\ No newline at end of file
diff --git a/Greenshot/Forms/TornEdgeSettingsForm.cs b/Greenshot/Forms/TornEdgeSettingsForm.cs
new file mode 100644
index 000000000..7522af04a
--- /dev/null
+++ b/Greenshot/Forms/TornEdgeSettingsForm.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using Greenshot.Core;
+using GreenshotPlugin.Core;
+
+namespace Greenshot.Forms {
+ public partial class TornEdgeSettingsForm : BaseForm {
+ private TornEdgeEffect effect;
+ public TornEdgeSettingsForm(TornEdgeEffect effect) {
+ this.effect = effect;
+ InitializeComponent();
+ this.Icon = GreenshotResources.getGreenshotIcon();
+ trackBar1.Value = (int)(effect.Darkness * 40);
+ offsetX.Value = effect.ShadowOffset.X;
+ offsetY.Value = effect.ShadowOffset.Y;
+ toothsize.Value = effect.ToothHeight;
+ verticaltoothrange.Value = effect.VerticalToothRange;
+ horizontaltoothrange.Value = effect.HorizontalToothRange;
+ }
+
+ private void buttonOK_Click(object sender, EventArgs e) {
+ effect.Darkness = (float)trackBar1.Value / (float)40;
+ effect.ShadowOffset = new Point((int)offsetX.Value, (int)offsetY.Value);
+ effect.ShadowSize = (int)thickness.Value;
+ effect.ToothHeight = (int)toothsize.Value;
+ effect.VerticalToothRange = (int)verticaltoothrange.Value;
+ effect.HorizontalToothRange = (int)horizontaltoothrange.Value;
+ DialogResult = DialogResult.OK;
+ }
+ }
+}
diff --git a/Greenshot/Greenshot.csproj b/Greenshot/Greenshot.csproj
index 08702f8a8..9dea775fb 100644
--- a/Greenshot/Greenshot.csproj
+++ b/Greenshot/Greenshot.csproj
@@ -134,6 +134,12 @@
CaptureForm.cs
+
+ Form
+
+
+ DropShadowSettingsForm.cs
+
Form
@@ -143,6 +149,12 @@
Form
+
+ Form
+
+
+ TornEdgeSettingsForm.cs
+
Form
diff --git a/GreenshotPlugin/Core/Effects.cs b/GreenshotPlugin/Core/Effects.cs
index 753fcaef4..43aac5835 100644
--- a/GreenshotPlugin/Core/Effects.cs
+++ b/GreenshotPlugin/Core/Effects.cs
@@ -57,35 +57,36 @@ namespace Greenshot.Core {
get;
set;
}
- public Bitmap Apply(Bitmap sourceBitmap, out Point offsetChange) {
+ public virtual Bitmap Apply(Bitmap sourceBitmap, out Point offsetChange) {
return ImageHelper.CreateShadow(sourceBitmap, Darkness, ShadowSize, ShadowOffset, out offsetChange, PixelFormat.Format32bppArgb); //Image.PixelFormat);
}
}
///
- /// TornEdgeEffect
+ /// TornEdgeEffect extends on DropShadowEffect
///
- public class TornEdgeEffect : IEffect {
- public TornEdgeEffect() {
- Darkness = 1f;
+ public class TornEdgeEffect : DropShadowEffect {
+ public TornEdgeEffect() : base() {
ShadowSize = 7;
- ShadowOffset = new Point(-1, -1);
+ ToothHeight = 12;
+ HorizontalToothRange = 20;
+ VerticalToothRange = 20;
}
- public float Darkness {
+ public int ToothHeight {
get;
set;
}
- public int ShadowSize {
+ public int HorizontalToothRange {
get;
set;
}
- public Point ShadowOffset {
+ public int VerticalToothRange {
get;
set;
}
- public Bitmap Apply(Bitmap sourceBitmap, out Point offsetChange) {
- using (Bitmap tmpTornImage = ImageHelper.CreateTornEdge(sourceBitmap)) {
- return ImageHelper.CreateShadow(tmpTornImage, Darkness, ShadowSize, ShadowOffset, out offsetChange, PixelFormat.Format32bppArgb); //Image.PixelFormat);
+ public override Bitmap Apply(Bitmap sourceBitmap, out Point offsetChange) {
+ using (Bitmap tmpTornImage = ImageHelper.CreateTornEdge(sourceBitmap, ToothHeight, HorizontalToothRange, VerticalToothRange)) {
+ return ImageHelper.CreateShadow(tmpTornImage, Darkness, ShadowSize, ShadowOffset, out offsetChange, PixelFormat.Format32bppArgb);
}
}
}
diff --git a/GreenshotPlugin/Core/ImageHelper.cs b/GreenshotPlugin/Core/ImageHelper.cs
index 6e8397fa3..780049a63 100644
--- a/GreenshotPlugin/Core/ImageHelper.cs
+++ b/GreenshotPlugin/Core/ImageHelper.cs
@@ -372,24 +372,24 @@ namespace GreenshotPlugin.Core {
/// Make the picture look like it's torn
///
/// Bitmap to make torn edge off
+ /// How large (height) is each tooth
+ /// How wide is a horizontal tooth
+ /// How wide is a vertical tooth
/// Changed bitmap
- public static Bitmap CreateTornEdge(Bitmap sourceBitmap) {
+ public static Bitmap CreateTornEdge(Bitmap sourceBitmap, int toothHeight, int horizontalToothRange, int verticalToothRange) {
Bitmap returnImage = CreateEmpty(sourceBitmap.Width, sourceBitmap.Height, PixelFormat.Format32bppArgb, Color.Empty, sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution);
using (GraphicsPath path = new GraphicsPath()) {
Random random = new Random();
- int regionWidth = 20;
- int regionHeight = 20;
- int HorizontalRegions = (int)(sourceBitmap.Width / regionWidth);
- int VerticalRegions = (int)(sourceBitmap.Height / regionHeight);
- int distance = 12;
+ int HorizontalRegions = (int)(sourceBitmap.Width / horizontalToothRange);
+ int VerticalRegions = (int)(sourceBitmap.Height / verticalToothRange);
// Start
- Point previousEndingPoint = new Point(regionWidth, random.Next(1, distance));
+ Point previousEndingPoint = new Point(horizontalToothRange, random.Next(1, toothHeight));
Point newEndingPoint;
// Top
for (int i = 0; i < HorizontalRegions; i++) {
- int x = (int)previousEndingPoint.X + regionWidth;
- int y = random.Next(1, distance);
+ int x = (int)previousEndingPoint.X + horizontalToothRange;
+ int y = random.Next(1, toothHeight);
newEndingPoint = new Point(x, y);
path.AddLine(previousEndingPoint, newEndingPoint);
previousEndingPoint = newEndingPoint;
@@ -397,8 +397,8 @@ namespace GreenshotPlugin.Core {
// Right
for (int i = 0; i < VerticalRegions; i++) {
- int x = sourceBitmap.Width - random.Next(1, distance);
- int y = (int)previousEndingPoint.Y + regionHeight;
+ int x = sourceBitmap.Width - random.Next(1, toothHeight);
+ int y = (int)previousEndingPoint.Y + verticalToothRange;
newEndingPoint = new Point(x, y);
path.AddLine(previousEndingPoint, newEndingPoint);
previousEndingPoint = newEndingPoint;
@@ -406,8 +406,8 @@ namespace GreenshotPlugin.Core {
// Bottom
for (int i = 0; i < HorizontalRegions; i++) {
- int x = (int)previousEndingPoint.X - regionWidth;
- int y = sourceBitmap.Height - random.Next(1, distance);
+ int x = (int)previousEndingPoint.X - horizontalToothRange;
+ int y = sourceBitmap.Height - random.Next(1, toothHeight);
newEndingPoint = new Point(x, y);
path.AddLine(previousEndingPoint, newEndingPoint);
previousEndingPoint = newEndingPoint;
@@ -415,8 +415,8 @@ namespace GreenshotPlugin.Core {
// Left
for (int i = 0; i < VerticalRegions; i++) {
- int x = random.Next(1, distance);
- int y = (int)previousEndingPoint.Y - regionHeight;
+ int x = random.Next(1, toothHeight);
+ int y = (int)previousEndingPoint.Y - verticalToothRange;
newEndingPoint = new Point(x, y);
path.AddLine(previousEndingPoint, newEndingPoint);
previousEndingPoint = newEndingPoint;