Files
ersatztv/ErsatzTV.Core/Graphics/TextGraphicsElement.cs
T
timothyandtimothy ba6a4b08aa
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Skipped
Build ErsatzTV Image / CI toolchain image resolves (push) Successful in 9s
Build ErsatzTV Image / Delimiter ban (release path) (push) Successful in 25s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 8m40s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 6m18s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (push) Successful in 6m12s
Build ErsatzTV Image / Build & push image (amd64) (push) Successful in 4m13s
probe742/combined-newest SECOND
feat(732): On Now / Next gets a background box, and is on by default (#843)
Co-authored-by: Timothy <timothy@noreply.gitea.tblindustries.be>
2026-08-26 19:28:25 +00:00

118 lines
4.1 KiB
C#

using ErsatzTV.FFmpeg.State;
using YamlDotNet.Serialization;
namespace ErsatzTV.Core.Graphics;
public class TextGraphicsElement : BaseGraphicsElement
{
[YamlMember(Alias = "opacity_percent", ApplyNamingConventions = false)]
public int? OpacityPercent { get; set; }
[YamlMember(Alias = "opacity_expression", ApplyNamingConventions = false)]
public string OpacityExpression { get; set; }
public WatermarkLocation Location { get; set; }
[YamlMember(Alias = "horizontal_margin_percent", ApplyNamingConventions = false)]
public double? HorizontalMarginPercent { get; set; }
[YamlMember(Alias = "vertical_margin_percent", ApplyNamingConventions = false)]
public double? VerticalMarginPercent { get; set; }
[YamlMember(Alias = "width_percent", ApplyNamingConventions = false)]
public double? WidthPercent { get; set; }
[YamlMember(Alias = "text_fit", ApplyNamingConventions = false)]
public TextFit Fit { get; set; } = TextFit.None;
[YamlMember(Alias = "text_align", ApplyNamingConventions = false)]
public TextAlignment Align { get; set; } = TextAlignment.Left;
[YamlMember(Alias = "z_index", ApplyNamingConventions = false)]
public int? ZIndex { get; set; }
// Background box (ersatztv#732). Element-level, not per-style: the graphics engine renders one
// TextBlock into one bitmap, so a single box behind the whole element is the only shape the
// renderer can express. Unset background_color means no FILL; a border_color alone still draws
// an outlined box. With neither there is no box and no insets -- the pre-#732 geometry.
[YamlMember(Alias = "background_color", ApplyNamingConventions = false)]
public string BackgroundColor { get; set; }
[YamlMember(Alias = "background_opacity_percent", ApplyNamingConventions = false)]
public int? BackgroundOpacityPercent { get; set; }
[YamlMember(Alias = "background_padding", ApplyNamingConventions = false)]
public double? BackgroundPadding { get; set; }
[YamlMember(Alias = "background_corner_radius", ApplyNamingConventions = false)]
public double? BackgroundCornerRadius { get; set; }
[YamlMember(Alias = "border_color", ApplyNamingConventions = false)]
public string BorderColor { get; set; }
[YamlMember(Alias = "border_width", ApplyNamingConventions = false)]
public double? BorderWidth { get; set; }
public List<StyleDefinition> Styles { get; set; } = [];
[YamlMember(Alias = "base_style", ApplyNamingConventions = false)]
public string BaseStyle { get; set; }
[YamlMember(Alias = "include_fonts_from", ApplyNamingConventions = false)]
public string IncludeFontsFrom { get; set; }
[YamlMember(Alias = "epg_entries", ApplyNamingConventions = false)]
public int EpgEntries { get; set; }
public string Text { get; set; }
}
public enum TextFit
{
None,
Wrap,
Scale
}
public enum TextAlignment
{
Left,
Center,
Right
}
public class StyleDefinition
{
public string Name { get; set; }
[YamlMember(Alias = "font_size", ApplyNamingConventions = false)]
public float? FontSize { get; set; }
[YamlMember(Alias = "font_weight", ApplyNamingConventions = false)]
public int? FontWeight { get; set; }
[YamlMember(Alias = "font_italic", ApplyNamingConventions = false)]
public bool? FontItalic { get; set; }
[YamlMember(Alias = "font_family", ApplyNamingConventions = false)]
public string FontFamily { get; set; }
[YamlMember(Alias = "text_color", ApplyNamingConventions = false)]
public string TextColor { get; set; }
[YamlMember(Alias = "letter_spacing", ApplyNamingConventions = false)]
public float? LetterSpacing { get; set; }
[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; }
}