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