ffmpeginteropx / FFmpegInteropX

FFmpeg decoding library for Windows 10 UWP and WinUI 3 Apps
Apache License 2.0
211 stars 53 forks source link

ASS Fixes 2: Outlines and Curly Brace Parsing #402

Closed softworkz closed 9 months ago

softworkz commented 10 months ago

SubtitleProviderSsaAss: Fix outline color SubtitleProviderSsaAss: Fix outline and radius sizes SubtitleProviderSsaAss: Fix error with single curly braces

softworkz commented 10 months ago

Explanations

Curly Brace Parsing

Curly braces are still valid in ASS text, which means that a text like "it was a {crazy} run" must be rendered exaxtly as is. A control section is only entered when followed by a backslash, so we need to adjust the find string accordingly:

auto nextEffect = str.find(L"{\");

(I forgot to remove the comment line)

Outline Color

The incorrect outline color issue was easy. The code accidentally used the alpha from the foreground color.

Outline Width

The outline width is calculated correctly now.

Outline Blurring

TimeTextStyle.OutlineRadius specifies the amount by which to blur the outline. It wasn't right to set it to the same value as OutlineWidth. Outline blurring is enabled by the \beX token and that is properly implemented now.

[!NOTE]
Outline Blurring is currently not implemented. The value is unused in case of WinUI2 and 3

softworkz commented 10 months ago

Looks all good. Setting OutlineRadius has never had any effect.

In my PR I'm suggesting to implement it. (and also to remove the alpha component from the outline color when drawing the outlines, put all of them into a separate layer and apply the alpha component as opacity to that layer)