This commit is contained in:
parent
ddf47ad51b
commit
d76e133f18
31 changed files with 236 additions and 2592 deletions
|
|
@ -1,7 +1,8 @@
|
|||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Xml.Linq;
|
||||
using MaddoShared;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
|
||||
namespace CatalogLite;
|
||||
|
||||
|
|
@ -89,7 +90,7 @@ public sealed class CatalogConfigurationLoader
|
|||
settings.Margine = values.GetInt("TestoMargine", 8);
|
||||
settings.LogoAltezza = values.GetInt("MarchioAltezza", 430);
|
||||
settings.LogoLarghezza = values.GetInt("MarchioLarghezza", 430);
|
||||
settings.FontColoreRGB = ParseColor(values.GetString("ColoreTestoRGB", "Yellow"), Color.Yellow);
|
||||
settings.FontColoreRGB = ParseColor(values.GetString("ColoreTestoRGB", "Yellow"), new Rgba32(255, 255, 0, 255));
|
||||
settings.LogoAggiungi = values.GetBool("MarchioAggiungi");
|
||||
settings.LogoNomeFile = values.GetString("MarchioFile");
|
||||
settings.LogoTrasparenza = values.GetInt("MarchioTrasparenza", 100).ToString(CultureInfo.InvariantCulture);
|
||||
|
|
@ -118,7 +119,6 @@ public sealed class CatalogConfigurationLoader
|
|||
settings.FotoRuotaASinistra = false;
|
||||
settings.TempMinText = string.Empty;
|
||||
settings.OverwriteFiles = values.GetBool("GeneraleSovrascriviFile");
|
||||
settings.ImageCreatorProvider = "ImageSharp";
|
||||
}
|
||||
|
||||
private static ImageCreationService.Options BuildOptions(ConfigurationValues values, string sourcePath, string destinationPath)
|
||||
|
|
@ -150,7 +150,7 @@ public sealed class CatalogConfigurationLoader
|
|||
return string.Equals(values.GetString("MiniatureModalita"), mode, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static Color ParseColor(string value, Color fallback)
|
||||
private static Rgba32 ParseColor(string value, Rgba32 fallback)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
|
|
@ -162,14 +162,19 @@ public sealed class CatalogConfigurationLoader
|
|||
{
|
||||
if (normalized.StartsWith('#') && normalized.Length == 7)
|
||||
{
|
||||
return Color.FromArgb(
|
||||
Convert.ToInt32(normalized[1..3], 16),
|
||||
Convert.ToInt32(normalized[3..5], 16),
|
||||
Convert.ToInt32(normalized[5..7], 16));
|
||||
return new Rgba32(
|
||||
Convert.ToByte(normalized[1..3], 16),
|
||||
Convert.ToByte(normalized[3..5], 16),
|
||||
Convert.ToByte(normalized[5..7], 16),
|
||||
255);
|
||||
}
|
||||
|
||||
var named = Color.FromName(normalized);
|
||||
return named.IsKnownColor || named.IsNamedColor ? named : fallback;
|
||||
if (normalized.Length == 6 && normalized.All(Uri.IsHexDigit))
|
||||
{
|
||||
normalized = "#" + normalized;
|
||||
}
|
||||
|
||||
return Color.Parse(normalized).ToPixel<Rgba32>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue