Made improvements to the XP card text visibility with other backgrounds

This commit is contained in:
Kwoth
2022-08-01 12:01:01 +02:00
parent cf3788c6ea
commit 98272f66e7
2 changed files with 30 additions and 16 deletions

View File

@@ -887,6 +887,8 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
throw new ArgumentNullException(nameof(bgBytes)); throw new ArgumentNullException(nameof(bgBytes));
} }
var outlinePen = new Pen(Color.Black, 1f);
using var img = Image.Load<Rgba32>(bgBytes, out var imageFormat); using var img = Image.Load<Rgba32>(bgBytes, out var imageFormat);
if (template.User.Name.Show) if (template.User.Name.Show)
{ {
@@ -909,7 +911,8 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
Origin = new(template.User.Name.Pos.X, template.User.Name.Pos.Y + 8) Origin = new(template.User.Name.Pos.X, template.User.Name.Pos.Y + 8)
}, },
"@" + username, "@" + username,
template.User.Name.Color); Brushes.Solid(template.User.Name.Color),
outlinePen);
}); });
} }
@@ -929,7 +932,8 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
Origin = new(template.Club.Name.Pos.X + 50, template.Club.Name.Pos.Y - 8) Origin = new(template.Club.Name.Pos.X + 50, template.Club.Name.Pos.Y - 8)
}, },
clubName, clubName,
template.Club.Name.Color)); Brushes.Solid(template.Club.Name.Color),
outlinePen));
} }
Font GetTruncatedFont( Font GetTruncatedFont(
@@ -987,7 +991,6 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
}); });
} }
var pen = new Pen(Color.Black, 1.25f);
var global = stats.Global; var global = stats.Global;
var guild = stats.Guild; var guild = stats.Guild;
@@ -1012,7 +1015,7 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
}, },
$"{global.LevelXp}/{global.RequiredXp}", $"{global.LevelXp}/{global.RequiredXp}",
Brushes.Solid(template.User.Xp.Global.Color), Brushes.Solid(template.User.Xp.Global.Color),
pen)); outlinePen));
} }
if (template.User.Xp.Guild.Show) if (template.User.Xp.Guild.Show)
@@ -1026,7 +1029,7 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
}, },
$"{guild.LevelXp}/{guild.RequiredXp}", $"{guild.LevelXp}/{guild.RequiredXp}",
Brushes.Solid(template.User.Xp.Guild.Color), Brushes.Solid(template.User.Xp.Guild.Color),
pen)); outlinePen));
} }
if (stats.FullGuildStats.AwardedXp != 0 && template.User.Xp.Awarded.Show) if (stats.FullGuildStats.AwardedXp != 0 && template.User.Xp.Awarded.Show)
@@ -1038,10 +1041,11 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
img.Mutate(x => x.DrawText($"({sign}{stats.FullGuildStats.AwardedXp})", img.Mutate(x => x.DrawText($"({sign}{stats.FullGuildStats.AwardedXp})",
_fonts.NotoSans.CreateFont(template.User.Xp.Awarded.FontSize, FontStyle.Bold), _fonts.NotoSans.CreateFont(template.User.Xp.Awarded.FontSize, FontStyle.Bold),
Brushes.Solid(template.User.Xp.Awarded.Color), Brushes.Solid(template.User.Xp.Awarded.Color),
pen, outlinePen,
new(awX, awY))); new(awX, awY)));
} }
var rankPen = new Pen(Color.White, 1);
//ranking //ranking
if (template.User.GlobalRank.Show) if (template.User.GlobalRank.Show)
{ {
@@ -1054,10 +1058,15 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
globalRankStr, globalRankStr,
68); 68);
img.Mutate(x => x.DrawText(globalRankStr, img.Mutate(x => x.DrawText(
globalRankFont, new TextOptions(globalRankFont)
template.User.GlobalRank.Color, {
new(template.User.GlobalRank.Pos.X, template.User.GlobalRank.Pos.Y))); Origin = new(template.User.GlobalRank.Pos.X, template.User.GlobalRank.Pos.Y)
},
globalRankStr,
Brushes.Solid(template.User.GlobalRank.Color),
rankPen
));
} }
if (template.User.GuildRank.Show) if (template.User.GuildRank.Show)
@@ -1071,10 +1080,15 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
guildRankStr, guildRankStr,
43); 43);
img.Mutate(x => x.DrawText(guildRankStr, img.Mutate(x => x.DrawText(
guildRankFont, new TextOptions(guildRankFont)
template.User.GuildRank.Color, {
new(template.User.GuildRank.Pos.X, template.User.GuildRank.Pos.Y))); Origin = new(template.User.GuildRank.Pos.X, template.User.GuildRank.Pos.Y)
},
guildRankStr,
Brushes.Solid(template.User.GuildRank.Color),
rankPen
));
} }
//avatar //avatar

View File

@@ -65,7 +65,7 @@
"Bar": { "Bar": {
"Show": true, "Show": true,
"Global": { "Global": {
"Color": "00000066", "Color": "00000095",
"PointA": { "PointA": {
"X": 321, "X": 321,
"Y": 104 "Y": 104
@@ -78,7 +78,7 @@
"Direction": 3 "Direction": 3
}, },
"Guild": { "Guild": {
"Color": "00000066", "Color": "00000095",
"PointA": { "PointA": {
"X": 282, "X": 282,
"Y": 248 "Y": 248