From 4e43817f8e849cec504f22987f4382e63547c4ce Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Tue, 14 Oct 2025 06:41:32 -0500 Subject: [PATCH] add graphics engine text halo (#2528) --- CHANGELOG.md | 2 ++ ErsatzTV.Core/Graphics/TextGraphicsElement.cs | 9 +++++++++ .../Streaming/Graphics/Text/TextElement.cs | 15 +++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dfbea537..4e2b03059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Positive and negative margins can be used to offset from center as desired - Add `line_height` property to text element style definition - This is a multiplier that defaults to 1.0 when unspecified + - Add `halo_color`, `halo_width` and `halo_blur` properties to text element style definition + - These can be used to "outline" text with the configured color (e.g. `#000000`), width (e.g. `10`) and amount of blur (e.g. `2`) - Add `Block Playout Troubleshooting` tool to help investigate block playout history - Add sequential schedule file and scripted schedule file names to playouts table - Add empty (but already up-to-date) sqlite3 database to greatly speed up initial startup for fresh installs diff --git a/ErsatzTV.Core/Graphics/TextGraphicsElement.cs b/ErsatzTV.Core/Graphics/TextGraphicsElement.cs index 70e9d3572..18b68dca7 100644 --- a/ErsatzTV.Core/Graphics/TextGraphicsElement.cs +++ b/ErsatzTV.Core/Graphics/TextGraphicsElement.cs @@ -83,4 +83,13 @@ public class StyleDefinition [YamlMember(Alias = "line_height", ApplyNamingConventions = false)] public float? LineHeight { get; set; } + + [YamlMember(Alias = "halo_color", ApplyNamingConventions = false)] + public string HaloColor { get; set; } + + [YamlMember(Alias = "halo_width", ApplyNamingConventions = false)] + public float? HaloWidth { get; set; } + + [YamlMember(Alias = "halo_blur", ApplyNamingConventions = false)] + public float? HaloBlur { get; set; } } diff --git a/ErsatzTV.Infrastructure/Streaming/Graphics/Text/TextElement.cs b/ErsatzTV.Infrastructure/Streaming/Graphics/Text/TextElement.cs index b7e6e6e89..b6c83c0e5 100644 --- a/ErsatzTV.Infrastructure/Streaming/Graphics/Text/TextElement.cs +++ b/ErsatzTV.Infrastructure/Streaming/Graphics/Text/TextElement.cs @@ -223,6 +223,21 @@ public partial class TextElement( TextColor = SKColor.TryParse(def.TextColor, out SKColor color) ? color : SKColors.White }; + if (SKColor.TryParse(def.HaloColor, out SKColor parsedHaloColor)) + { + style.HaloColor = parsedHaloColor; + } + + foreach (float haloWidth in Optional(def.HaloWidth)) + { + style.HaloWidth = haloWidth; + } + + foreach (float haloBlur in Optional(def.HaloBlur)) + { + style.HaloBlur = haloBlur; + } + foreach (float fontSize in Optional(def.FontSize)) { style.FontSize = fontSize;