Skip to content

LetterboxEffect Class

Definition

Namespace: Brine2D.Rendering.SDL.PostProcessing.Effects

Post-processing effect that scales the fixed-design-resolution main render target into a centered, aspect-preserving rect within the current swapchain, filling the remaining letterbox/pillarbox bars with BarColor.

C#
public sealed class LetterboxEffect : Brine2D.Rendering.SDL.PostProcessing.ISDL3PostProcessEffect, Brine2D.Rendering.PostProcessing.IPostProcessEffect

Inheritance System.Object → LetterboxEffect

Implements ISDL3PostProcessEffect, IPostProcessEffect

Remarks

Unlike other ISDL3PostProcessEffect implementations, this effect's "dimensions" \(via [SetDimensions\(int, int\)](SetDimensions(int,int).md 'Brine2D.Rendering.SDL.PostProcessing.Effects.LetterboxEffect.SetDimensions\(int, int\)')) represent the live swapchain size, not its own render size — the design resolution is fixed at construction and never changes. This effect is intended to always run last in the pipeline.

Properties
BarColor Color used to fill the letterbox/pillarbox bars. Defaults to opaque black.
Methods
ComputeFitRect\(int, int\) Computes the centered, aspect-preserving destination rect for the design resolution within the given swapchain dimensions.
SetDimensions\(int, int\) Updates the tracked swapchain \(window\) dimensions. Called on window resize.