Reduced warnings by >500

This commit is contained in:
Robin Krom 2019-04-28 22:54:53 +02:00
commit 6bdcf35ce2
81 changed files with 1071 additions and 203 deletions

View file

@ -31,9 +31,12 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
/// </summary> /// </summary>
public class TargetAdorner : AbstractAdorner public class TargetAdorner : AbstractAdorner
{ {
public TargetAdorner(IDrawableContainer owner, NativePoint location) : base(owner) private readonly Color _color;
public TargetAdorner(IDrawableContainer owner, NativePoint location, Color color) : base(owner)
{ {
Location = location; Location = location;
_color = color;
} }
/// <summary> /// <summary>
@ -96,7 +99,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
var targetGraphics = paintEventArgs.Graphics; var targetGraphics = paintEventArgs.Graphics;
var bounds = Bounds; var bounds = Bounds;
targetGraphics.FillRectangle(Brushes.Green, bounds.X, bounds.Y, bounds.Width, bounds.Height); using (var brush = new SolidBrush(_color))
{
targetGraphics.FillRectangle(brush, bounds.X, bounds.Y, bounds.Width, bounds.Height);
}
} }
/// <summary> /// <summary>

View file

@ -110,26 +110,41 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
} }
} }
/// <summary>
/// The adorner for the target
/// </summary>
public TargetAdorner TargetAdorner public TargetAdorner TargetAdorner
{ {
get { return _targetAdorner; } get { return _targetAdorner; }
} }
/// <summary>
/// Specifies if this contain has a context menu
/// </summary>
public virtual bool HasContextMenu public virtual bool HasContextMenu
{ {
get { return true; } get { return true; }
} }
/// <summary>
/// Specifies if this container has a default size
/// </summary>
public virtual bool HasDefaultSize public virtual bool HasDefaultSize
{ {
get { return false; } get { return false; }
} }
/// <summary>
/// The default size
/// </summary>
public virtual Size DefaultSize public virtual Size DefaultSize
{ {
get { throw new NotSupportedException("Object doesn't have a default size"); } get { throw new NotSupportedException("Object doesn't have a default size"); }
} }
/// <summary>
/// This specifies the edit status
/// </summary>
public EditStatus DefaultEditMode public EditStatus DefaultEditMode
{ {
get { return _defaultEditMode; } get { return _defaultEditMode; }
@ -145,18 +160,27 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
/// <summary>
/// The property change event is triggered when a property is changed
/// </summary>
public event PropertyChangedEventHandler PropertyChanged public event PropertyChangedEventHandler PropertyChanged
{ {
add { _propertyChanged += value; } add { _propertyChanged += value; }
remove { _propertyChanged -= value; } remove { _propertyChanged -= value; }
} }
/// <summary>
/// The surface this container belongs to
/// </summary>
public ISurface Parent public ISurface Parent
{ {
get { return _parent; } get { return _parent; }
set { SwitchParent((Surface) value); } set { SwitchParent((Surface) value); }
} }
/// <summary>
/// Is this container selected?
/// </summary>
public bool Selected public bool Selected
{ {
get { return _selected; } get { return _selected; }
@ -493,6 +517,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
return (int) Math.Round(f); return (int) Math.Round(f);
} }
/// <summary>
/// This is called when the container is double clicked
/// </summary>
public virtual void OnDoubleClick() public virtual void OnDoubleClick()
{ {
} }
@ -502,7 +529,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
/// </summary> /// </summary>
protected void InitAdorner(Color gripperColor, NativePoint location) protected void InitAdorner(Color gripperColor, NativePoint location)
{ {
_targetAdorner = new TargetAdorner(this, location); // TODO: Pass the gripperColor to the target adorner
_targetAdorner = new TargetAdorner(this, location, gripperColor);
Adorners.Add(_targetAdorner); Adorners.Add(_targetAdorner);
} }
@ -584,7 +612,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
} }
public void ResizeTo(int width, int height, int anchorPosition) public void ResizeTo(int width, int height)
{ {
Width = width; Width = width;
Height = height; Height = height;
@ -674,7 +702,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
return (int) -Math.Round(radians * 180 / Math.PI); return (int) -Math.Round(radians * 180 / Math.PI);
} }
protected virtual ScaleHelper.IDoubleProcessor GetAngleRoundProcessor() protected virtual IDoubleProcessor GetAngleRoundProcessor()
{ {
return ScaleHelper.ShapeAngleRoundBehavior.Instance; return ScaleHelper.ShapeAngleRoundBehavior.Instance;
} }

View file

@ -36,11 +36,17 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
{ {
public static readonly int MAX_CLICK_DISTANCE_TOLERANCE = 10; public static readonly int MAX_CLICK_DISTANCE_TOLERANCE = 10;
/// <summary>
/// Constructor taking all dependencies
/// </summary>
/// <param name="parent">parent</param>
/// <param name="editorConfiguration">IEditorConfiguration</param>
public LineContainer(Surface parent, IEditorConfiguration editorConfiguration) : base(parent, editorConfiguration) public LineContainer(Surface parent, IEditorConfiguration editorConfiguration) : base(parent, editorConfiguration)
{ {
Init(); Init();
} }
/// <inheritdoc />
protected override void InitializeFields() protected override void InitializeFields()
{ {
AddField(GetType(), FieldTypes.LINE_THICKNESS, 2); AddField(GetType(), FieldTypes.LINE_THICKNESS, 2);
@ -48,17 +54,22 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
AddField(GetType(), FieldTypes.SHADOW, true); AddField(GetType(), FieldTypes.SHADOW, true);
} }
/// <inheritdoc />
protected override void OnDeserialized(StreamingContext context) protected override void OnDeserialized(StreamingContext context)
{ {
Init(); Init();
} }
/// <summary>
/// Initialize this container
/// </summary>
protected void Init() protected void Init()
{ {
Adorners.Add(new MoveAdorner(this, Positions.TopLeft)); Adorners.Add(new MoveAdorner(this, Positions.TopLeft));
Adorners.Add(new MoveAdorner(this, Positions.BottomRight)); Adorners.Add(new MoveAdorner(this, Positions.BottomRight));
} }
/// <inheritdoc />
public override void Draw(Graphics graphics, RenderMode rm) public override void Draw(Graphics graphics, RenderMode rm)
{ {
graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.SmoothingMode = SmoothingMode.HighQuality;
@ -90,7 +101,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
Top + currentStep + Height); Top + currentStep + Height);
currentStep++; currentStep++;
#pragma warning disable IDE0054 // Use compound assignment
alpha = alpha - basealpha / steps; alpha = alpha - basealpha / steps;
#pragma warning restore IDE0054 // Use compound assignment
} }
} }
} }
@ -102,6 +115,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
} }
} }
/// <inheritdoc />
public override bool ClickableAt(int x, int y) public override bool ClickableAt(int x, int y)
{ {
var lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS) + 5; var lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS) + 5;
@ -120,9 +134,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
return false; return false;
} }
protected override ScaleHelper.IDoubleProcessor GetAngleRoundProcessor() /// <inheritdoc />
protected override IDoubleProcessor GetAngleRoundProcessor()
{ {
return ScaleHelper.LineAngleRoundBehavior.Instance; return LineAngleRoundBehavior.Instance;
} }
} }
} }

View file

@ -34,6 +34,7 @@ namespace Greenshot.Addons
/// <inheritdoc /> /// <inheritdoc />
public class AddonsModule : AddonModule public class AddonsModule : AddonModule
{ {
/// <inheritdoc/>
protected override void Load(ContainerBuilder builder) protected override void Load(ContainerBuilder builder)
{ {
builder builder

View file

@ -185,7 +185,7 @@ namespace Greenshot.Addons.Animation
/// <summary> /// <summary>
/// Get the next animation frame value object /// Get the next animation frame value object
/// </summary> /// </summary>
/// <returns></returns> /// <returns>T</returns>
public abstract T Next(); public abstract T Next();
/// <summary> /// <summary>

View file

@ -26,15 +26,20 @@ namespace Greenshot.Addons.Animation
/// </summary> /// </summary>
public class ColorAnimator : AnimatorBase<Color> public class ColorAnimator : AnimatorBase<Color>
{ {
/// <summary>
/// Create a color animator
/// </summary>
/// <param name="first">Color to start with</param>
/// <param name="last">Color to end with</param>
/// <param name="frames">int amount of frames to animate</param>
/// <param name="easingType">EasingTypes, the easing type to use</param>
/// <param name="easingMode">EasingModes, the easing mode to use</param>
public ColorAnimator(Color first, Color last, int frames, EasingTypes easingType = EasingTypes.Linear, EasingModes easingMode = EasingModes.EaseIn) public ColorAnimator(Color first, Color last, int frames, EasingTypes easingType = EasingTypes.Linear, EasingModes easingMode = EasingModes.EaseIn)
: base(first, last, frames, easingType, easingMode) : base(first, last, frames, easingType, easingMode)
{ {
} }
/// <summary> /// <inheritdoc />
/// Calculate the next frame values
/// </summary>
/// <returns>Color</returns>
public override Color Next() public override Color Next()
{ {
if (!NextFrame) if (!NextFrame)

View file

@ -26,16 +26,31 @@ namespace Greenshot.Addons.Animation
/// </summary> /// </summary>
public static class EaseSine public static class EaseSine
{ {
/// <summary>
/// Calculate the ease in
/// </summary>
/// <param name="s">double</param>
/// <returns>double</returns>
public static double EaseIn(double s) public static double EaseIn(double s)
{ {
return Math.Sin(s * (Math.PI / 2) - Math.PI / 2) + 1; return Math.Sin(s * (Math.PI / 2) - Math.PI / 2) + 1;
} }
/// <summary>
/// Calculate the ease in out
/// </summary>
/// <param name="s">double</param>
/// <returns>double</returns>
public static double EaseInOut(double s) public static double EaseInOut(double s)
{ {
return Math.Sin(s * Math.PI - Math.PI / 2 + 1) / 2; return Math.Sin(s * Math.PI - Math.PI / 2 + 1) / 2;
} }
/// <summary>
/// Calculate the ease out
/// </summary>
/// <param name="s">double</param>
/// <returns>double</returns>
public static double EaseOut(double s) public static double EaseOut(double s)
{ {
return Math.Sin(s * (Math.PI / 2)); return Math.Sin(s * (Math.PI / 2));

View file

@ -24,8 +24,17 @@ namespace Greenshot.Addons.Animation
/// </summary> /// </summary>
public enum EasingModes public enum EasingModes
{ {
/// <summary>
/// Use ease in
/// </summary>
EaseIn, EaseIn,
/// <summary>
/// Use ease out
/// </summary>
EaseOut, EaseOut,
/// <summary>
/// Use ease in and out
/// </summary>
EaseInOut EaseInOut
} }
} }

View file

@ -24,12 +24,33 @@ namespace Greenshot.Addons.Animation
/// </summary> /// </summary>
public enum EasingTypes public enum EasingTypes
{ {
/// <summary>
/// Use easing with steps
/// </summary>
Step, Step,
/// <summary>
/// Use linear easing
/// </summary>
Linear, Linear,
/// <summary>
/// Use sine easing
/// </summary>
Sine, Sine,
/// <summary>
/// Use quadratic easing
/// </summary>
Quadratic, Quadratic,
/// <summary>
/// Use cubic easing
/// </summary>
Cubic, Cubic,
/// <summary>
/// Use quartic easing
/// </summary>
Quartic, Quartic,
/// <summary>
/// Use quintic easing
/// </summary>
Quintic Quintic
} }
} }

View file

@ -24,15 +24,20 @@ namespace Greenshot.Addons.Animation
/// </summary> /// </summary>
public class IntAnimator : AnimatorBase<int> public class IntAnimator : AnimatorBase<int>
{ {
/// <summary>
/// Create an int animator
/// </summary>
/// <param name="first">int to start with</param>
/// <param name="last">int to end with</param>
/// <param name="frames">int with the number of frames</param>
/// <param name="easingType">EasingTypes</param>
/// <param name="easingMode">EasingModes</param>
public IntAnimator(int first, int last, int frames, EasingTypes easingType = EasingTypes.Linear, EasingModes easingMode = EasingModes.EaseIn) public IntAnimator(int first, int last, int frames, EasingTypes easingType = EasingTypes.Linear, EasingModes easingMode = EasingModes.EaseIn)
: base(first, last, frames, easingType, easingMode) : base(first, last, frames, easingType, easingMode)
{ {
} }
/// <summary> /// <inheritdoc />
/// Calculate the next frame values
/// </summary>
/// <returns>int</returns>
public override int Next() public override int Next()
{ {
if (!NextFrame) if (!NextFrame)

View file

@ -31,10 +31,7 @@ namespace Greenshot.Addons.Animation
{ {
} }
/// <summary> /// <inheritdoc />
/// Calculate the next frame value
/// </summary>
/// <returns>NativePoint</returns>
public override NativePoint Next() public override NativePoint Next()
{ {
if (!NextFrame) if (!NextFrame)

View file

@ -31,10 +31,7 @@ namespace Greenshot.Addons.Animation
{ {
} }
/// <summary> /// <inheritdoc />
/// Calculate the next frame object
/// </summary>
/// <returns>NativeRect</returns>
public override NativeRect Next() public override NativeRect Next()
{ {
if (!NextFrame) if (!NextFrame)

View file

@ -31,10 +31,7 @@ namespace Greenshot.Addons.Animation
{ {
} }
/// <summary> /// <inheritdoc />
/// Calculate the next frame values
/// </summary>
/// <returns>NativeSize</returns>
public override NativeSize Next() public override NativeSize Next()
{ {
if (!NextFrame) if (!NextFrame)

View file

@ -22,10 +22,16 @@ using System.ComponentModel.Composition;
namespace Greenshot.Addons.Components namespace Greenshot.Addons.Components
{ {
/// <summary>
/// This attribute is used on a destination
/// </summary>
[MetadataAttribute] [MetadataAttribute]
[AttributeUsage(AttributeTargets.Class, Inherited = false)] [AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class DestinationAttribute : Attribute public class DestinationAttribute : Attribute
{ {
/// <summary>
/// This is needed to make sure the values do not need to be specified
/// </summary>
public DestinationAttribute() public DestinationAttribute()
{ {
@ -55,7 +61,10 @@ namespace Greenshot.Addons.Components
} }
} }
/// <inheritdoc />
public string Designation { get; set; } public string Designation { get; set; }
/// <inheritdoc />
public int Priority { get; set; } = 10; public int Priority { get; set; } = 10;
} }
} }

View file

@ -19,18 +19,54 @@
namespace Greenshot.Addons.Components namespace Greenshot.Addons.Components
{ {
/// <summary>
/// This is used to order the destinations
/// </summary>
public enum DestinationOrder public enum DestinationOrder
{ {
/// <summary>
/// Order for the File without a dialog destination
/// </summary>
FileNoDialog = 0, FileNoDialog = 0,
/// <summary>
/// Order for the file with dialog destination
/// </summary>
FileDialog = 0, FileDialog = 0,
/// <summary>
/// Order for the picker destination
/// </summary>
Picker = 1, Picker = 1,
/// <summary>
/// Order for the Printer destination
/// </summary>
Printer = 2, Printer = 2,
/// <summary>
/// Order for the Clipboard destination
/// </summary>
Clipboard = 2, Clipboard = 2,
/// <summary>
/// Order for the Email destination
/// </summary>
Email = 3, Email = 3,
/// <summary>
/// Order for the Outlook destination
/// </summary>
Outlook = 3, Outlook = 3,
/// <summary>
/// Order for the Word destination
/// </summary>
Word = 4, Word = 4,
/// <summary>
/// Order for the PowerPoint destination
/// </summary>
Powerpoint = 4, Powerpoint = 4,
/// <summary>
/// Order for the OneNote destination
/// </summary>
OneNote = 4, OneNote = 4,
/// <summary>
/// Order for the Excel destination
/// </summary>
Excel = 5, Excel = 5,
} }

View file

@ -38,6 +38,12 @@ namespace Greenshot.Addons.Components
private readonly IEventAggregator _eventAggregator; private readonly IEventAggregator _eventAggregator;
private readonly Func<IDestination, ExportInformation, ISurface, IConfigScreen, Owned<ExportNotificationViewModel>> _toastFactory; private readonly Func<IDestination, ExportInformation, ISurface, IConfigScreen, Owned<ExportNotificationViewModel>> _toastFactory;
/// <summary>
/// DI Constructor
/// </summary>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="eventAggregator">IEventAggregator</param>
/// <param name="toastFactory">Func to create toasts</param>
public ExportNotification( public ExportNotification(
ICoreConfiguration coreConfiguration, ICoreConfiguration coreConfiguration,
IEventAggregator eventAggregator, IEventAggregator eventAggregator,

View file

@ -27,6 +27,10 @@ namespace Greenshot.Addons.Components
/// </summary> /// </summary>
public interface IDestinationProvider public interface IDestinationProvider
{ {
/// <summary>
/// Provide destinations
/// </summary>
/// <returns>IEnumerable with lazy IDestinations</returns>
IEnumerable<Lazy<IDestination, DestinationAttribute>> Provide(); IEnumerable<Lazy<IDestination, DestinationAttribute>> Provide();
} }
} }

View file

@ -30,111 +30,303 @@ using Greenshot.Core.Enums;
namespace Greenshot.Addons.Config.Impl namespace Greenshot.Addons.Config.Impl
{ {
/// <summary>
/// Implementation of the ICoreConfiguration
/// </summary>
public class CoreConfigurationImpl : IniSectionBase<ICoreConfiguration>, ICoreConfiguration public class CoreConfigurationImpl : IniSectionBase<ICoreConfiguration>, ICoreConfiguration
{ {
/// <inheritdoc />
public override void AfterLoad() public override void AfterLoad()
{ {
CoreConfigurationExtensions.AfterLoad(this); CoreConfigurationExtensions.AfterLoad(this);
} }
/// <inheritdoc />
public string OutputFilePath { get; set; } public string OutputFilePath { get; set; }
/// <inheritdoc />
public bool OutputFileAllowOverwrite { get; set; } public bool OutputFileAllowOverwrite { get; set; }
/// <inheritdoc />
public string OutputFileFilenamePattern { get; set; } public string OutputFileFilenamePattern { get; set; }
/// <inheritdoc />
public OutputFormats OutputFileFormat { get; set; } public OutputFormats OutputFileFormat { get; set; }
/// <inheritdoc />
public bool OutputFileReduceColors { get; set; } public bool OutputFileReduceColors { get; set; }
/// <inheritdoc />
public bool OutputFileAutoReduceColors { get; set; } public bool OutputFileAutoReduceColors { get; set; }
/// <inheritdoc />
public int OutputFileReduceColorsTo { get; set; } public int OutputFileReduceColorsTo { get; set; }
/// <inheritdoc />
public int OutputFileJpegQuality { get; set; } public int OutputFileJpegQuality { get; set; }
/// <inheritdoc />
public bool OutputFilePromptQuality { get; set; } public bool OutputFilePromptQuality { get; set; }
/// <inheritdoc />
public uint OutputFileIncrementingNumber { get; set; } public uint OutputFileIncrementingNumber { get; set; }
/// <inheritdoc />
public string OptimizePNGCommand { get; set; } public string OptimizePNGCommand { get; set; }
/// <inheritdoc />
public string OptimizePNGCommandArguments { get; set; } public string OptimizePNGCommandArguments { get; set; }
/// <inheritdoc />
public NativeSize Win10BorderCrop { get; set; } public NativeSize Win10BorderCrop { get; set; }
/// <inheritdoc />
public bool CaptureMousepointer { get; set; } public bool CaptureMousepointer { get; set; }
/// <inheritdoc />
public bool CaptureWindowsInteractive { get; set; } public bool CaptureWindowsInteractive { get; set; }
/// <inheritdoc />
public int CaptureDelay { get; set; } public int CaptureDelay { get; set; }
/// <inheritdoc />
public ScreenCaptureMode ScreenCaptureMode { get; set; } public ScreenCaptureMode ScreenCaptureMode { get; set; }
/// <inheritdoc />
public int ScreenToCapture { get; set; } public int ScreenToCapture { get; set; }
/// <inheritdoc />
public WindowCaptureModes WindowCaptureMode { get; set; } public WindowCaptureModes WindowCaptureMode { get; set; }
/// <inheritdoc />
public Color DWMBackgroundColor { get; set; } public Color DWMBackgroundColor { get; set; }
/// <inheritdoc />
public IList<string> NoGDICaptureForProduct { get; set; } public IList<string> NoGDICaptureForProduct { get; set; }
/// <inheritdoc />
public IList<string> NoDWMCaptureForProduct { get; set; } public IList<string> NoDWMCaptureForProduct { get; set; }
/// <inheritdoc />
public bool WindowCaptureRemoveCorners { get; set; } public bool WindowCaptureRemoveCorners { get; set; }
/// <inheritdoc />
public IList<int> WindowCornerCutShape { get; set; } public IList<int> WindowCornerCutShape { get; set; }
/// <inheritdoc />
public string Language { get; set; } public string Language { get; set; }
/// <inheritdoc />
public string RegionHotkey { get; set; } public string RegionHotkey { get; set; }
/// <inheritdoc />
public string WindowHotkey { get; set; } public string WindowHotkey { get; set; }
/// <inheritdoc />
public string FullscreenHotkey { get; set; } public string FullscreenHotkey { get; set; }
/// <inheritdoc />
public string LastregionHotkey { get; set; } public string LastregionHotkey { get; set; }
/// <inheritdoc />
public string IEHotkey { get; set; } public string IEHotkey { get; set; }
/// <inheritdoc />
public bool IsFirstLaunch { get; set; } public bool IsFirstLaunch { get; set; }
/// <inheritdoc />
public IList<string> OutputDestinations { get; set; } public IList<string> OutputDestinations { get; set; }
/// <inheritdoc />
public IList<string> PickerDestinations { get; set; } public IList<string> PickerDestinations { get; set; }
/// <inheritdoc />
public IList<ClipboardFormats> ClipboardFormats { get; set; } public IList<ClipboardFormats> ClipboardFormats { get; set; }
/// <inheritdoc />
public bool WindowCaptureAllChildLocations { get; set; } public bool WindowCaptureAllChildLocations { get; set; }
/// <inheritdoc />
public bool PlayCameraSound { get; set; } public bool PlayCameraSound { get; set; }
/// <inheritdoc />
public bool ShowTrayNotification { get; set; } public bool ShowTrayNotification { get; set; }
/// <inheritdoc />
public bool OutputFileCopyPathToClipboard { get; set; } public bool OutputFileCopyPathToClipboard { get; set; }
/// <inheritdoc />
public string OutputFileAsFullpath { get; set; } public string OutputFileAsFullpath { get; set; }
/// <inheritdoc />
public bool OutputPrintPromptOptions { get; set; } public bool OutputPrintPromptOptions { get; set; }
/// <inheritdoc />
public bool OutputPrintAllowRotate { get; set; } public bool OutputPrintAllowRotate { get; set; }
/// <inheritdoc />
public bool OutputPrintAllowEnlarge { get; set; } public bool OutputPrintAllowEnlarge { get; set; }
/// <inheritdoc />
public bool OutputPrintAllowShrink { get; set; } public bool OutputPrintAllowShrink { get; set; }
/// <inheritdoc />
public bool OutputPrintCenter { get; set; } public bool OutputPrintCenter { get; set; }
/// <inheritdoc />
public bool OutputPrintInverted { get; set; } public bool OutputPrintInverted { get; set; }
/// <inheritdoc />
public bool OutputPrintGrayscale { get; set; } public bool OutputPrintGrayscale { get; set; }
/// <inheritdoc />
public bool OutputPrintMonochrome { get; set; } public bool OutputPrintMonochrome { get; set; }
/// <inheritdoc />
public byte OutputPrintMonochromeThreshold { get; set; } public byte OutputPrintMonochromeThreshold { get; set; }
/// <inheritdoc />
public bool OutputPrintFooter { get; set; } public bool OutputPrintFooter { get; set; }
/// <inheritdoc />
public string OutputPrintFooterPattern { get; set; } public string OutputPrintFooterPattern { get; set; }
/// <inheritdoc />
public string NotificationSound { get; set; } public string NotificationSound { get; set; }
/// <inheritdoc />
public bool UseProxy { get; set; } public bool UseProxy { get; set; }
/// <inheritdoc />
public bool IECapture { get; set; } public bool IECapture { get; set; }
/// <inheritdoc />
public bool IEFieldCapture { get; set; } public bool IEFieldCapture { get; set; }
/// <inheritdoc />
public IList<string> WindowClassesToCheckForIE { get; set; } public IList<string> WindowClassesToCheckForIE { get; set; }
/// <inheritdoc />
public int AutoCropDifference { get; set; } public int AutoCropDifference { get; set; }
/// <inheritdoc />
public IList<string> IncludePlugins { get; set; } public IList<string> IncludePlugins { get; set; }
/// <inheritdoc />
public IList<string> ExcludePlugins { get; set; } public IList<string> ExcludePlugins { get; set; }
/// <inheritdoc />
public IList<string> ExcludeDestinations { get; set; } public IList<string> ExcludeDestinations { get; set; }
/// <inheritdoc />
public bool CheckForUpdates { get; set; } public bool CheckForUpdates { get; set; }
/// <inheritdoc />
public int UpdateCheckInterval { get; set; } public int UpdateCheckInterval { get; set; }
/// <inheritdoc />
public DateTime LastUpdateCheck { get; set; } public DateTime LastUpdateCheck { get; set; }
/// <inheritdoc />
public bool DisableSettings { get; set; } public bool DisableSettings { get; set; }
/// <inheritdoc />
public bool DisableQuickSettings { get; set; } public bool DisableQuickSettings { get; set; }
/// <inheritdoc />
public bool HideTrayicon { get; set; } public bool HideTrayicon { get; set; }
/// <inheritdoc />
public bool HideExpertSettings { get; set; } public bool HideExpertSettings { get; set; }
/// <inheritdoc />
public bool ThumnailPreview { get; set; } public bool ThumnailPreview { get; set; }
/// <inheritdoc />
public bool OptimizeForRDP { get; set; } public bool OptimizeForRDP { get; set; }
/// <inheritdoc />
public bool DisableRDPOptimizing { get; set; } public bool DisableRDPOptimizing { get; set; }
/// <inheritdoc />
public bool MinimizeWorkingSetSize { get; set; } public bool MinimizeWorkingSetSize { get; set; }
/// <inheritdoc />
public bool CheckForUnstable { get; set; } public bool CheckForUnstable { get; set; }
/// <inheritdoc />
public IList<string> ActiveTitleFixes { get; set; } public IList<string> ActiveTitleFixes { get; set; }
/// <inheritdoc />
public IDictionary<string, string> TitleFixMatcher { get; set; } public IDictionary<string, string> TitleFixMatcher { get; set; }
/// <inheritdoc />
public IDictionary<string, string> TitleFixReplacer { get; set; } public IDictionary<string, string> TitleFixReplacer { get; set; }
/// <inheritdoc />
public IList<string> ExperimentalFeatures { get; set; } public IList<string> ExperimentalFeatures { get; set; }
/// <inheritdoc />
public bool EnableSpecialDIBClipboardReader { get; set; } public bool EnableSpecialDIBClipboardReader { get; set; }
/// <inheritdoc />
public ClickActions LeftClickAction { get; set; } public ClickActions LeftClickAction { get; set; }
/// <inheritdoc />
public ClickActions DoubleClickAction { get; set; } public ClickActions DoubleClickAction { get; set; }
/// <inheritdoc />
public bool ZoomerEnabled { get; set; } public bool ZoomerEnabled { get; set; }
/// <inheritdoc />
public float ZoomerOpacity { get; set; } public float ZoomerOpacity { get; set; }
/// <inheritdoc />
public int MaxMenuItemLength { get; set; } public int MaxMenuItemLength { get; set; }
/// <inheritdoc />
public string MailApiTo { get; set; } public string MailApiTo { get; set; }
/// <inheritdoc />
public string MailApiCC { get; set; } public string MailApiCC { get; set; }
/// <inheritdoc />
public string MailApiBCC { get; set; } public string MailApiBCC { get; set; }
/// <inheritdoc />
public string LastSaveWithVersion { get; set; } public string LastSaveWithVersion { get; set; }
/// <inheritdoc />
public bool ProcessEXIFOrientation { get; set; } public bool ProcessEXIFOrientation { get; set; }
/// <inheritdoc />
public NativeRect LastCapturedRegion { get; set; } public NativeRect LastCapturedRegion { get; set; }
/// <inheritdoc />
public NativeSize IconSize { get; set; } public NativeSize IconSize { get; set; }
/// <inheritdoc />
public int WebRequestTimeout { get; set; } public int WebRequestTimeout { get; set; }
/// <inheritdoc />
public int WebRequestReadWriteTimeout { get; set; } public int WebRequestReadWriteTimeout { get; set; }
/// <inheritdoc />
public bool IsScrollingCaptureEnabled { get; set; } public bool IsScrollingCaptureEnabled { get; set; }
/// <inheritdoc />
public bool IsPortable { get; set; } public bool IsPortable { get; set; }
/// <inheritdoc />
public ISet<string> Permissions { get; set; } public ISet<string> Permissions { get; set; }
/// <inheritdoc />
public WindowStartupLocation DefaultWindowStartupLocation { get; set; } public WindowStartupLocation DefaultWindowStartupLocation { get; set; }
/// <inheritdoc />
public bool AreWindowLocationsStored { get; set; } public bool AreWindowLocationsStored { get; set; }
/// <inheritdoc />
public IDictionary<string, WindowPlacement> WindowLocations { get; set; } public IDictionary<string, WindowPlacement> WindowLocations { get; set; }
} }
} }

View file

@ -33,6 +33,9 @@ namespace Greenshot.Addons.Controls
/// </summary> /// </summary>
public class AnimatingForm : GreenshotForm public class AnimatingForm : GreenshotForm
{ {
/// <summary>
/// The ICoreConfiguration which can be used in all derived forms
/// </summary>
protected readonly ICoreConfiguration _coreConfiguration; protected readonly ICoreConfiguration _coreConfiguration;
private const int DefaultVerticalRefresh = 60; private const int DefaultVerticalRefresh = 60;
private static readonly LogSource Log = new LogSource(); private static readonly LogSource Log = new LogSource();

View file

@ -26,12 +26,17 @@ using Greenshot.Addons.Resources;
namespace Greenshot.Addons.Controls namespace Greenshot.Addons.Controls
{ {
/// <summary> /// <summary>
/// Description of PleaseWaitForm. /// This form is used to show in the background
/// </summary> /// </summary>
public sealed partial class BackgroundForm : Form public sealed partial class BackgroundForm : Form
{ {
private volatile bool _shouldClose; private volatile bool _shouldClose;
/// <summary>
/// Constructor for the form
/// </summary>
/// <param name="title">string</param>
/// <param name="text">string</param>
public BackgroundForm(string title, string text) public BackgroundForm(string title, string text)
{ {
// //
@ -51,6 +56,12 @@ namespace Greenshot.Addons.Controls
ShowDialog(); ShowDialog();
} }
/// <summary>
/// Show this form an wait
/// </summary>
/// <param name="title">string</param>
/// <param name="text">string</param>
/// <returns>BackgroundForm</returns>
public static BackgroundForm ShowAndWait(string title, string text) public static BackgroundForm ShowAndWait(string title, string text)
{ {
var backgroundForm = new BackgroundForm(title, text); var backgroundForm = new BackgroundForm(title, text);
@ -63,7 +74,9 @@ namespace Greenshot.Addons.Controls
return backgroundForm; return backgroundForm;
} }
// Can be used instead of ShowDialog /// <summary>
/// Can be used instead of ShowDialog
/// </summary>
public new void Show() public new void Show()
{ {
base.Show(); base.Show();
@ -100,6 +113,9 @@ namespace Greenshot.Addons.Controls
} }
} }
/// <summary>
/// Close the form
/// </summary>
public void CloseDialog() public void CloseDialog()
{ {
_shouldClose = true; _shouldClose = true;

View file

@ -26,6 +26,7 @@ namespace Greenshot.Addons.Controls
/// </summary> /// </summary>
public class FormWithoutActivation : Form public class FormWithoutActivation : Form
{ {
/// <inheritdoc />
protected override bool ShowWithoutActivation protected override bool ShowWithoutActivation
{ {
get { return true; } get { return true; }

View file

@ -22,8 +22,14 @@ using System.Windows.Forms;
namespace Greenshot.Addons.Controls namespace Greenshot.Addons.Controls
{ {
/// <summary>
/// This is a button which takes it translation via the set language key
/// </summary>
public class GreenshotButton : Button, IGreenshotLanguageBindable public class GreenshotButton : Button, IGreenshotLanguageBindable
{ {
/// <summary>
/// The key for the translation to use
/// </summary>
[Category("Greenshot")] [Category("Greenshot")]
[DefaultValue(null)] [DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")] [Description("Specifies key of the language file to use when displaying the text.")]

View file

@ -27,16 +27,25 @@ namespace Greenshot.Addons.Controls
/// </summary> /// </summary>
public class GreenshotCheckBox : CheckBox, IGreenshotLanguageBindable, IGreenshotConfigBindable public class GreenshotCheckBox : CheckBox, IGreenshotLanguageBindable, IGreenshotConfigBindable
{ {
/// <summary>
/// Name of the section to use for the checkbox value
/// </summary>
[Category("Greenshot")] [Category("Greenshot")]
[DefaultValue("Core")] [DefaultValue("Core")]
[Description("Specifies the Ini-Section to map this control with.")] [Description("Specifies the Ini-Section to map this control with.")]
public string SectionName { get; set; } = "Core"; public string SectionName { get; set; } = "Core";
/// <summary>
/// Name of the propety to use for the checkbox value
/// </summary>
[Category("Greenshot")] [Category("Greenshot")]
[DefaultValue(null)] [DefaultValue(null)]
[Description("Specifies the property name to map the configuration.")] [Description("Specifies the property name to map the configuration.")]
public string PropertyName { get; set; } public string PropertyName { get; set; }
/// <summary>
/// Key for the translation of the label belonging to the checkbox
/// </summary>
[Category("Greenshot")] [Category("Greenshot")]
[DefaultValue(null)] [DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")] [Description("Specifies key of the language file to use when displaying the text.")]

View file

@ -25,6 +25,9 @@ using Dapplo.Config.Language;
namespace Greenshot.Addons.Controls namespace Greenshot.Addons.Controls
{ {
/// <summary>
/// A special combox box which can show a list of translated enum values
/// </summary>
public class GreenshotComboBox : ComboBox, IGreenshotConfigBindable public class GreenshotComboBox : ComboBox, IGreenshotConfigBindable
{ {
private readonly ILanguage _language; private readonly ILanguage _language;
@ -104,7 +107,6 @@ namespace Greenshot.Addons.Controls
/// </summary> /// </summary>
private void StoreSelectedEnum() private void StoreSelectedEnum()
{ {
var enumTypeName = _enumType.Name;
var selectedValue = SelectedItem as string; var selectedValue = SelectedItem as string;
var availableValues = Enum.GetValues(_enumType); var availableValues = Enum.GetValues(_enumType);
object returnValue = null; object returnValue = null;

View file

@ -45,6 +45,9 @@ namespace Greenshot.Addons.Controls
private static readonly IDictionary<Type, FieldInfo[]> ReflectionCache = new Dictionary<Type, FieldInfo[]>(); private static readonly IDictionary<Type, FieldInfo[]> ReflectionCache = new Dictionary<Type, FieldInfo[]>();
private readonly ILanguage _language; private readonly ILanguage _language;
/// <summary>
/// This is the bitmap scale handler
/// </summary>
protected readonly BitmapScaleHandler<string, IBitmapWithNativeSupport> ScaleHandler; protected readonly BitmapScaleHandler<string, IBitmapWithNativeSupport> ScaleHandler;
#if DEBUG #if DEBUG
@ -63,8 +66,14 @@ namespace Greenshot.Addons.Controls
ScaleHandler = BitmapScaleHandler.Create<string, IBitmapWithNativeSupport>(FormDpiHandler, (imageName, dpi) => GreenshotResources.Instance.GetBitmap(imageName, GetType()), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi)); ScaleHandler = BitmapScaleHandler.Create<string, IBitmapWithNativeSupport>(FormDpiHandler, (imageName, dpi) => GreenshotResources.Instance.GetBitmap(imageName, GetType()), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi));
} }
/// <summary>
/// manually apply the language
/// </summary>
protected bool ManualLanguageApply { get; set; } protected bool ManualLanguageApply { get; set; }
/// <summary>
/// Manually apply the field values
/// </summary>
protected bool ManualStoreFields { get; set; } protected bool ManualStoreFields { get; set; }
/// <summary> /// <summary>
@ -72,11 +81,15 @@ namespace Greenshot.Addons.Controls
/// </summary> /// </summary>
protected bool ToFront { get; set; } protected bool ToFront { get; set; }
/// <summary>
/// The kex for the translation
/// </summary>
[Category("Greenshot")] [Category("Greenshot")]
[DefaultValue(null)] [DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")] [Description("Specifies key of the language file to use when displaying the text.")]
public string LanguageKey { get; set; } public string LanguageKey { get; set; }
/// <inheritdoc />
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)
{ {
// Every GreenshotForm should have it's default icon // Every GreenshotForm should have it's default icon
@ -383,6 +396,9 @@ namespace Greenshot.Addons.Controls
OnFieldsFilled(); OnFieldsFilled();
} }
/// <summary>
/// This is called when the fields are filled
/// </summary>
protected virtual void OnFieldsFilled() protected virtual void OnFieldsFilled()
{ {
} }

View file

@ -22,8 +22,14 @@ using System.Windows.Forms;
namespace Greenshot.Addons.Controls namespace Greenshot.Addons.Controls
{ {
/// <summary>
/// This is a group box where you can specify the key for the translation
/// </summary>
public class GreenshotGroupBox : GroupBox, IGreenshotLanguageBindable public class GreenshotGroupBox : GroupBox, IGreenshotLanguageBindable
{ {
/// <summary>
/// Key for the translation
/// </summary>
[Category("Greenshot")] [Category("Greenshot")]
[DefaultValue(null)] [DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")] [Description("Specifies key of the language file to use when displaying the text.")]

View file

@ -42,6 +42,10 @@ namespace Greenshot.Addons.Controls
private readonly CancellationTokenSource _cancellationTokenSource; private readonly CancellationTokenSource _cancellationTokenSource;
private Thread _waitFor; private Thread _waitFor;
/// <summary>
/// DI Constructor
/// </summary>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
public PleaseWaitForm(IGreenshotLanguage greenshotLanguage) public PleaseWaitForm(IGreenshotLanguage greenshotLanguage)
{ {
_greenshotLanguage = greenshotLanguage; _greenshotLanguage = greenshotLanguage;
@ -52,11 +56,17 @@ namespace Greenshot.Addons.Controls
Icon = GreenshotResources.Instance.GetGreenshotIcon(); Icon = GreenshotResources.Instance.GetGreenshotIcon();
} }
/// <summary>
/// DI Constructor
/// </summary>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="cancellationTokenSource">CancellationTokenSource</param>
public PleaseWaitForm(IGreenshotLanguage greenshotLanguage, CancellationTokenSource cancellationTokenSource = default) : this(greenshotLanguage) public PleaseWaitForm(IGreenshotLanguage greenshotLanguage, CancellationTokenSource cancellationTokenSource = default) : this(greenshotLanguage)
{ {
_cancellationTokenSource = cancellationTokenSource; _cancellationTokenSource = cancellationTokenSource;
} }
/// <inheritdoc/>
protected override CreateParams CreateParams protected override CreateParams CreateParams
{ {
get get

View file

@ -32,6 +32,11 @@ namespace Greenshot.Addons.Controls
{ {
private readonly Type _resourceType; private readonly Type _resourceType;
private readonly List<IBitmapWithNativeSupport> _images = new List<IBitmapWithNativeSupport>(); private readonly List<IBitmapWithNativeSupport> _images = new List<IBitmapWithNativeSupport>();
/// <summary>
/// A constructor where one specifies the type which contains the resources
/// </summary>
/// <param name="resourceType">Type</param>
public ResourceImageManager(Type resourceType) public ResourceImageManager(Type resourceType)
{ {
_resourceType = resourceType; _resourceType = resourceType;
@ -63,11 +68,15 @@ namespace Greenshot.Addons.Controls
} }
} }
/// <inheritdoc />
public void Dispose() public void Dispose()
{ {
ReleaseUnmanagedResources(); ReleaseUnmanagedResources();
} }
/// <summary>
/// Destructor
/// </summary>
~ResourceImageManager() ~ResourceImageManager()
{ {
ReleaseUnmanagedResources(); ReleaseUnmanagedResources();

View file

@ -38,8 +38,13 @@ namespace Greenshot.Addons.Controls
private readonly ICaptureDetails _captureDetails; private readonly ICaptureDetails _captureDetails;
private DirectoryInfo _eagerlyCreatedDirectory; private DirectoryInfo _eagerlyCreatedDirectory;
private FilterOption[] _filterOptions; private FilterOption[] _filterOptions;
protected SaveFileDialog SaveFileDialog; private SaveFileDialog SaveFileDialog;
/// <summary>
/// DI Constructor
/// </summary>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="captureDetails">ICaptureDetails</param>
public SaveImageFileDialog(ICoreConfiguration coreConfiguration, ICaptureDetails captureDetails = null) public SaveImageFileDialog(ICoreConfiguration coreConfiguration, ICaptureDetails captureDetails = null)
{ {
_coreConfiguration = coreConfiguration; _coreConfiguration = coreConfiguration;
@ -108,11 +113,13 @@ namespace Greenshot.Addons.Controls
} }
} }
/// <inheritdoc />
public void Dispose() public void Dispose()
{ {
Dispose(true); Dispose(true);
} }
/// <inheritdoc />
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
if (disposing) if (disposing)
@ -196,6 +203,10 @@ namespace Greenshot.Addons.Controls
} }
} }
/// <summary>
/// Show the save file dialog
/// </summary>
/// <returns></returns>
public DialogResult ShowDialog() public DialogResult ShowDialog()
{ {
var ret = SaveFileDialog.ShowDialog(); var ret = SaveFileDialog.ShowDialog();

View file

@ -26,6 +26,7 @@ namespace Greenshot.Addons.Core.Credentials
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/dpapiusercredentials.asp /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/dpapiusercredentials.asp
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/creduipromptforcredentials.asp /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/creduipromptforcredentials.asp
/// </summary> /// </summary>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
[Flags] [Flags]
public enum CredFlags public enum CredFlags
{ {

View file

@ -19,6 +19,10 @@
namespace Greenshot.Addons.Core.Enums namespace Greenshot.Addons.Core.Enums
{ {
/// <summary>
/// Specify what action a click resolves to
/// </summary>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public enum ClickActions public enum ClickActions
{ {
DO_NOTHING, DO_NOTHING,

View file

@ -19,6 +19,10 @@
namespace Greenshot.Addons.Core.Enums namespace Greenshot.Addons.Core.Enums
{ {
/// <summary>
/// Specify the formats of the clipboard
/// </summary>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public enum ClipboardFormats public enum ClipboardFormats
{ {
NONE, NONE,

View file

@ -19,6 +19,10 @@
namespace Greenshot.Addons.Core.Enums namespace Greenshot.Addons.Core.Enums
{ {
/// <summary>
/// This is used to specify where configuration viewmodels are located
/// </summary>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public enum ConfigIds public enum ConfigIds
{ {
Ui, Ui,

View file

@ -34,6 +34,7 @@ namespace Greenshot.Addons.Core
/// </summary> /// </summary>
[IniSection("Core")] [IniSection("Core")]
[Description("Greenshot core configuration")] [Description("Greenshot core configuration")]
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public interface ICoreConfiguration : IIniSection, IFileConfiguration, ICaptureConfiguration, IUiConfiguration public interface ICoreConfiguration : IIniSection, IFileConfiguration, ICaptureConfiguration, IUiConfiguration
{ {
[Description("The language in IETF format (e.g. en-US)")] [Description("The language in IETF format (e.g. en-US)")]

View file

@ -25,6 +25,7 @@ namespace Greenshot.Addons.Core
/// <summary> /// <summary>
/// File configuration. /// File configuration.
/// </summary> /// </summary>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public interface IFileConfiguration public interface IFileConfiguration
{ {
[Description("Output file path.")] [Description("Output file path.")]

View file

@ -22,9 +22,13 @@ using Dapplo.Config.Language;
namespace Greenshot.Addons namespace Greenshot.Addons
{ {
/// <summary>
/// This specifies many translations
/// </summary>
[Language("Core")] [Language("Core")]
public interface IGreenshotLanguage : ILanguage, Dapplo.CaliburnMicro.Translations.ICoreTranslations public interface IGreenshotLanguage : ILanguage, Dapplo.CaliburnMicro.Translations.ICoreTranslations
{ {
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
string None { get; } string None { get; }
string AboutBugs { get; } string AboutBugs { get; }
string AboutDonations { get; } string AboutDonations { get; }

View file

@ -22,6 +22,7 @@ namespace Greenshot.Addons.Interfaces
/// <summary> /// <summary>
/// The capture mode for Greenshot /// The capture mode for Greenshot
/// </summary> /// </summary>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public enum CaptureMode public enum CaptureMode
{ {
None, None,

View file

@ -19,6 +19,10 @@
namespace Greenshot.Addons.Interfaces namespace Greenshot.Addons.Interfaces
{ {
/// <summary>
/// What are we drawing?
/// </summary>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public enum DrawingModes public enum DrawingModes
{ {
None, None,

View file

@ -6,6 +6,10 @@ using Greenshot.Core.Enums;
namespace Greenshot.Core.Configuration namespace Greenshot.Core.Configuration
{ {
/// <summary>
/// The configuration for capturing
/// </summary>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public interface ICaptureConfiguration public interface ICaptureConfiguration
{ {
[Description("The capture is cropped with these settings, e.g. when you don't want to color around it -1,-1")] [Description("The capture is cropped with these settings, e.g. when you don't want to color around it -1,-1")]

View file

@ -20,17 +20,41 @@
namespace Greenshot.Core.Enums namespace Greenshot.Core.Enums
{ {
/// <summary> /// <summary>
/// This is used to specified what type of capture /// This is used to specified what type elements in an capture are
/// </summary> /// </summary>
public enum CaptureElementType public enum CaptureElementType
{ {
/// <summary>
/// Not specified
/// </summary>
Unknown, Unknown,
/// <summary>
/// Screen
/// </summary>
Screen, Screen,
/// <summary>
/// Mouse
/// </summary>
Mouse, Mouse,
/// <summary>
/// Cursor
/// </summary>
Cursor, Cursor,
/// <summary>
/// Icon
/// </summary>
Icon, Icon,
/// <summary>
/// Popup
/// </summary>
Popup, Popup,
/// <summary>
/// Window
/// </summary>
Window, Window,
/// <summary>
/// File
/// </summary>
File File
} }
} }

View file

@ -19,14 +19,38 @@
namespace Greenshot.Core.Enums namespace Greenshot.Core.Enums
{ {
/// <summary>
/// The output formats we support
/// </summary>
public enum OutputFormats public enum OutputFormats
{ {
/// <summary>
/// Specify bmp to write bitmap files
/// </summary>
bmp, bmp,
/// <summary>
/// Specify gif to write gif files
/// </summary>
gif, gif,
/// <summary>
/// Specify jpg to write bitjpgmap files
/// </summary>
jpg, jpg,
/// <summary>
/// Specify png to write png files
/// </summary>
png, png,
/// <summary>
/// Specify tiff to write tiff files
/// </summary>
tiff, tiff,
/// <summary>
/// Specify greenshot to write greenshot files with annotations and a PNG bitmap
/// </summary>
greenshot, greenshot,
/// <summary>
/// Specify ico to write icon files
/// </summary>
ico ico
} }
} }

View file

@ -19,10 +19,22 @@
namespace Greenshot.Core.Enums namespace Greenshot.Core.Enums
{ {
/// <summary>
/// These are the different screen capture modus
/// </summary>
public enum ScreenCaptureMode public enum ScreenCaptureMode
{ {
/// <summary>
/// Automatically select the mode
/// </summary>
Auto, Auto,
/// <summary>
/// Capture the whole screen
/// </summary>
FullScreen, FullScreen,
/// <summary>
/// Specify the screen to capture
/// </summary>
Fixed Fixed
} }
} }

View file

@ -19,12 +19,32 @@
namespace Greenshot.Core.Enums namespace Greenshot.Core.Enums
{ {
/// <summary>
/// These are the possible ways to capture a window
/// </summary>
public enum WindowCaptureModes public enum WindowCaptureModes
{ {
/// <summary>
/// USe the screen
/// </summary>
Screen, Screen,
/// <summary>
/// Use GDI "print"
/// </summary>
Gdi, Gdi,
/// <summary>
/// Use Aero to clone the window and the screen to capture.
/// This mode will remove transparency
/// </summary>
Aero, Aero,
/// <summary>
/// Use Aero to clone the window and the screen to capture.
/// This mode will maintain transparency
/// </summary>
AeroTransparent, AeroTransparent,
/// <summary>
/// Automatically select the modus
/// </summary>
Auto Auto
} }
} }

View file

@ -36,12 +36,18 @@ namespace Greenshot.Core.Sources
private readonly ICaptureConfiguration _captureConfiguration; private readonly ICaptureConfiguration _captureConfiguration;
private readonly Func<IInteropWindow> _retrieveWindowFunc; private readonly Func<IInteropWindow> _retrieveWindowFunc;
/// <summary>
/// Constructor
/// </summary>
/// <param name="captureConfiguration">ICaptureConfiguration</param>
/// <param name="retrieveWindowFunc">Func to select the window</param>
public DwmWindowSource(ICaptureConfiguration captureConfiguration, Func<IInteropWindow> retrieveWindowFunc = null) public DwmWindowSource(ICaptureConfiguration captureConfiguration, Func<IInteropWindow> retrieveWindowFunc = null)
{ {
_captureConfiguration = captureConfiguration; _captureConfiguration = captureConfiguration;
_retrieveWindowFunc = retrieveWindowFunc ?? InteropWindowQuery.GetForegroundWindow; _retrieveWindowFunc = retrieveWindowFunc ?? InteropWindowQuery.GetForegroundWindow;
} }
/// <inheritdoc/>
public ValueTask<ICaptureElement<BitmapSource>> Import(CancellationToken cancellationToken = default) public ValueTask<ICaptureElement<BitmapSource>> Import(CancellationToken cancellationToken = default)
{ {
var window = _retrieveWindowFunc(); var window = _retrieveWindowFunc();

View file

@ -32,7 +32,12 @@ namespace Greenshot.Core.Templates
/// </summary> /// </summary>
public class CroppedTemplate : ITemplate<BitmapSource> public class CroppedTemplate : ITemplate<BitmapSource>
{ {
/// <summary>
/// Specify if the mouse cursor should be displayed
/// </summary>
public bool DisplayMouse { get; set; } = true; public bool DisplayMouse { get; set; } = true;
/// <inheritdoc/>
public FrameworkElement Apply(ICapture<BitmapSource> capture) public FrameworkElement Apply(ICapture<BitmapSource> capture)
{ {
var width = (int)(capture.CropRect.Width + 0.5); var width = (int)(capture.CropRect.Width + 0.5);
@ -62,7 +67,7 @@ namespace Greenshot.Core.Templates
foreach (var captureCaptureElement in capture.CaptureElements) foreach (var captureCaptureElement in capture.CaptureElements)
{ {
// Skip mouse cursor // Skip mouse cursor
if (captureCaptureElement.ElementType == CaptureElementType.Cursor && DisplayMouse) if (captureCaptureElement.ElementType == CaptureElementType.Cursor && !DisplayMouse)
{ {
continue; continue;
} }

View file

@ -31,7 +31,12 @@ namespace Greenshot.Core.Templates
/// </summary> /// </summary>
public class SimpleTemplate : ITemplate<BitmapSource> public class SimpleTemplate : ITemplate<BitmapSource>
{ {
/// <summary>
/// Specify if the mouse should be shown
/// </summary>
public bool DisplayMouse { get; set; } = true; public bool DisplayMouse { get; set; } = true;
/// <inheritdoc/>
public FrameworkElement Apply(ICapture<BitmapSource> capture) public FrameworkElement Apply(ICapture<BitmapSource> capture)
{ {
var canvas = new Canvas var canvas = new Canvas
@ -43,7 +48,7 @@ namespace Greenshot.Core.Templates
foreach (var captureCaptureElement in capture.CaptureElements) foreach (var captureCaptureElement in capture.CaptureElements)
{ {
// Skip mouse cursor // Skip mouse cursor
if (captureCaptureElement.ElementType == CaptureElementType.Cursor && DisplayMouse) if (captureCaptureElement.ElementType == CaptureElementType.Cursor && !DisplayMouse)
{ {
continue; continue;
} }

View file

@ -125,6 +125,9 @@ namespace Greenshot.Gfx
}; };
} }
/// <summary>
/// This defines all available bitmap reader functions, registered to an "extension" is called with a stream to a IBitmap.
/// </summary>
public static IDictionary<string, Func<Stream, string, IBitmapWithNativeSupport>> StreamConverters { get; } = new Dictionary<string, Func<Stream, string, IBitmapWithNativeSupport>>(StringComparer.OrdinalIgnoreCase); public static IDictionary<string, Func<Stream, string, IBitmapWithNativeSupport>> StreamConverters { get; } = new Dictionary<string, Func<Stream, string, IBitmapWithNativeSupport>>(StringComparer.OrdinalIgnoreCase);
/// <summary> /// <summary>

View file

@ -32,6 +32,10 @@ namespace Greenshot.Gfx
// Underlying image // Underlying image
private readonly Bitmap _bitmap; private readonly Bitmap _bitmap;
/// <summary>
/// Constructor taking a Bitmap
/// </summary>
/// <param name="bitmap"></param>
public BitmapWrapper(Bitmap bitmap) public BitmapWrapper(Bitmap bitmap)
{ {
// Make sure the orientation is set correctly so Greenshot can process the image correctly // Make sure the orientation is set correctly so Greenshot can process the image correctly
@ -39,6 +43,7 @@ namespace Greenshot.Gfx
_bitmap = bitmap; _bitmap = bitmap;
} }
/// <inheritdoc/>
public void Dispose() public void Dispose()
{ {
_bitmap.Dispose(); _bitmap.Dispose();

View file

@ -29,12 +29,22 @@ namespace Greenshot.Gfx.Effects
/// </summary> /// </summary>
public class AdjustEffect : IEffect public class AdjustEffect : IEffect
{ {
/// <summary>
/// The contrast for the effect
/// </summary>
public float Contrast { get; set; } = 1f; public float Contrast { get; set; } = 1f;
/// <summary>
/// The brightness for the effect
/// </summary>
public float Brightness { get; set; } = 1f; public float Brightness { get; set; } = 1f;
/// <summary>
/// The gamma for the effect
/// </summary>
public float Gamma { get; set; } = 1f; public float Gamma { get; set; } = 1f;
/// <inheritdoc />
public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
return Adjust(sourceBitmap, Brightness, Contrast, Gamma); return Adjust(sourceBitmap, Brightness, Contrast, Gamma);

View file

@ -29,8 +29,12 @@ namespace Greenshot.Gfx.Effects
[TypeConverter(typeof(EffectConverter))] [TypeConverter(typeof(EffectConverter))]
public class BlurEffect : IEffect public class BlurEffect : IEffect
{ {
/// <summary>
/// The range for the blur
/// </summary>
public int Range { get; set; } = 3; public int Range { get; set; } = 3;
/// <inheritdoc />
public virtual IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public virtual IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
var result = FastBitmapFactory.CreateCloneOf(sourceBitmap); var result = FastBitmapFactory.CreateCloneOf(sourceBitmap);

View file

@ -29,10 +29,17 @@ namespace Greenshot.Gfx.Effects
/// </summary> /// </summary>
public class BorderEffect : IEffect public class BorderEffect : IEffect
{ {
/// <summary>
/// The color of the border
/// </summary>
public Color Color { get; set; } = Color.Black; public Color Color { get; set; } = Color.Black;
/// <summary>
/// The width of the border
/// </summary>
public int Width { get; set; } = 2; public int Width { get; set; } = 2;
/// <inheritdoc />
public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
return CreateBorder(sourceBitmap, Width, Color, sourceBitmap.PixelFormat, matrix); return CreateBorder(sourceBitmap, Width, Color, sourceBitmap.PixelFormat, matrix);

View file

@ -34,12 +34,16 @@ namespace Greenshot.Gfx.Effects
// Fix to prevent BUG-1753 // Fix to prevent BUG-1753
private readonly NumberFormatInfo _numberFormatInfo = new NumberFormatInfo(); private readonly NumberFormatInfo _numberFormatInfo = new NumberFormatInfo();
/// <summary>
/// Default constructor
/// </summary>
public EffectConverter() public EffectConverter()
{ {
_numberFormatInfo.NumberDecimalSeparator = "."; _numberFormatInfo.NumberDecimalSeparator = ".";
_numberFormatInfo.NumberGroupSeparator = ","; _numberFormatInfo.NumberGroupSeparator = ",";
} }
/// <inheritdoc />
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{ {
if (sourceType == typeof(string)) if (sourceType == typeof(string))
@ -49,11 +53,13 @@ namespace Greenshot.Gfx.Effects
return base.CanConvertFrom(context, sourceType); return base.CanConvertFrom(context, sourceType);
} }
/// <inheritdoc />
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{ {
return destinationType == typeof(string) || destinationType == typeof(DropShadowEffect) || destinationType == typeof(TornEdgeEffect) || base.CanConvertTo(context, destinationType); return destinationType == typeof(string) || destinationType == typeof(DropShadowEffect) || destinationType == typeof(TornEdgeEffect) || base.CanConvertTo(context, destinationType);
} }
/// <inheritdoc />
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{ {
// to string // to string
@ -93,6 +99,7 @@ namespace Greenshot.Gfx.Effects
return base.ConvertTo(context, culture, value, destinationType); return base.ConvertTo(context, culture, value, destinationType);
} }
/// <inheritdoc />
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{ {
if (!(value is string settings)) if (!(value is string settings))
@ -102,6 +109,7 @@ namespace Greenshot.Gfx.Effects
return ConvertTo(context, culture, settings, settings.Contains("ToothHeight") ? typeof(TornEdgeEffect) : typeof(DropShadowEffect)); return ConvertTo(context, culture, settings, settings.Contains("ToothHeight") ? typeof(TornEdgeEffect) : typeof(DropShadowEffect));
} }
/// <inheritdoc />
private void ApplyDropShadowEffectValues(string valuesString, DropShadowEffect effect) private void ApplyDropShadowEffectValues(string valuesString, DropShadowEffect effect)
{ {
var values = valuesString.Split('|'); var values = valuesString.Split('|');

View file

@ -27,6 +27,8 @@ namespace Greenshot.Gfx.Effects
/// </summary> /// </summary>
public class InvertEffect : IEffect public class InvertEffect : IEffect
{ {
/// <inheritdoc />
public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
return CreateNegative(sourceBitmap); return CreateNegative(sourceBitmap);

View file

@ -37,6 +37,7 @@ namespace Greenshot.Gfx.Effects
_threshold = threshold; _threshold = threshold;
} }
/// <inheritdoc />
public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
return CreateMonochrome(sourceBitmap, _threshold); return CreateMonochrome(sourceBitmap, _threshold);

View file

@ -31,8 +31,12 @@ namespace Greenshot.Gfx.Effects
{ {
private static readonly LogSource Log = new LogSource(); private static readonly LogSource Log = new LogSource();
/// <summary>
/// The amount of colors the bitmap is allowed to have
/// </summary>
public int Colors { get; set; } = 256; public int Colors { get; set; } = 256;
/// <inheritdoc />
public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
using (var quantizer = new WuQuantizer(sourceBitmap)) using (var quantizer = new WuQuantizer(sourceBitmap))

View file

@ -23,10 +23,17 @@ using System.Drawing.Drawing2D;
namespace Greenshot.Gfx.Effects namespace Greenshot.Gfx.Effects
{ {
/// <summary> /// <summary>
/// ResizeCanvasEffect /// This effect will enlange the bitmap with the specified pixels to the left, right, top, bottom
/// </summary> /// </summary>
public class ResizeCanvasEffect : IEffect public class ResizeCanvasEffect : IEffect
{ {
/// <summary>
/// The constructor which takes the sizes to grow the canvas
/// </summary>
/// <param name="left">int</param>
/// <param name="right">int</param>
/// <param name="top">int</param>
/// <param name="bottom">int</param>
public ResizeCanvasEffect(int left, int right, int top, int bottom) public ResizeCanvasEffect(int left, int right, int top, int bottom)
{ {
Left = left; Left = left;
@ -36,16 +43,32 @@ namespace Greenshot.Gfx.Effects
BackgroundColor = Color.Empty; // Uses the default background color depending on the format BackgroundColor = Color.Empty; // Uses the default background color depending on the format
} }
/// <summary>
/// The pixels which need to be added left
/// </summary>
public int Left { get; set; } public int Left { get; set; }
/// <summary>
/// The pixels which need to be added right
/// </summary>
public int Right { get; set; } public int Right { get; set; }
/// <summary>
/// The pixels which need to be added top
/// </summary>
public int Top { get; set; } public int Top { get; set; }
/// <summary>
/// The pixels which need to be added bottom
/// </summary>
public int Bottom { get; set; } public int Bottom { get; set; }
/// <summary>
/// The color of the new pixels
/// </summary>
public Color BackgroundColor { get; set; } public Color BackgroundColor { get; set; }
/// <inheritdoc />
public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
return BitmapHelper.ResizeCanvas(sourceBitmap, BackgroundColor, Left, Right, Top, Bottom, matrix); return BitmapHelper.ResizeCanvas(sourceBitmap, BackgroundColor, Left, Right, Top, Bottom, matrix);

View file

@ -22,10 +22,16 @@ using System.Drawing.Drawing2D;
namespace Greenshot.Gfx.Effects namespace Greenshot.Gfx.Effects
{ {
/// <summary> /// <summary>
/// ResizeEffect /// This effect resizes the bitmap
/// </summary> /// </summary>
public class ResizeEffect : IEffect public class ResizeEffect : IEffect
{ {
/// <summary>
/// The constructor which takes the new width and height and if the aspect ratio should be maintained
/// </summary>
/// <param name="width">int</param>
/// <param name="height">int</param>
/// <param name="maintainAspectRatio">bool</param>
public ResizeEffect(int width, int height, bool maintainAspectRatio) public ResizeEffect(int width, int height, bool maintainAspectRatio)
{ {
Width = width; Width = width;
@ -33,12 +39,22 @@ namespace Greenshot.Gfx.Effects
MaintainAspectRatio = maintainAspectRatio; MaintainAspectRatio = maintainAspectRatio;
} }
/// <summary>
/// The new width
/// </summary>
public int Width { get; set; } public int Width { get; set; }
/// <summary>
/// The new height
/// </summary>
public int Height { get; set; } public int Height { get; set; }
/// <summary>
/// Do we need to maintain the aspect ration
/// </summary>
public bool MaintainAspectRatio { get; set; } public bool MaintainAspectRatio { get; set; }
/// <inheritdoc />
public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
return sourceBitmap.Resize(MaintainAspectRatio, Width, Height, matrix); return sourceBitmap.Resize(MaintainAspectRatio, Width, Height, matrix);

View file

@ -24,17 +24,25 @@ using System.Drawing.Drawing2D;
namespace Greenshot.Gfx.Effects namespace Greenshot.Gfx.Effects
{ {
/// <summary> /// <summary>
/// RotateEffect /// This effect rotates the bitmap, this will also resize the bitmap
/// </summary> /// </summary>
public class RotateEffect : IEffect public class RotateEffect : IEffect
{ {
/// <summary>
/// The constructor which takes the angle
/// </summary>
/// <param name="angle">int with the angle</param>
public RotateEffect(int angle) public RotateEffect(int angle)
{ {
Angle = angle; Angle = angle;
} }
/// <summary>
/// The angle
/// </summary>
public int Angle { get; set; } public int Angle { get; set; }
/// <inheritdoc />
public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
RotateFlipType flipType; RotateFlipType flipType;

View file

@ -24,11 +24,12 @@ using Greenshot.Gfx.Extensions;
namespace Greenshot.Gfx.Effects namespace Greenshot.Gfx.Effects
{ {
/// <summary> /// <summary>
/// Scale2x Effect /// This effect scales the bitmap to 2x its size
/// </summary> /// </summary>
[TypeConverter(typeof(EffectConverter))] [TypeConverter(typeof(EffectConverter))]
public sealed class Scale2xEffect : IEffect public sealed class Scale2xEffect : IEffect
{ {
/// <inheritdoc />
public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
matrix?.Scale(2, 2, MatrixOrder.Append); matrix?.Scale(2, 2, MatrixOrder.Append);

View file

@ -33,16 +33,32 @@ namespace Greenshot.Gfx.Effects
[TypeConverter(typeof(EffectConverter))] [TypeConverter(typeof(EffectConverter))]
public sealed class TornEdgeEffect : DropShadowEffect public sealed class TornEdgeEffect : DropShadowEffect
{ {
/// <summary>
/// Height of the teeth
/// </summary>
public int ToothHeight { get; set; } = 12; public int ToothHeight { get; set; } = 12;
/// <summary>
/// How many teeth are horizontally displayed
/// </summary>
public int HorizontalToothRange { get; set; } = 20; public int HorizontalToothRange { get; set; } = 20;
/// <summary>
/// How many teeth are vertically displayed
/// </summary>
public int VerticalToothRange { get; set; } = 20; public int VerticalToothRange { get; set; } = 20;
/// <summary>
/// Specify which edges should get teeth
/// </summary>
public bool[] Edges { get; set; } = { true, true, true, true }; public bool[] Edges { get; set; } = { true, true, true, true };
/// <summary>
/// Generate a shadow?
/// </summary>
public bool GenerateShadow { get; set; } = true; public bool GenerateShadow { get; set; } = true;
/// <inheritdoc/>
public override IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) public override IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix)
{ {
var tmpTornImage = CreateTornEdge(sourceBitmap, ToothHeight, HorizontalToothRange, VerticalToothRange, Edges); var tmpTornImage = CreateTornEdge(sourceBitmap, ToothHeight, HorizontalToothRange, VerticalToothRange, Edges);
@ -56,7 +72,6 @@ namespace Greenshot.Gfx.Effects
} }
} }
/// <summary> /// <summary>
/// Helper method for the tornedge /// Helper method for the tornedge
/// </summary> /// </summary>

View file

@ -23,14 +23,17 @@ using Dapplo.Windows.Common.Structs;
namespace Greenshot.Gfx.Extensions namespace Greenshot.Gfx.Extensions
{ {
/// <summary>
/// These extensions are for the writable bitmap
/// </summary>
public static class WriteableBitmapExtensions public static class WriteableBitmapExtensions
{ {
/// <summary> /// <summary>
/// Copy the rect from source to target /// Copy the rect from source to target
/// </summary> /// </summary>
/// <param name="target"></param> /// <param name="target">WriteableBitmap</param>
/// <param name="source"></param> /// <param name="source">BitmapSource</param>
/// <param name="rect"></param> /// <param name="rect">BitmapSource</param>
public static void CopyPixels(this WriteableBitmap target, BitmapSource source, NativeRect rect) public static void CopyPixels(this WriteableBitmap target, BitmapSource source, NativeRect rect)
{ {
// Calculate stride of source // Calculate stride of source

View file

@ -27,6 +27,11 @@ namespace Greenshot.Gfx.FastBitmap
/// </summary> /// </summary>
public unsafe class Fast24RgbBitmap : FastBitmapBase public unsafe class Fast24RgbBitmap : FastBitmapBase
{ {
/// <summary>
/// Constructor which takes an IBitmap to wrap the fastbitmap logic around it
/// </summary>
/// <param name="source">IBitmapWithNativeSupport</param>
/// <param name="area">NativeRect optional</param>
public Fast24RgbBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area) public Fast24RgbBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area)
{ {
} }

View file

@ -27,15 +27,23 @@ namespace Greenshot.Gfx.FastBitmap
/// </summary> /// </summary>
public unsafe class Fast32ArgbBitmap : FastBitmapBase, IFastBitmapWithBlend public unsafe class Fast32ArgbBitmap : FastBitmapBase, IFastBitmapWithBlend
{ {
/// <summary>
/// Constructor which takes an IBitmap to wrap the fastbitmap logic around it
/// </summary>
/// <param name="source">IBitmapWithNativeSupport</param>
/// <param name="area">NativeRect optional</param>
public Fast32ArgbBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area) public Fast32ArgbBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area)
{ {
BackgroundBlendColor = Color.White; BackgroundBlendColor = Color.White;
} }
/// <inheritdoc />
public override int BytesPerPixel { get; } = 4; public override int BytesPerPixel { get; } = 4;
/// <inheritdoc />
public override bool HasAlphaChannel => true; public override bool HasAlphaChannel => true;
/// <inheritdoc />
public Color BackgroundBlendColor { get; set; } public Color BackgroundBlendColor { get; set; }
/// <inheritdoc /> /// <inheritdoc />

View file

@ -27,6 +27,11 @@ namespace Greenshot.Gfx.FastBitmap
/// </summary> /// </summary>
public unsafe class Fast32RgbBitmap : FastBitmapBase public unsafe class Fast32RgbBitmap : FastBitmapBase
{ {
/// <summary>
/// Constructor which takes an IBitmap to wrap the fastbitmap logic around it
/// </summary>
/// <param name="source">IBitmapWithNativeSupport</param>
/// <param name="area">NativeRect optional</param>
public Fast32RgbBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area) public Fast32RgbBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area)
{ {
} }

View file

@ -476,11 +476,11 @@ namespace Greenshot.Gfx.FastBitmap
} }
/// <summary> /// <summary>
/// returns true if x & y are inside the FastBitmap /// returns true if x and y are inside the FastBitmap
/// </summary> /// </summary>
/// <param name="x"></param> /// <param name="x"></param>
/// <param name="y"></param> /// <param name="y"></param>
/// <returns>true if x & y are inside the FastBitmap</returns> /// <returns>true if x and y are inside the FastBitmap</returns>
bool IFastBitmapWithOffset.Contains(int x, int y) bool IFastBitmapWithOffset.Contains(int x, int y)
{ {
return Area.Contains(x - Left, y - Top); return Area.Contains(x - Left, y - Top);

View file

@ -33,6 +33,11 @@ namespace Greenshot.Gfx.FastBitmap
// Used for indexed images // Used for indexed images
private readonly Color[] _colorEntries; private readonly Color[] _colorEntries;
/// <summary>
/// This contructor creates a FastBitmap for the specified source
/// </summary>
/// <param name="source">IBitmapWithNativeSupport</param>
/// <param name="area">NativeRect</param>
public FastChunkyBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area) public FastChunkyBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area)
{ {
_colorEntries = Bitmap.NativeBitmap.Palette.Entries; _colorEntries = Bitmap.NativeBitmap.Palette.Entries;

View file

@ -26,8 +26,14 @@ namespace Greenshot.Gfx.FastBitmap
/// </summary> /// </summary>
public unsafe interface IFastBitmapWithOffset : IFastBitmap public unsafe interface IFastBitmapWithOffset : IFastBitmap
{ {
/// <summary>
/// Specify the x offset for the IFastBitmap
/// </summary>
new int Left { get; set; } new int Left { get; set; }
/// <summary>
/// Specify the y offset for the IFastBitmap
/// </summary>
new int Top { get; set; } new int Top { get; set; }
/// <summary> /// <summary>

View file

@ -0,0 +1,36 @@
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Greenshot.Gfx.Legacy
{
public class FixedAngleRoundBehavior : IDoubleProcessor
{
private readonly double fixedAngle;
public FixedAngleRoundBehavior(double fixedAngle)
{
this.fixedAngle = fixedAngle;
}
public double Process(double angle)
{
return fixedAngle;
}
}
}

View file

@ -1,4 +1,4 @@
// Greenshot - a free and open source screenshot tool // Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom // Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom
// //
// For more information see: http://getgreenshot.org/ // For more information see: http://getgreenshot.org/
@ -17,13 +17,18 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Greenshot.Addons.Core.Enums namespace Greenshot.Gfx.Legacy
{ {
public enum BuildStates /// <summary>
/// Every
/// </summary>
public interface IDoubleProcessor
{ {
ALPHA, /// <summary>
BETA, /// Do the processing
RELEASE_CANDIDATE, /// </summary>
RELEASE /// <param name="d">double</param>
/// <returns>double</returns>
double Process(double d);
} }
} }

View file

@ -0,0 +1,42 @@
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace Greenshot.Gfx.Legacy
{
/// <summary>
/// TODO: Describe
/// </summary>
public class LineAngleRoundBehavior : IDoubleProcessor
{
public static LineAngleRoundBehavior Instance = new LineAngleRoundBehavior();
private LineAngleRoundBehavior()
{
}
/// <inheritdoc/>
public double Process(double angle)
{
return Math.Round(angle / 15) * 15;
}
}
}

View file

@ -20,17 +20,41 @@
namespace Greenshot.Gfx.Legacy namespace Greenshot.Gfx.Legacy
{ {
/// <summary> /// <summary>
/// Position /// This specifies the position of something
/// </summary> /// </summary>
public enum Positions public enum Positions
{ {
/// <summary>
/// Position top left
/// </summary>
TopLeft = 0, TopLeft = 0,
/// <summary>
/// Position top center
/// </summary>
TopCenter = 1, TopCenter = 1,
/// <summary>
/// Position top right
/// </summary>
TopRight = 2, TopRight = 2,
/// <summary>
/// Position middle right
/// </summary>
MiddleRight = 3, MiddleRight = 3,
/// <summary>
/// Position bottom right
/// </summary>
BottomRight = 4, BottomRight = 4,
/// <summary>
/// Position bottom center
/// </summary>
BottomCenter = 5, BottomCenter = 5,
/// <summary>
/// Position bottom left
/// </summary>
BottomLeft = 6, BottomLeft = 6,
/// <summary>
/// Position middle left
/// </summary>
MiddleLeft = 7 MiddleLeft = 7
} }
} }

View file

@ -26,6 +26,7 @@ namespace Greenshot.Gfx.Legacy
/// <summary> /// <summary>
/// TODO: currently this is only used in the capture form, we might move this code directly to there! /// TODO: currently this is only used in the capture form, we might move this code directly to there!
/// </summary> /// </summary>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public abstract class RoundedRectangle public abstract class RoundedRectangle
{ {
[Flags] [Flags]

View file

@ -28,26 +28,8 @@ namespace Greenshot.Gfx.Legacy
/// <summary> /// <summary>
/// Offers a few helper functions for scaling/aligning an element with another element /// Offers a few helper functions for scaling/aligning an element with another element
/// </summary> /// </summary>
public static class ScaleHelper public static partial class ScaleHelper
{ {
[Flags]
public enum ScaleOptions
{
/// <summary>
/// Default scale behavior.
/// </summary>
Default = 0x00,
/// <summary>
/// Scale a rectangle in two our four directions, mirrored at it's center coordinates
/// </summary>
Centered = 0x01,
/// <summary>
/// Scale a rectangle maintaining it's aspect ratio
/// </summary>
Rational = 0x02
}
/// <summary> /// <summary>
/// calculates the Size an element must be resized to, in order to fit another element, keeping aspect ratio /// calculates the Size an element must be resized to, in order to fit another element, keeping aspect ratio
@ -80,8 +62,8 @@ namespace Greenshot.Gfx.Legacy
/// <returns>a new NativeRectFloat object with Location aligned aligned to targetRect</returns> /// <returns>a new NativeRectFloat object with Location aligned aligned to targetRect</returns>
public static NativeRectFloat GetAlignedRectangle(NativeRectFloat currentRect, NativeRectFloat targetRect, ContentAlignment alignment) public static NativeRectFloat GetAlignedRectangle(NativeRectFloat currentRect, NativeRectFloat targetRect, ContentAlignment alignment)
{ {
float x = targetRect.Location.X; var x = targetRect.Location.X;
float y = targetRect.Location.Y; var y = targetRect.Location.Y;
switch (alignment) switch (alignment)
{ {
@ -210,10 +192,10 @@ namespace Greenshot.Gfx.Legacy
/// <param name="resizeHandleCoords">coordinates of the used handle/gripper</param> /// <param name="resizeHandleCoords">coordinates of the used handle/gripper</param>
private static void ScaleInternal(ref NativeRectFloat originalRectangle, Positions resizeHandlePosition, PointF resizeHandleCoords) private static void ScaleInternal(ref NativeRectFloat originalRectangle, Positions resizeHandlePosition, PointF resizeHandleCoords)
{ {
float x = originalRectangle.X; var x = originalRectangle.X;
float y = originalRectangle.Y; var y = originalRectangle.Y;
float width = originalRectangle.Width; var width = originalRectangle.Width;
float height = originalRectangle.Height; var height = originalRectangle.Height;
switch (resizeHandlePosition) switch (resizeHandlePosition)
{ {
@ -421,54 +403,6 @@ namespace Greenshot.Gfx.Legacy
return opts; return opts;
} }
public interface IDoubleProcessor
{
double Process(double d);
}
public class ShapeAngleRoundBehavior : IDoubleProcessor
{
public static ShapeAngleRoundBehavior Instance = new ShapeAngleRoundBehavior();
private ShapeAngleRoundBehavior()
{
}
public double Process(double angle)
{
return Math.Round((angle + 45) / 90) * 90 - 45;
}
}
public class LineAngleRoundBehavior : IDoubleProcessor
{
public static LineAngleRoundBehavior Instance = new LineAngleRoundBehavior();
private LineAngleRoundBehavior()
{
}
public double Process(double angle)
{
return Math.Round(angle / 15) * 15;
}
}
public class FixedAngleRoundBehavior : IDoubleProcessor
{
private readonly double fixedAngle;
public FixedAngleRoundBehavior(double fixedAngle)
{
this.fixedAngle = fixedAngle;
}
public double Process(double angle)
{
return fixedAngle;
}
}
/*public static int FindGripperPostition(float anchorX, float anchorY, float gripperX, float gripperY) { /*public static int FindGripperPostition(float anchorX, float anchorY, float gripperX, float gripperY) {
if(gripperY > anchorY) { if(gripperY > anchorY) {

View file

@ -0,0 +1,46 @@
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace Greenshot.Gfx.Legacy
{
/// <summary>
/// Specify options for scaling
/// </summary>
[Flags]
public enum ScaleOptions
{
/// <summary>
/// Default scale behavior.
/// </summary>
Default = 0x00,
/// <summary>
/// Scale a rectangle in two our four directions, mirrored at it's center coordinates
/// </summary>
Centered = 0x01,
/// <summary>
/// Scale a rectangle maintaining it's aspect ratio
/// </summary>
Rational = 0x02
}
}

View file

@ -0,0 +1,51 @@
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace Greenshot.Gfx.Legacy
{
public static partial class ScaleHelper
{
public class ShapeAngleRoundBehavior : IDoubleProcessor
{
public static ShapeAngleRoundBehavior Instance = new ShapeAngleRoundBehavior();
private ShapeAngleRoundBehavior()
{
}
public double Process(double angle)
{
return Math.Round((angle + 45) / 90) * 90 - 45;
}
}
/*public static int FindGripperPostition(float anchorX, float anchorY, float gripperX, float gripperY) {
if(gripperY > anchorY) {
if(gripperX > anchorY) return Gripper.POSITION_BOTTOM_RIGHT;
else return Gripper.POSITION_BOTTOM_LEFT;
} else {
if(gripperX > anchorY) return Gripper.POSITION_TOP_RIGHT;
else return Gripper.POSITION_TOP_LEFT;
}
}*/
}
}

View file

@ -41,8 +41,14 @@ namespace Greenshot.Gfx
private uint _hash; private uint _hash;
private uint _length; private uint _length;
/// <inheritdoc />
public override int HashSize => 32; public override int HashSize => 32;
/// <summary>
/// Constructor for the Murmur3 algorythm
/// </summary>
/// <param name="seed"></param>
/// <param name="length"></param>
public Murmur3(uint seed, uint length = 0) public Murmur3(uint seed, uint length = 0)
{ {
_seed = seed; _seed = seed;

View file

@ -61,6 +61,10 @@ namespace Greenshot.Gfx.Quantizer
private byte[] _tag; private byte[] _tag;
/// <summary>
/// The constructor for the WuQauntizer
/// </summary>
/// <param name="sourceBitmap"></param>
public WuQuantizer(IBitmapWithNativeSupport sourceBitmap) public WuQuantizer(IBitmapWithNativeSupport sourceBitmap)
{ {
_sourceBitmap = sourceBitmap; _sourceBitmap = sourceBitmap;
@ -103,7 +107,6 @@ namespace Greenshot.Gfx.Quantizer
// Use a bitmap to store the initial match, which is just as good as an array and saves us 2x the storage // Use a bitmap to store the initial match, which is just as good as an array and saves us 2x the storage
using (var sourceFastBitmap = FastBitmapFactory.Create(sourceBitmap)) using (var sourceFastBitmap = FastBitmapFactory.Create(sourceBitmap))
{ {
var sourceFastBitmapWithBlend = sourceFastBitmap as IFastBitmapWithBlend;
sourceFastBitmap.Lock(); sourceFastBitmap.Lock();
using (var destinationFastBitmap = FastBitmapFactory.CreateEmpty(sourceBitmap.Size, PixelFormat.Format8bppIndexed, Color.White) as FastChunkyBitmap) using (var destinationFastBitmap = FastBitmapFactory.CreateEmpty(sourceBitmap.Size, PixelFormat.Format8bppIndexed, Color.White) as FastChunkyBitmap)
{ {
@ -112,7 +115,7 @@ namespace Greenshot.Gfx.Quantizer
for (var x = 0; x < sourceFastBitmap.Width; x++) for (var x = 0; x < sourceFastBitmap.Width; x++)
{ {
Color color; Color color;
if (sourceFastBitmapWithBlend == null) if (!(sourceFastBitmap is IFastBitmapWithBlend sourceFastBitmapWithBlend))
{ {
color = sourceFastBitmap.GetColorAt(x, y); color = sourceFastBitmap.GetColorAt(x, y);
} }
@ -149,6 +152,7 @@ namespace Greenshot.Gfx.Quantizer
} }
} }
} }
/// <inheritdoc/> /// <inheritdoc/>
public void Dispose() public void Dispose()
{ {
@ -176,6 +180,10 @@ namespace Greenshot.Gfx.Quantizer
_resultBitmap = null; _resultBitmap = null;
} }
/// <summary>
/// Returns the number of colors
/// </summary>
/// <returns>int</returns>
public int GetColorCount() public int GetColorCount()
{ {
return _colorCount; return _colorCount;
@ -194,15 +202,13 @@ namespace Greenshot.Gfx.Quantizer
bbbDest.Lock(); bbbDest.Lock();
using (var bbbSrc = FastBitmapFactory.Create(_sourceBitmap)) using (var bbbSrc = FastBitmapFactory.Create(_sourceBitmap))
{ {
var bbbSrcBlend = bbbSrc as IFastBitmapWithBlend;
bbbSrc.Lock(); bbbSrc.Lock();
for (var y = 0; y < bbbSrc.Height; y++) for (var y = 0; y < bbbSrc.Height; y++)
{ {
for (var x = 0; x < bbbSrc.Width; x++) for (var x = 0; x < bbbSrc.Width; x++)
{ {
Color color; Color color;
if (bbbSrcBlend != null) if (bbbSrc is IFastBitmapWithBlend bbbSrcBlend)
{ {
color = bbbSrcBlend.GetBlendedColorAt(x, y); color = bbbSrcBlend.GetBlendedColorAt(x, y);
} }
@ -345,14 +351,13 @@ namespace Greenshot.Gfx.Quantizer
{ {
using (var src = FastBitmapFactory.Create(_sourceBitmap)) using (var src = FastBitmapFactory.Create(_sourceBitmap))
{ {
var srcBlend = src as IFastBitmapWithBlend;
var lookup = new Dictionary<Color, byte>(); var lookup = new Dictionary<Color, byte>();
for (var y = 0; y < src.Height; y++) for (var y = 0; y < src.Height; y++)
{ {
for (var x = 0; x < src.Width; x++) for (var x = 0; x < src.Width; x++)
{ {
Color color; Color color;
if (srcBlend != null) if (src is IFastBitmapWithBlend srcBlend)
{ {
// WithoutAlpha, this makes it possible to ignore the alpha // WithoutAlpha, this makes it possible to ignore the alpha
color = srcBlend.GetBlendedColorAt(x, y); color = srcBlend.GetBlendedColorAt(x, y);

View file

@ -25,6 +25,9 @@ using Greenshot.Gfx.FastBitmap;
namespace Greenshot.Gfx namespace Greenshot.Gfx
{ {
/// <summary>
/// This is the scale X implementation using IFastBitmap
/// </summary>
public static class ScaleX public static class ScaleX
{ {
/// <summary> /// <summary>

View file

@ -24,8 +24,16 @@ using System.Drawing;
namespace Greenshot.Gfx.Structs namespace Greenshot.Gfx.Structs
{ {
/// <summary>
/// These are extensions to help with pixels
/// </summary>
public static class PixelExtensions public static class PixelExtensions
{ {
/// <summary>
/// Make a Brga32 from the specified color
/// </summary>
/// <param name="color">Color</param>
/// <returns>Bgr32</returns>
public static Bgra32 FromColorWithAlpha(this Color color) public static Bgra32 FromColorWithAlpha(this Color color)
{ {
return new Bgra32 return new Bgra32
@ -36,6 +44,12 @@ namespace Greenshot.Gfx.Structs
B = color.B, B = color.B,
}; };
} }
/// <summary>
/// Make a Brg32 from the specified color
/// </summary>
/// <param name="color">Color</param>
/// <returns>Bgr32</returns>
public static Bgr32 FromColor(this Color color) public static Bgr32 FromColor(this Color color)
{ {
return new Bgr32 return new Bgr32

View file

@ -148,6 +148,7 @@ namespace Greenshot.Gfx
return _imageClone; return _imageClone;
} }
/// <inheritdoc/>
public Size Size => new Size(Width, Height); public Size Size => new Size(Width, Height);
/// <summary> /// <summary>

View file

@ -154,6 +154,9 @@ namespace Greenshot.Gfx
} }
} }
/// <summary>
/// Returns the pixel format for this Unmanaged bitmap
/// </summary>
public System.Windows.Media.PixelFormat WpfPixelFormat public System.Windows.Media.PixelFormat WpfPixelFormat
{ {
get get
@ -203,6 +206,7 @@ namespace Greenshot.Gfx
} }
} }
/// <inheritdoc/>
public Size Size => new Size(Width, Height); public Size Size => new Size(Width, Height);
/// <summary> /// <summary>