mirror of
https://github.com/Geckon01/Watermark.Net.git
synced 2026-07-11 05:31:51 +00:00
Small code improvements
This commit is contained in:
@@ -40,6 +40,8 @@ ScaffoldingReadMe.txt
|
|||||||
~$*
|
~$*
|
||||||
*~
|
*~
|
||||||
CodeCoverage/
|
CodeCoverage/
|
||||||
|
.vs
|
||||||
|
Watermark.Net/.vs
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
# MSBuild Binary and Structured Log
|
||||||
*.binlog
|
*.binlog
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace UnitTest
|
|||||||
watermark.Position = Watermark.Net.src.WatermarkNet.Enums.ImagePosition.Center;
|
watermark.Position = Watermark.Net.src.WatermarkNet.Enums.ImagePosition.Center;
|
||||||
watermark.Scale = 1;
|
watermark.Scale = 1;
|
||||||
watermark.Pave = true;
|
watermark.Pave = true;
|
||||||
var resultedImage = watermarker.ProcessDirectory("TestImages", watermark);
|
watermarker.ProcessDirectory("TestImages", watermark);
|
||||||
|
|
||||||
Assert.IsTrue(Directory.GetFiles(watermarker.OutputDir)?.Length > 0);
|
Assert.IsTrue(Directory.GetFiles(watermarker.OutputDir)?.Length > 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,13 +230,12 @@ namespace Watermark.Net.src.WatermarkNet.Core
|
|||||||
{
|
{
|
||||||
case ImagePosition.TopCenter:
|
case ImagePosition.TopCenter:
|
||||||
return HorizontalAlignment.Center;
|
return HorizontalAlignment.Center;
|
||||||
break;
|
|
||||||
case ImagePosition.Center:
|
case ImagePosition.Center:
|
||||||
return HorizontalAlignment.Center;
|
return HorizontalAlignment.Center;
|
||||||
break;
|
|
||||||
case ImagePosition.BottomCenter:
|
case ImagePosition.BottomCenter:
|
||||||
return HorizontalAlignment.Center;
|
return HorizontalAlignment.Center;
|
||||||
break;
|
default:
|
||||||
|
throw new ArgumentException("Image position must be provided.");
|
||||||
}
|
}
|
||||||
return HorizontalAlignment.Left;
|
return HorizontalAlignment.Left;
|
||||||
}
|
}
|
||||||
@@ -257,7 +256,6 @@ namespace Watermark.Net.src.WatermarkNet.Core
|
|||||||
|
|
||||||
// Create a new font
|
// Create a new font
|
||||||
Font scaledFont = new Font(watermark.Font, scalingFactor / 16 * (watermark.Font.Size * watermark.Scale));
|
Font scaledFont = new Font(watermark.Font, scalingFactor / 16 * (watermark.Font.Size * watermark.Scale));
|
||||||
ImagePosition[] centerImagePositions = { ImagePosition.CenterLeft, ImagePosition.CenterRight, ImagePosition.Center };
|
|
||||||
//processingContext.SetGraphicsOptions(new GraphicsOptions { AlphaCompositionMode = SixLabors.ImageSharp.PixelFormats.PixelAlphaCompositionMode.Clear});
|
//processingContext.SetGraphicsOptions(new GraphicsOptions { AlphaCompositionMode = SixLabors.ImageSharp.PixelFormats.PixelAlphaCompositionMode.Clear});
|
||||||
//If set, apply backround color
|
//If set, apply backround color
|
||||||
if (watermark.BackroundColor != null)
|
if (watermark.BackroundColor != null)
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ using Watrmark.Net_CLI.Watermak.Net.CLI.Constants;
|
|||||||
using Watrmark.Net_CLI;
|
using Watrmark.Net_CLI;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
//The CLI version is not fully ready yet. To be implemented in future
|
||||||
|
|
||||||
Parser.Default.ParseArguments<ConsoleOptions>(args)
|
Parser.Default.ParseArguments<ConsoleOptions>(args)
|
||||||
.WithParsed<ConsoleOptions>(option => {
|
.WithParsed<ConsoleOptions>(option => {
|
||||||
switch (option.WatermarkType)
|
switch (option.WatermarkType)
|
||||||
@@ -24,6 +26,8 @@ Parser.Default.ParseArguments<ConsoleOptions>(args)
|
|||||||
else
|
else
|
||||||
ProccessDirectoryText(option);
|
ProccessDirectoryText(option);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw new ArgumentException("Watermark type not provided.");
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user