Initial Commit
This commit is contained in:
41
UseCases/Utils.cs
Normal file
41
UseCases/Utils.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace UseCases
|
||||
{
|
||||
internal static class Utils
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Translate a PointF
|
||||
/// </summary>
|
||||
/// <param name="input">Original PointF</param>
|
||||
/// <param name="offX">Horizontal offset</param>
|
||||
/// <param name="offY">Vertical offset</param>
|
||||
/// <returns>Translated point</returns>
|
||||
public static PointF TranslatePointF(PointF input, float offX, float offY)
|
||||
{
|
||||
return new PointF(input.X + offX, input.Y + offY);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Translate a SizeF
|
||||
/// </summary>
|
||||
/// <param name="input">Original SizeF</param>
|
||||
/// <param name="offX">Horizontal offset</param>
|
||||
/// <param name="offY">Vertical offset</param>
|
||||
/// <returns>Translated point</returns>
|
||||
public static SizeF TranslateSizeF(SizeF input, float offX, float offY)
|
||||
{
|
||||
var returnSize = new SizeF(input);
|
||||
returnSize.Width += offX;
|
||||
returnSize.Height += offY;
|
||||
return returnSize;
|
||||
}
|
||||
|
||||
public static JsonSerializerSettings SerializerSettings =>
|
||||
new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.Objects, Converters = new List<JsonConverter>{new VersionConverter()}};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user