fixed #2660: Added "Add image effects" button to image editor menu

This commit is contained in:
Jaex 2018-01-20 00:36:05 +03:00
parent afa273d884
commit b9387701cf
6 changed files with 49 additions and 0 deletions

View file

@ -523,6 +523,16 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap image_saturation {
get {
object obj = ResourceManager.GetObject("image_saturation", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -729,4 +729,7 @@ Distance: {6:0.00} px / Angle: {7:0.00}°</value>
<data name="ShapeManager_CreateToolbar_InterpolationMode" xml:space="preserve">
<value>Interpolation mode</value>
</data>
<data name="image_saturation" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\image-saturation.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -24,6 +24,7 @@
#endregion License Information (GPL v3)
using ShareX.HelpersLib;
using ShareX.ImageEffectsLib;
using System;
using System.Collections.Generic;
using System.Drawing;
@ -1697,6 +1698,29 @@ private void RotateImage(RotateFlipType type)
UpdateCanvas(img);
}
private void AddImageEffects()
{
Form.Pause();
using (ImageEffectsForm imageEffectsForm = new ImageEffectsForm(Form.Canvas, new List<ImageEffectPreset>() { new ImageEffectPreset() }, 0))
{
imageEffectsForm.ShowDialog(Form);
if (imageEffectsForm.Presets.IsValidIndex(imageEffectsForm.SelectedPresetIndex))
{
ImageEffectPreset preset = imageEffectsForm.Presets[imageEffectsForm.SelectedPresetIndex];
Image img = preset.ApplyEffects(Form.Canvas);
if (img != null)
{
UpdateCanvas(img);
}
}
}
Form.Resume();
}
private void OnCurrentShapeChanged(BaseShape shape)
{
if (CurrentShapeChanged != null)

View file

@ -711,6 +711,13 @@ internal void CreateToolbar()
tsmiFlipVertical.Click += (sender, e) => RotateImage(RotateFlipType.RotateNoneFlipY);
tsddbImage.DropDownItems.Add(tsmiFlipVertical);
tsddbImage.DropDownItems.Add(new ToolStripSeparator());
ToolStripMenuItem tsmiAddImageEffects = new ToolStripMenuItem("Add image effects...");
tsmiAddImageEffects.Image = Resources.image_saturation;
tsmiAddImageEffects.Click += (sender, e) => AddImageEffects();
tsddbImage.DropDownItems.Add(tsmiAddImageEffects);
#endregion
}

View file

@ -213,12 +213,17 @@
<Project>{327750E1-9FB7-4CC3-8AEA-9BC42180CAD3}</Project>
<Name>ShareX.HelpersLib</Name>
</ProjectReference>
<ProjectReference Include="..\ShareX.ImageEffectsLib\ShareX.ImageEffectsLib.csproj">
<Project>{d13441b6-96e1-4d1b-8a95-58a7d6cb1e24}</Project>
<Name>ShareX.ImageEffectsLib</Name>
</ProjectReference>
<ProjectReference Include="..\ShareX.MediaLib\ShareX.MediaLib.csproj">
<Project>{1a190e53-1419-4cc2-b0e5-3bc7ea861c8b}</Project>
<Name>ShareX.MediaLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Resources\image-saturation.png" />
<None Include="Resources\image-select.png" />
<None Include="Resources\image-empty.png" />
<None Include="Resources\image--plus.png" />