From 94aa28112d5a63aa44d65b1e2cea9ab8ef0dcdf6 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 12 Jan 2020 21:32:36 +0100 Subject: [PATCH] On LetterBox make a Pillarbox if aspect ratio is equal If background video and Vocaluxe have the same aspect ratio, switching to aspect ratio LetterBox would do a Pillarbox, so you can add 4:3 borders, if a video file has the wrong aspect ratio (maybe SAR value at 16:9, but a DAR value at 4:3). Without this change, LetterBox would do exactly the same as Crop in this special case. --- VocaluxeLib/CHelper.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/VocaluxeLib/CHelper.cs b/VocaluxeLib/CHelper.cs index 20efe943..fa5fb2f4 100644 --- a/VocaluxeLib/CHelper.cs +++ b/VocaluxeLib/CHelper.cs @@ -1,4 +1,4 @@ -#region license +#region license // This file is part of Vocaluxe. // // Vocaluxe is free software: you can redistribute it and/or modify @@ -101,6 +101,7 @@ namespace VocaluxeLib switch (aspect) { + case EAspect.Automatic: case EAspect.Crop: if (boundsAspectRatio >= aspectRatio) { @@ -138,7 +139,12 @@ namespace VocaluxeLib } break; case EAspect.LetterBox: - if (boundsAspectRatio <= aspectRatio) + if (boundsAspectRatio == aspectRatio) // Pillarbox + { + scaledWidth = bounds.W * 0.77f; + scaledHeight = bounds.W / aspectRatio; + } + else if (boundsAspectRatio < aspectRatio) { scaledWidth = bounds.W; scaledHeight = bounds.W / aspectRatio; @@ -306,4 +312,4 @@ namespace VocaluxeLib return bmp; } } -} \ No newline at end of file +}