Small code improvements

This commit is contained in:
DESKTOP-QG096I2\RentPc
2025-07-23 23:43:06 +03:00
parent 3a67f95cf4
commit acab6cf5a9
4 changed files with 9 additions and 5 deletions
+2
View File
@@ -40,6 +40,8 @@ ScaffoldingReadMe.txt
~$*
*~
CodeCoverage/
.vs
Watermark.Net/.vs
# MSBuild Binary and Structured Log
*.binlog
+1 -1
View File
@@ -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)
+4
View File
@@ -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.");
}
})