mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Added "no shadow" for the Torn-Edge effect, also fixed some tear bugs (hopefully) and simplified the code.
This commit is contained in:
parent
fb993c2238
commit
8c22a44b33
4 changed files with 131 additions and 83 deletions
80
Greenshot/Forms/TornEdgeSettingsForm.Designer.cs
generated
80
Greenshot/Forms/TornEdgeSettingsForm.Designer.cs
generated
|
@ -47,7 +47,7 @@ namespace Greenshot.Forms {
|
||||||
this.offsetX = new System.Windows.Forms.NumericUpDown();
|
this.offsetX = new System.Windows.Forms.NumericUpDown();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.offsetY = new System.Windows.Forms.NumericUpDown();
|
this.offsetY = new System.Windows.Forms.NumericUpDown();
|
||||||
this.trackBar1 = new System.Windows.Forms.TrackBar();
|
this.shadowDarkness = new System.Windows.Forms.TrackBar();
|
||||||
this.buttonOK = new GreenshotPlugin.Controls.GreenshotButton();
|
this.buttonOK = new GreenshotPlugin.Controls.GreenshotButton();
|
||||||
this.buttonCancel = new GreenshotPlugin.Controls.GreenshotButton();
|
this.buttonCancel = new GreenshotPlugin.Controls.GreenshotButton();
|
||||||
this.labelDarkness = new GreenshotPlugin.Controls.GreenshotLabel();
|
this.labelDarkness = new GreenshotPlugin.Controls.GreenshotLabel();
|
||||||
|
@ -63,10 +63,11 @@ namespace Greenshot.Forms {
|
||||||
this.right = new GreenshotPlugin.Controls.GreenshotCheckBox();
|
this.right = new GreenshotPlugin.Controls.GreenshotCheckBox();
|
||||||
this.bottom = new GreenshotPlugin.Controls.GreenshotCheckBox();
|
this.bottom = new GreenshotPlugin.Controls.GreenshotCheckBox();
|
||||||
this.left = new GreenshotPlugin.Controls.GreenshotCheckBox();
|
this.left = new GreenshotPlugin.Controls.GreenshotCheckBox();
|
||||||
|
this.shadowCheckbox = new GreenshotPlugin.Controls.GreenshotCheckBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.thickness)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.thickness)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.offsetX)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.offsetX)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.offsetY)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.offsetY)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.shadowDarkness)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.toothsize)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.toothsize)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.horizontaltoothrange)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.horizontaltoothrange)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.verticaltoothrange)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.verticaltoothrange)).BeginInit();
|
||||||
|
@ -74,7 +75,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
// thickness
|
// thickness
|
||||||
//
|
//
|
||||||
this.thickness.Location = new System.Drawing.Point(173, 7);
|
this.thickness.Location = new System.Drawing.Point(173, 35);
|
||||||
this.thickness.Maximum = new decimal(new int[] {
|
this.thickness.Maximum = new decimal(new int[] {
|
||||||
20,
|
20,
|
||||||
0,
|
0,
|
||||||
|
@ -96,7 +97,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
// offsetX
|
// offsetX
|
||||||
//
|
//
|
||||||
this.offsetX.Location = new System.Drawing.Point(102, 33);
|
this.offsetX.Location = new System.Drawing.Point(102, 61);
|
||||||
this.offsetX.Maximum = new decimal(new int[] {
|
this.offsetX.Maximum = new decimal(new int[] {
|
||||||
20,
|
20,
|
||||||
0,
|
0,
|
||||||
|
@ -119,7 +120,7 @@ namespace Greenshot.Forms {
|
||||||
// label3
|
// label3
|
||||||
//
|
//
|
||||||
this.label3.AutoSize = true;
|
this.label3.AutoSize = true;
|
||||||
this.label3.Location = new System.Drawing.Point(153, 35);
|
this.label3.Location = new System.Drawing.Point(153, 63);
|
||||||
this.label3.Name = "label3";
|
this.label3.Name = "label3";
|
||||||
this.label3.Size = new System.Drawing.Size(14, 13);
|
this.label3.Size = new System.Drawing.Size(14, 13);
|
||||||
this.label3.TabIndex = 5;
|
this.label3.TabIndex = 5;
|
||||||
|
@ -127,7 +128,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
// offsetY
|
// offsetY
|
||||||
//
|
//
|
||||||
this.offsetY.Location = new System.Drawing.Point(173, 33);
|
this.offsetY.Location = new System.Drawing.Point(173, 61);
|
||||||
this.offsetY.Maximum = new decimal(new int[] {
|
this.offsetY.Maximum = new decimal(new int[] {
|
||||||
20,
|
20,
|
||||||
0,
|
0,
|
||||||
|
@ -147,20 +148,20 @@ namespace Greenshot.Forms {
|
||||||
0,
|
0,
|
||||||
-2147483648});
|
-2147483648});
|
||||||
//
|
//
|
||||||
// trackBar1
|
// shadowDarkness
|
||||||
//
|
//
|
||||||
this.trackBar1.Location = new System.Drawing.Point(102, 59);
|
this.shadowDarkness.Location = new System.Drawing.Point(102, 87);
|
||||||
this.trackBar1.Maximum = 40;
|
this.shadowDarkness.Maximum = 40;
|
||||||
this.trackBar1.Minimum = 1;
|
this.shadowDarkness.Minimum = 1;
|
||||||
this.trackBar1.Name = "trackBar1";
|
this.shadowDarkness.Name = "shadowDarkness";
|
||||||
this.trackBar1.Size = new System.Drawing.Size(116, 45);
|
this.shadowDarkness.Size = new System.Drawing.Size(116, 45);
|
||||||
this.trackBar1.TabIndex = 7;
|
this.shadowDarkness.TabIndex = 7;
|
||||||
this.trackBar1.Value = 40;
|
this.shadowDarkness.Value = 40;
|
||||||
//
|
//
|
||||||
// buttonOK
|
// buttonOK
|
||||||
//
|
//
|
||||||
this.buttonOK.LanguageKey = "OK";
|
this.buttonOK.LanguageKey = "OK";
|
||||||
this.buttonOK.Location = new System.Drawing.Point(62, 292);
|
this.buttonOK.Location = new System.Drawing.Point(62, 320);
|
||||||
this.buttonOK.Name = "buttonOK";
|
this.buttonOK.Name = "buttonOK";
|
||||||
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
||||||
this.buttonOK.TabIndex = 11;
|
this.buttonOK.TabIndex = 11;
|
||||||
|
@ -172,7 +173,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.buttonCancel.LanguageKey = "CANCEL";
|
this.buttonCancel.LanguageKey = "CANCEL";
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(143, 292);
|
this.buttonCancel.Location = new System.Drawing.Point(143, 320);
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||||
this.buttonCancel.TabIndex = 12;
|
this.buttonCancel.TabIndex = 12;
|
||||||
|
@ -183,7 +184,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
this.labelDarkness.AutoSize = true;
|
this.labelDarkness.AutoSize = true;
|
||||||
this.labelDarkness.LanguageKey = "editor_dropshadow_darkness";
|
this.labelDarkness.LanguageKey = "editor_dropshadow_darkness";
|
||||||
this.labelDarkness.Location = new System.Drawing.Point(12, 69);
|
this.labelDarkness.Location = new System.Drawing.Point(12, 97);
|
||||||
this.labelDarkness.Name = "labelDarkness";
|
this.labelDarkness.Name = "labelDarkness";
|
||||||
this.labelDarkness.Size = new System.Drawing.Size(92, 13);
|
this.labelDarkness.Size = new System.Drawing.Size(92, 13);
|
||||||
this.labelDarkness.TabIndex = 13;
|
this.labelDarkness.TabIndex = 13;
|
||||||
|
@ -193,7 +194,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
this.labelOffset.AutoSize = true;
|
this.labelOffset.AutoSize = true;
|
||||||
this.labelOffset.LanguageKey = "editor_dropshadow_offset";
|
this.labelOffset.LanguageKey = "editor_dropshadow_offset";
|
||||||
this.labelOffset.Location = new System.Drawing.Point(12, 35);
|
this.labelOffset.Location = new System.Drawing.Point(12, 63);
|
||||||
this.labelOffset.Name = "labelOffset";
|
this.labelOffset.Name = "labelOffset";
|
||||||
this.labelOffset.Size = new System.Drawing.Size(75, 13);
|
this.labelOffset.Size = new System.Drawing.Size(75, 13);
|
||||||
this.labelOffset.TabIndex = 14;
|
this.labelOffset.TabIndex = 14;
|
||||||
|
@ -203,7 +204,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
this.labelThickness.AutoSize = true;
|
this.labelThickness.AutoSize = true;
|
||||||
this.labelThickness.LanguageKey = "editor_dropshadow_thickness";
|
this.labelThickness.LanguageKey = "editor_dropshadow_thickness";
|
||||||
this.labelThickness.Location = new System.Drawing.Point(12, 9);
|
this.labelThickness.Location = new System.Drawing.Point(12, 37);
|
||||||
this.labelThickness.Name = "labelThickness";
|
this.labelThickness.Name = "labelThickness";
|
||||||
this.labelThickness.Size = new System.Drawing.Size(94, 13);
|
this.labelThickness.Size = new System.Drawing.Size(94, 13);
|
||||||
this.labelThickness.TabIndex = 15;
|
this.labelThickness.TabIndex = 15;
|
||||||
|
@ -211,7 +212,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
// toothsize
|
// toothsize
|
||||||
//
|
//
|
||||||
this.toothsize.Location = new System.Drawing.Point(173, 110);
|
this.toothsize.Location = new System.Drawing.Point(173, 138);
|
||||||
this.toothsize.Maximum = new decimal(new int[] {
|
this.toothsize.Maximum = new decimal(new int[] {
|
||||||
40,
|
40,
|
||||||
0,
|
0,
|
||||||
|
@ -235,7 +236,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
this.label_toothsize.AutoSize = true;
|
this.label_toothsize.AutoSize = true;
|
||||||
this.label_toothsize.LanguageKey = "editor_tornedge_toothsize";
|
this.label_toothsize.LanguageKey = "editor_tornedge_toothsize";
|
||||||
this.label_toothsize.Location = new System.Drawing.Point(12, 112);
|
this.label_toothsize.Location = new System.Drawing.Point(12, 140);
|
||||||
this.label_toothsize.Name = "label_toothsize";
|
this.label_toothsize.Name = "label_toothsize";
|
||||||
this.label_toothsize.Size = new System.Drawing.Size(56, 13);
|
this.label_toothsize.Size = new System.Drawing.Size(56, 13);
|
||||||
this.label_toothsize.TabIndex = 17;
|
this.label_toothsize.TabIndex = 17;
|
||||||
|
@ -245,7 +246,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
this.label_horizontaltoothrange.AutoSize = true;
|
this.label_horizontaltoothrange.AutoSize = true;
|
||||||
this.label_horizontaltoothrange.LanguageKey = "editor_tornedge_horizontaltoothrange";
|
this.label_horizontaltoothrange.LanguageKey = "editor_tornedge_horizontaltoothrange";
|
||||||
this.label_horizontaltoothrange.Location = new System.Drawing.Point(12, 138);
|
this.label_horizontaltoothrange.Location = new System.Drawing.Point(12, 166);
|
||||||
this.label_horizontaltoothrange.Name = "label_horizontaltoothrange";
|
this.label_horizontaltoothrange.Name = "label_horizontaltoothrange";
|
||||||
this.label_horizontaltoothrange.Size = new System.Drawing.Size(111, 13);
|
this.label_horizontaltoothrange.Size = new System.Drawing.Size(111, 13);
|
||||||
this.label_horizontaltoothrange.TabIndex = 19;
|
this.label_horizontaltoothrange.TabIndex = 19;
|
||||||
|
@ -253,7 +254,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
// horizontaltoothrange
|
// horizontaltoothrange
|
||||||
//
|
//
|
||||||
this.horizontaltoothrange.Location = new System.Drawing.Point(173, 136);
|
this.horizontaltoothrange.Location = new System.Drawing.Point(173, 164);
|
||||||
this.horizontaltoothrange.Maximum = new decimal(new int[] {
|
this.horizontaltoothrange.Maximum = new decimal(new int[] {
|
||||||
40,
|
40,
|
||||||
0,
|
0,
|
||||||
|
@ -277,7 +278,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
this.labelVerticaltoothrange.AutoSize = true;
|
this.labelVerticaltoothrange.AutoSize = true;
|
||||||
this.labelVerticaltoothrange.LanguageKey = "editor_tornedge_verticaltoothrange";
|
this.labelVerticaltoothrange.LanguageKey = "editor_tornedge_verticaltoothrange";
|
||||||
this.labelVerticaltoothrange.Location = new System.Drawing.Point(12, 164);
|
this.labelVerticaltoothrange.Location = new System.Drawing.Point(12, 192);
|
||||||
this.labelVerticaltoothrange.Name = "labelVerticaltoothrange";
|
this.labelVerticaltoothrange.Name = "labelVerticaltoothrange";
|
||||||
this.labelVerticaltoothrange.Size = new System.Drawing.Size(99, 13);
|
this.labelVerticaltoothrange.Size = new System.Drawing.Size(99, 13);
|
||||||
this.labelVerticaltoothrange.TabIndex = 21;
|
this.labelVerticaltoothrange.TabIndex = 21;
|
||||||
|
@ -285,7 +286,7 @@ namespace Greenshot.Forms {
|
||||||
//
|
//
|
||||||
// verticaltoothrange
|
// verticaltoothrange
|
||||||
//
|
//
|
||||||
this.verticaltoothrange.Location = new System.Drawing.Point(173, 162);
|
this.verticaltoothrange.Location = new System.Drawing.Point(173, 190);
|
||||||
this.verticaltoothrange.Maximum = new decimal(new int[] {
|
this.verticaltoothrange.Maximum = new decimal(new int[] {
|
||||||
40,
|
40,
|
||||||
0,
|
0,
|
||||||
|
@ -308,7 +309,7 @@ namespace Greenshot.Forms {
|
||||||
// top
|
// top
|
||||||
//
|
//
|
||||||
this.top.AutoSize = true;
|
this.top.AutoSize = true;
|
||||||
this.top.Location = new System.Drawing.Point(15, 194);
|
this.top.Location = new System.Drawing.Point(15, 222);
|
||||||
this.top.Name = "top";
|
this.top.Name = "top";
|
||||||
this.top.Size = new System.Drawing.Size(88, 17);
|
this.top.Size = new System.Drawing.Size(88, 17);
|
||||||
this.top.TabIndex = 22;
|
this.top.TabIndex = 22;
|
||||||
|
@ -318,7 +319,7 @@ namespace Greenshot.Forms {
|
||||||
// right
|
// right
|
||||||
//
|
//
|
||||||
this.right.AutoSize = true;
|
this.right.AutoSize = true;
|
||||||
this.right.Location = new System.Drawing.Point(15, 217);
|
this.right.Location = new System.Drawing.Point(15, 245);
|
||||||
this.right.Name = "right";
|
this.right.Name = "right";
|
||||||
this.right.Size = new System.Drawing.Size(93, 17);
|
this.right.Size = new System.Drawing.Size(93, 17);
|
||||||
this.right.TabIndex = 23;
|
this.right.TabIndex = 23;
|
||||||
|
@ -328,7 +329,7 @@ namespace Greenshot.Forms {
|
||||||
// bottom
|
// bottom
|
||||||
//
|
//
|
||||||
this.bottom.AutoSize = true;
|
this.bottom.AutoSize = true;
|
||||||
this.bottom.Location = new System.Drawing.Point(15, 240);
|
this.bottom.Location = new System.Drawing.Point(15, 268);
|
||||||
this.bottom.Name = "bottom";
|
this.bottom.Name = "bottom";
|
||||||
this.bottom.Size = new System.Drawing.Size(105, 17);
|
this.bottom.Size = new System.Drawing.Size(105, 17);
|
||||||
this.bottom.TabIndex = 24;
|
this.bottom.TabIndex = 24;
|
||||||
|
@ -338,21 +339,33 @@ namespace Greenshot.Forms {
|
||||||
// left
|
// left
|
||||||
//
|
//
|
||||||
this.left.AutoSize = true;
|
this.left.AutoSize = true;
|
||||||
this.left.Location = new System.Drawing.Point(15, 263);
|
this.left.Location = new System.Drawing.Point(15, 291);
|
||||||
this.left.Name = "left";
|
this.left.Name = "left";
|
||||||
this.left.Size = new System.Drawing.Size(87, 17);
|
this.left.Size = new System.Drawing.Size(87, 17);
|
||||||
this.left.TabIndex = 25;
|
this.left.TabIndex = 25;
|
||||||
this.left.Text = "Tear left side";
|
this.left.Text = "Tear left side";
|
||||||
this.left.UseVisualStyleBackColor = true;
|
this.left.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// shadowCheckbox
|
||||||
|
//
|
||||||
|
this.shadowCheckbox.AutoSize = true;
|
||||||
|
this.shadowCheckbox.Location = new System.Drawing.Point(12, 12);
|
||||||
|
this.shadowCheckbox.Name = "shadowCheckbox";
|
||||||
|
this.shadowCheckbox.Size = new System.Drawing.Size(110, 17);
|
||||||
|
this.shadowCheckbox.TabIndex = 26;
|
||||||
|
this.shadowCheckbox.Text = "Generate shadow";
|
||||||
|
this.shadowCheckbox.UseVisualStyleBackColor = true;
|
||||||
|
this.shadowCheckbox.CheckedChanged += new System.EventHandler(this.shadowCheckbox_CheckedChanged);
|
||||||
|
//
|
||||||
// TornEdgeSettingsForm
|
// TornEdgeSettingsForm
|
||||||
//
|
//
|
||||||
this.AcceptButton = this.buttonOK;
|
this.AcceptButton = this.buttonOK;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.CancelButton = this.buttonCancel;
|
this.CancelButton = this.buttonCancel;
|
||||||
this.ClientSize = new System.Drawing.Size(230, 324);
|
this.ClientSize = new System.Drawing.Size(230, 353);
|
||||||
this.ControlBox = false;
|
this.ControlBox = false;
|
||||||
|
this.Controls.Add(this.shadowCheckbox);
|
||||||
this.Controls.Add(this.left);
|
this.Controls.Add(this.left);
|
||||||
this.Controls.Add(this.bottom);
|
this.Controls.Add(this.bottom);
|
||||||
this.Controls.Add(this.right);
|
this.Controls.Add(this.right);
|
||||||
|
@ -368,7 +381,7 @@ namespace Greenshot.Forms {
|
||||||
this.Controls.Add(this.labelDarkness);
|
this.Controls.Add(this.labelDarkness);
|
||||||
this.Controls.Add(this.buttonCancel);
|
this.Controls.Add(this.buttonCancel);
|
||||||
this.Controls.Add(this.buttonOK);
|
this.Controls.Add(this.buttonOK);
|
||||||
this.Controls.Add(this.trackBar1);
|
this.Controls.Add(this.shadowDarkness);
|
||||||
this.Controls.Add(this.offsetY);
|
this.Controls.Add(this.offsetY);
|
||||||
this.Controls.Add(this.label3);
|
this.Controls.Add(this.label3);
|
||||||
this.Controls.Add(this.offsetX);
|
this.Controls.Add(this.offsetX);
|
||||||
|
@ -383,7 +396,7 @@ namespace Greenshot.Forms {
|
||||||
((System.ComponentModel.ISupportInitialize)(this.thickness)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.thickness)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.offsetX)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.offsetX)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.offsetY)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.offsetY)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.shadowDarkness)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.toothsize)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.toothsize)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.horizontaltoothrange)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.horizontaltoothrange)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.verticaltoothrange)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.verticaltoothrange)).EndInit();
|
||||||
|
@ -398,7 +411,7 @@ namespace Greenshot.Forms {
|
||||||
private System.Windows.Forms.NumericUpDown offsetX;
|
private System.Windows.Forms.NumericUpDown offsetX;
|
||||||
private System.Windows.Forms.Label label3;
|
private System.Windows.Forms.Label label3;
|
||||||
private System.Windows.Forms.NumericUpDown offsetY;
|
private System.Windows.Forms.NumericUpDown offsetY;
|
||||||
private System.Windows.Forms.TrackBar trackBar1;
|
private System.Windows.Forms.TrackBar shadowDarkness;
|
||||||
private GreenshotPlugin.Controls.GreenshotButton buttonOK;
|
private GreenshotPlugin.Controls.GreenshotButton buttonOK;
|
||||||
private GreenshotPlugin.Controls.GreenshotButton buttonCancel;
|
private GreenshotPlugin.Controls.GreenshotButton buttonCancel;
|
||||||
private GreenshotPlugin.Controls.GreenshotLabel labelDarkness;
|
private GreenshotPlugin.Controls.GreenshotLabel labelDarkness;
|
||||||
|
@ -414,5 +427,6 @@ namespace Greenshot.Forms {
|
||||||
private GreenshotPlugin.Controls.GreenshotCheckBox right;
|
private GreenshotPlugin.Controls.GreenshotCheckBox right;
|
||||||
private GreenshotPlugin.Controls.GreenshotCheckBox bottom;
|
private GreenshotPlugin.Controls.GreenshotCheckBox bottom;
|
||||||
private GreenshotPlugin.Controls.GreenshotCheckBox left;
|
private GreenshotPlugin.Controls.GreenshotCheckBox left;
|
||||||
|
private GreenshotPlugin.Controls.GreenshotCheckBox shadowCheckbox;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,7 +31,8 @@ namespace Greenshot.Forms {
|
||||||
this.effect = effect;
|
this.effect = effect;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Icon = GreenshotResources.getGreenshotIcon();
|
this.Icon = GreenshotResources.getGreenshotIcon();
|
||||||
trackBar1.Value = (int)(effect.Darkness * 40);
|
shadowCheckbox.Checked = effect.GenerateShadow;
|
||||||
|
shadowDarkness.Value = (int)(effect.Darkness * 40);
|
||||||
offsetX.Value = effect.ShadowOffset.X;
|
offsetX.Value = effect.ShadowOffset.X;
|
||||||
offsetY.Value = effect.ShadowOffset.Y;
|
offsetY.Value = effect.ShadowOffset.Y;
|
||||||
toothsize.Value = effect.ToothHeight;
|
toothsize.Value = effect.ToothHeight;
|
||||||
|
@ -44,14 +45,22 @@ namespace Greenshot.Forms {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonOK_Click(object sender, EventArgs e) {
|
private void buttonOK_Click(object sender, EventArgs e) {
|
||||||
effect.Darkness = (float)trackBar1.Value / (float)40;
|
effect.Darkness = (float)shadowDarkness.Value / (float)40;
|
||||||
effect.ShadowOffset = new Point((int)offsetX.Value, (int)offsetY.Value);
|
effect.ShadowOffset = new Point((int)offsetX.Value, (int)offsetY.Value);
|
||||||
effect.ShadowSize = (int)thickness.Value;
|
effect.ShadowSize = (int)thickness.Value;
|
||||||
effect.ToothHeight = (int)toothsize.Value;
|
effect.ToothHeight = (int)toothsize.Value;
|
||||||
effect.VerticalToothRange = (int)verticaltoothrange.Value;
|
effect.VerticalToothRange = (int)verticaltoothrange.Value;
|
||||||
effect.HorizontalToothRange = (int)horizontaltoothrange.Value;
|
effect.HorizontalToothRange = (int)horizontaltoothrange.Value;
|
||||||
effect.Edges = new bool[] { top.Checked, right.Checked, bottom.Checked, left.Checked };
|
effect.Edges = new bool[] { top.Checked, right.Checked, bottom.Checked, left.Checked };
|
||||||
|
effect.GenerateShadow = shadowCheckbox.Checked;
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void shadowCheckbox_CheckedChanged(object sender, EventArgs e) {
|
||||||
|
thickness.Enabled = shadowCheckbox.Checked;
|
||||||
|
offsetX.Enabled = shadowCheckbox.Checked;
|
||||||
|
offsetY.Enabled = shadowCheckbox.Checked;
|
||||||
|
shadowDarkness.Enabled = shadowCheckbox.Checked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ namespace Greenshot.Core {
|
||||||
HorizontalToothRange = 20;
|
HorizontalToothRange = 20;
|
||||||
VerticalToothRange = 20;
|
VerticalToothRange = 20;
|
||||||
Edges = new bool[] {true, true, true, true};
|
Edges = new bool[] {true, true, true, true};
|
||||||
|
GenerateShadow = true;
|
||||||
}
|
}
|
||||||
public int ToothHeight {
|
public int ToothHeight {
|
||||||
get;
|
get;
|
||||||
|
@ -87,10 +88,19 @@ namespace Greenshot.Core {
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
public bool GenerateShadow {
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public override Image Apply(Image sourceImage, Matrix matrix) {
|
public override Image Apply(Image sourceImage, Matrix matrix) {
|
||||||
using (Image tmpTornImage = ImageHelper.CreateTornEdge(sourceImage, ToothHeight, HorizontalToothRange, VerticalToothRange, Edges)) {
|
Image tmpTornImage = ImageHelper.CreateTornEdge(sourceImage, ToothHeight, HorizontalToothRange, VerticalToothRange, Edges);
|
||||||
return ImageHelper.CreateShadow(tmpTornImage, Darkness, ShadowSize, ShadowOffset, matrix, PixelFormat.Format32bppArgb);
|
if (GenerateShadow) {
|
||||||
|
using (tmpTornImage) {
|
||||||
|
return ImageHelper.CreateShadow(tmpTornImage, Darkness, ShadowSize, ShadowOffset, matrix, PixelFormat.Format32bppArgb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return tmpTornImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -441,6 +441,18 @@ namespace GreenshotPlugin.Core {
|
||||||
return currentImage;
|
return currentImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method for the tornedge
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">Path to draw to</param>
|
||||||
|
/// <param name="points">Points for the lines to draw</param>
|
||||||
|
private static void DrawLines(GraphicsPath path, List<Point> points) {
|
||||||
|
path.AddLine(points[0], points[1]);
|
||||||
|
for (int i = 0; i < points.Count-1; i++) {
|
||||||
|
path.AddLine(points[i], points[i+1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make the picture look like it's torn
|
/// Make the picture look like it's torn
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -454,69 +466,72 @@ namespace GreenshotPlugin.Core {
|
||||||
Image returnImage = CreateEmpty(sourceImage.Width, sourceImage.Height, PixelFormat.Format32bppArgb, Color.Empty, sourceImage.HorizontalResolution, sourceImage.VerticalResolution);
|
Image returnImage = CreateEmpty(sourceImage.Width, sourceImage.Height, PixelFormat.Format32bppArgb, Color.Empty, sourceImage.HorizontalResolution, sourceImage.VerticalResolution);
|
||||||
using (GraphicsPath path = new GraphicsPath()) {
|
using (GraphicsPath path = new GraphicsPath()) {
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
int horizontalRegions = sourceImage.Width / horizontalToothRange;
|
int horizontalRegions = (int)Math.Round((float)sourceImage.Width / horizontalToothRange);
|
||||||
int verticalRegions = sourceImage.Height / verticalToothRange;
|
int verticalRegions = (int)Math.Round((float)sourceImage.Height / verticalToothRange);
|
||||||
|
|
||||||
|
Point topLeft = new Point(0, 0);
|
||||||
|
Point topRight = new Point(sourceImage.Width, 0);
|
||||||
|
Point bottomLeft = new Point(0, sourceImage.Height);
|
||||||
|
Point bottomRight = new Point(sourceImage.Width, sourceImage.Height);
|
||||||
|
|
||||||
|
List<Point> points = new List<Point>();
|
||||||
|
|
||||||
// Start
|
|
||||||
Point previousEndingPoint = new Point(0,0);
|
|
||||||
Point newEndingPoint;
|
|
||||||
if (edges[0]) {
|
if (edges[0]) {
|
||||||
previousEndingPoint = new Point(horizontalToothRange, random.Next(1, toothHeight));
|
// calculate starting point only if the left edge is torn
|
||||||
// Top
|
if (!edges[3]) {
|
||||||
for (int i = 0; i < horizontalRegions; i++) {
|
points.Add(topLeft);
|
||||||
int x = previousEndingPoint.X + horizontalToothRange;
|
} else {
|
||||||
int y = random.Next(1, toothHeight);
|
points.Add(new Point(random.Next(1, toothHeight), random.Next(1, toothHeight)));
|
||||||
newEndingPoint = new Point(x, y);
|
|
||||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
|
||||||
previousEndingPoint = newEndingPoint;
|
|
||||||
}
|
}
|
||||||
|
for (int i = 1; i < horizontalRegions-1; i++) {
|
||||||
|
points.Add(new Point(i*horizontalToothRange, random.Next(1, toothHeight)));
|
||||||
|
}
|
||||||
|
points.Add(new Point(sourceImage.Width - random.Next(1, toothHeight), random.Next(1, toothHeight)));
|
||||||
} else {
|
} else {
|
||||||
newEndingPoint = new Point(sourceImage.Width, 0);
|
// set start & endpoint to be the default "whole-line"
|
||||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
points.Add(topLeft);
|
||||||
previousEndingPoint = newEndingPoint;
|
points.Add(topRight);
|
||||||
}
|
}
|
||||||
|
// Right
|
||||||
if (edges[1]) {
|
if (edges[1]) {
|
||||||
// Right
|
for (int i = 1; i < verticalRegions-1; i++) {
|
||||||
for (int i = 0; i < verticalRegions; i++) {
|
points.Add(new Point(sourceImage.Width - random.Next(1, toothHeight), i * verticalToothRange));
|
||||||
int x = sourceImage.Width - random.Next(1, toothHeight);
|
|
||||||
int y = previousEndingPoint.Y + verticalToothRange;
|
|
||||||
newEndingPoint = new Point(x, y);
|
|
||||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
|
||||||
previousEndingPoint = newEndingPoint;
|
|
||||||
}
|
}
|
||||||
|
points.Add(new Point(sourceImage.Width - random.Next(1, toothHeight), sourceImage.Height - random.Next(1, toothHeight)));
|
||||||
} else {
|
} else {
|
||||||
newEndingPoint = new Point(sourceImage.Width, sourceImage.Height);
|
// correct previous ending point
|
||||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
points[points.Count - 1] = topRight;
|
||||||
previousEndingPoint = newEndingPoint;
|
// set endpoint to be the default "whole-line"
|
||||||
|
points.Add(bottomRight);
|
||||||
}
|
}
|
||||||
|
// Bottom
|
||||||
if (edges[2]) {
|
if (edges[2]) {
|
||||||
// Bottom
|
for (int i = 1; i < horizontalRegions -1; i++) {
|
||||||
for (int i = 0; i < horizontalRegions; i++) {
|
points.Add(new Point(sourceImage.Width - i * horizontalToothRange, sourceImage.Height - random.Next(1, toothHeight)));
|
||||||
int x = previousEndingPoint.X - horizontalToothRange;
|
|
||||||
int y = sourceImage.Height - random.Next(1, toothHeight);
|
|
||||||
newEndingPoint = new Point(x, y);
|
|
||||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
|
||||||
previousEndingPoint = newEndingPoint;
|
|
||||||
}
|
}
|
||||||
|
points.Add(new Point(random.Next(1, toothHeight), sourceImage.Height - random.Next(1, toothHeight)));
|
||||||
} else {
|
} else {
|
||||||
newEndingPoint = new Point(0, sourceImage.Height);
|
// correct previous ending point
|
||||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
points[points.Count - 1] = bottomRight;
|
||||||
previousEndingPoint = newEndingPoint;
|
// set endpoint to be the default "whole-line"
|
||||||
|
points.Add(bottomLeft);
|
||||||
}
|
}
|
||||||
|
// Left
|
||||||
if (edges[3]) {
|
if (edges[3]) {
|
||||||
// Left
|
// One fewer as the end point is the starting point
|
||||||
for (int i = 0; i < verticalRegions; i++) {
|
for (int i = 1; i < verticalRegions -1; i++) {
|
||||||
int x = random.Next(1, toothHeight);
|
points.Add(new Point(random.Next(1, toothHeight), points[points.Count - 1].Y - verticalToothRange));
|
||||||
int y = previousEndingPoint.Y - verticalToothRange;
|
|
||||||
newEndingPoint = new Point(x, y);
|
|
||||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
|
||||||
previousEndingPoint = newEndingPoint;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newEndingPoint = new Point(0, 0);
|
// correct previous ending point
|
||||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
points[points.Count - 1] = bottomLeft;
|
||||||
//previousEndingPoint = newEndingPoint;
|
// set endpoint to be the default "whole-line"
|
||||||
|
points.Add(topLeft);
|
||||||
}
|
}
|
||||||
|
// End point always is the starting point
|
||||||
|
points[points.Count - 1] = points[0];
|
||||||
|
|
||||||
|
DrawLines(path, points);
|
||||||
|
|
||||||
path.CloseFigure();
|
path.CloseFigure();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue